robokudo.utils.math_helper ========================== .. py:module:: robokudo.utils.math_helper Functions --------- .. autoapisummary:: robokudo.utils.math_helper.intersection_point robokudo.utils.math_helper.distance robokudo.utils.math_helper.intersecting_spheres robokudo.utils.math_helper.intersecting_cuboids robokudo.utils.math_helper.does_line_intersect_sphere robokudo.utils.math_helper.compute_direction_vector_angle Module Contents --------------- .. py:function:: intersection_point(P1, P2, t) Calculate the intersection point based on t value. .. py:function:: distance(point1, point2) Calculate the Euclidean distance between two points. .. py:function:: intersecting_spheres(P1, P2, spheres) Check where the first intersection between the line segment described by P1 and P2 and the spheres in our parameters happens. Spheres must be a list of triples (name, center, radius) :param P1: Start point of the line segment (x, y, z). :param P2: End point of the line segment (x, y, z). :param spheres: List of tuples (name, center, radius) where center is a tuple (x, y, z). :return: List of tuples (dist to P1, name, center, radius, first_intersection_from_P1). .. py:function:: intersecting_cuboids(P1, P2, cuboids) Check where the first intersection between the line segment described by P1 and P2 and the cuboids in our parameters happens. The intersection problem is solved using the slab method (see https://en.wikipedia.org/wiki/Slab_method). Cuboids must be a list of tuples (name, position, orientation, size) :param P1: Start point of the line segment (x, y, z). :param P2: End point of the line segment (x, y, z). :param cuboids: List of tuples (name, position, orientation, size) where position is a tuple (x, y, z), orientation is a tuple (x, y, z, w) representing a quaternion, and size is a tuple (width, height, depth). :return: List of tuples (dist to P1, name, cuboid_min, cuboid_max, first_intersection_from_P1). .. py:function:: does_line_intersect_sphere(P1, P2, C, r) .. py:function:: compute_direction_vector_angle(direction_vector: numpy.ndarray, floor: numpy.ndarray = np.array([0, 1, 0], dtype=float)) -> float Computes the angle of a direction vector in degrees relative to the floor. The angle is computed as the arctangent of the y and x components of the vector. :param direction_vector: A 3D vector (numpy array) representing the direction. :param floor: A 3D vector (numpy array) representing the floor normal. Default is (0, 1, 0). :return: Angle in degrees.