Bounding Boxes¶
- class py123d.geometry.BoundingBoxSE2[source]¶
Rotated bounding box in 2D defined by a center
PoseSE2, length and width.Example
>>> from py123d.geometry import PoseSE2, BoundingBoxSE2 >>> bbox = BoundingBoxSE2(center_se2=PoseSE2(1.0, 2.0, 0.5), length=4.0, width=2.0) >>> bbox.array array([1. , 2. , 0.5, 4. , 2. ]) >>> bbox.corners_array.shape (4, 2) >>> bbox.shapely_polygon.area 8.0
Public Data Attributes:
center_se2The center of the bounding box as a
PoseSE2instance.lengthLength of the bounding box along the x-axis in the local frame.
widthWidth of the bounding box along the y-axis in the local frame.
arrayThe numpy array representation of shape (5,), indexed by
BoundingBoxSE2Index.corners_arrayThe corner points of the bounding box as a numpy array of shape (4, 2), indexed by
Corners2DIndexandPoint2DIndex, respectively.corners_dictDictionary of corner points of the bounding box, mapping
Corners2DIndextoPoint2Dinstances.shapely_polygonThe shapely polygon representation of the bounding box.
bounding_box_se2The
BoundingBoxSE2instance itself.Inherited from
ArrayMixinarrayThe array representation of the geometric entity.
shapeReturn the shape of the array.
Public Methods:
from_array(array[, copy])Create a
BoundingBoxSE2from a (5,) numpy array, indexed byBoundingBoxSE2Index.Inherited from
ArrayMixinfrom_array(array[, copy])Create an instance from a NumPy array.
from_list(values)Create an instance from a list of values.
tolist()Convert the array to a Python list.
to_list()Convert the array to a Python list.
copy()Return a copy of the object with a copied array.
- __init__(center_se2, length, width)[source]¶
Initialize
BoundingBoxSE2withPoseSE2center, length and width.
- classmethod from_array(array, copy=True)[source]¶
Create a
BoundingBoxSE2from a (5,) numpy array, indexed byBoundingBoxSE2Index.- Parameters:
- Return type:
- Returns:
A
BoundingBoxSE2instance.
- property array: ndarray[tuple[Any, ...], dtype[float64]]¶
The numpy array representation of shape (5,), indexed by
BoundingBoxSE2Index.
- property corners_array: ndarray[tuple[Any, ...], dtype[float64]]¶
The corner points of the bounding box as a numpy array of shape (4, 2), indexed by
Corners2DIndexandPoint2DIndex, respectively.
- property corners_dict: Dict[Corners2DIndex, Point2D]¶
Dictionary of corner points of the bounding box, mapping
Corners2DIndextoPoint2Dinstances.
- property shapely_polygon: Polygon¶
The shapely polygon representation of the bounding box.
- property bounding_box_se2: BoundingBoxSE2¶
The
BoundingBoxSE2instance itself.
- copy()¶
Return a copy of the object with a copied array.
- Return type:
ArrayMixin
- class py123d.geometry.BoundingBoxSE3[source]¶
Rotated bounding box in 3D defined by center with quaternion rotation (PoseSE3), length, width and height.
Example
>>> from py123d.geometry import PoseSE3, BoundingBoxSE3 >>> bbox = BoundingBoxSE3(center_se3=PoseSE3(1.0, 2.0, 3.0, 1.0, 0.0, 0.0, 0.0), length=4.0, width=2.0, height=1.5) >>> bbox.array array([1. , 2. , 3. , 1. , 0. , 0. , 0. , 4. , 2. , 1.5]) >>> bbox.bounding_box_se2.array array([1., 2., 0., 4., 2.]) >>> bbox.shapely_polygon.area 8.0
Public Data Attributes:
center_se3The center of the bounding box as a
PoseSE3instance.center_se2The center of the bounding box as a
PoseSE2instance.lengthThe length of the bounding box along the x-axis in the local frame.
widthThe width of the bounding box along the y-axis in the local frame.
heightThe height of the bounding box along the z-axis in the local frame.
arrayThe numpy array representation of shape (10,), indexed by
BoundingBoxSE3Index.bounding_box_se2The SE2 projection
BoundingBoxSE2of the bounding box.corners_arrayThe corner points of the bounding box as a numpy array of shape (8, 3), indexed by
Corners3DIndexandPoint3DIndex, respectively.corners_dictDictionary of corner points of the bounding box, mapping
Corners3DIndextoPoint3Dinstances.shapely_polygonThe shapely polygon representation of the SE2 projection of the bounding box.
Inherited from
ArrayMixinarrayThe array representation of the geometric entity.
shapeReturn the shape of the array.
Public Methods:
from_array(array[, copy])Create a
BoundingBoxSE3from a (10,) numpy array, indexed byBoundingBoxSE3Index.Inherited from
ArrayMixinfrom_array(array[, copy])Create an instance from a NumPy array.
from_list(values)Create an instance from a list of values.
tolist()Convert the array to a Python list.
to_list()Convert the array to a Python list.
copy()Return a copy of the object with a copied array.
- __init__(center_se3, length, width, height)[source]¶
Initialize
BoundingBoxSE3withPoseSE3center, length, width and height.- Parameters:
center_se3 (
PoseSE3) – Center of the bounding box as aPoseSE3instance.length (
float) – Length of the bounding box along the x-axis in the local frame.width (
float) – Width of the bounding box along the y-axis in the local frame.height (
float) – Height of the bounding box along the z-axis in the local frame.
- classmethod from_array(array, copy=True)[source]¶
Create a
BoundingBoxSE3from a (10,) numpy array, indexed byBoundingBoxSE3Index.
- property array: ndarray[tuple[Any, ...], dtype[float64]]¶
The numpy array representation of shape (10,), indexed by
BoundingBoxSE3Index.
- property bounding_box_se2: BoundingBoxSE2¶
The SE2 projection
BoundingBoxSE2of the bounding box.
- property corners_array: ndarray[tuple[Any, ...], dtype[float64]]¶
The corner points of the bounding box as a numpy array of shape (8, 3), indexed by
Corners3DIndexandPoint3DIndex, respectively.
- property corners_dict: Dict[Corners3DIndex, Point3D]¶
Dictionary of corner points of the bounding box, mapping
Corners3DIndextoPoint3Dinstances.
- property shapely_polygon: Polygon¶
The shapely polygon representation of the SE2 projection of the bounding box.
- copy()¶
Return a copy of the object with a copied array.
- Return type:
ArrayMixin