Bounding Box Utilities¶
- py123d.geometry.utils.bounding_box_utils.get_corners_2d_factors()[source]¶
Returns the factors to compute the corners of a SE2 bounding box in the body frame.
The factors are defined such that multiplying them with the length and width of the bounding box yields the corner coordinates in the body frame.
- Return type:
- Returns:
A (4, 2), indexed by
Corners2DIndexandPoint2DIndex, respectively.
- py123d.geometry.utils.bounding_box_utils.get_corners_3d_factors()[source]¶
Returns the factors to compute the corners of a SE3 bounding box in the body frame.
The factors are defined such that multiplying them with the length, width, and height of the bounding box yields the corner coordinates in the body frame.
- Return type:
- Returns:
A (8, 3), indexed by
Corners3DIndexandVector3DIndex, respectively.
- py123d.geometry.utils.bounding_box_utils.bbse2_array_to_corners_array(bbse2)[source]¶
Converts an array of BoundingBoxSE2 objects to the 2D coordinates array of their corners.
- Parameters:
bbse2 (
ndarray[tuple[Any,...],dtype[float64]]) – Array of SE2 bounding boxes, indexed byBoundingBoxSE2Index.- Return type:
- Returns:
Coordinates array of shape (…, 4, 2), indexed by
Corners2DIndexandPoint2DIndex, respectively.
- py123d.geometry.utils.bounding_box_utils.bbse2_array_to_polygon_array(bbse2)[source]¶
Converts an array of BoundingBoxSE2 objects to an array of shapely Polygons.
- py123d.geometry.utils.bounding_box_utils.corners_2d_array_to_polygon_array(corners_array)[source]¶
Converts an array of 2D corners to an array of shapely Polygons. TODO: Consider removing this function?
- py123d.geometry.utils.bounding_box_utils.bbse3_array_to_corners_array(bbse3_array)[source]¶
Converts an array of BoundingBoxSE3 objects to the 3D coordinates array of their corners.
- Parameters:
bbse3_array (
ndarray[tuple[Any,...],dtype[float64]]) – Array of SE3 bounding boxes, indexed byBoundingBoxSE3Index.- Return type:
- Returns:
Coordinates array of shape (…, 8, 3), indexed by
Corners3DIndexandPoint3DIndex, respectively.
- py123d.geometry.utils.bounding_box_utils.corners_array_to_3d_mesh(corners_array)[source]¶
Creates a triangular mesh representation of boxes defined by their corner points.
- Parameters:
corners_array (
ndarray[tuple[Any,...],dtype[float64]]) – An array of shape (…, 8, 3) representing the corners of the boxes.- Return type:
Tuple[ndarray[tuple[Any,...],dtype[float64]],ndarray[tuple[Any,...],dtype[int32]]]- Returns:
A tuple containing the vertices and faces of the mesh.
- py123d.geometry.utils.bounding_box_utils.corners_array_to_edge_lines(corners_array)[source]¶
Creates line segments representing the edges of boxes defined by their corner points.
- py123d.geometry.utils.bounding_box_utils.points_3d_in_bbse3_array(points_3d, bbse3_array, z_axis_threshold=None)[source]¶
Check which points are inside each bounding box in a batch. See [1], [2] for reference.
- Parameters:
points_3d (
ndarray[tuple[Any,...],dtype[TypeVar(_ScalarT, bound=generic)]]) – Array of 3D points, shape (M, 3), indexed byPoint3DIndex.bbse3_array (
ndarray[tuple[Any,...],dtype[TypeVar(_ScalarT, bound=generic)]]) – SE3 bounding boxes, either of shape (N, 10) or (10,), indexed byBoundingBoxSE3Index.z_axis_threshold (
Optional[float]) – Optional threshold to points, that are below the box in the z-axis, (starting at the bottom). Can be used to crop ground points.
- Return type:
- Returns:
Boolean array of shape (N, M) or (M,) indicating if each point the respective box.
References