diff --git a/t4_devkit/dataclass/box.py b/t4_devkit/dataclass/box.py index b558089..0c9cedd 100644 --- a/t4_devkit/dataclass/box.py +++ b/t4_devkit/dataclass/box.py @@ -151,6 +151,11 @@ def __eq__(self, other: Box3D | None) -> bool: @property def size(self) -> SizeType: + """Return the box size in the order of (width, length, height). + + Returns: + (width, length, height) values. + """ return self.shape.size @property @@ -175,7 +180,7 @@ def corners(self, box_scale: float = 1.0) -> NDArrayF64: First four corners are the ones facing forward. The last four are the ones facing backwards, in the shape of (8, 3). """ - length, width, height = self.size * box_scale + width, length, height = self.size * box_scale # 3D box corners (Convention: x points forward, y to the left, z up.) x_corners = 0.5 * length * np.array([1, 1, 1, 1, -1, -1, -1, -1]) diff --git a/t4_devkit/dataclass/shape.py b/t4_devkit/dataclass/shape.py index 0617119..83d21b1 100644 --- a/t4_devkit/dataclass/shape.py +++ b/t4_devkit/dataclass/shape.py @@ -39,6 +39,11 @@ def from_name(cls, name: str) -> Self: class Shape: """A dataclass to represent the 3D box shape. + Attributes: + shape_type (ShapeType): Box shape type. + size (SizeType): Box size in the order of (width, length, height). + footprint (Polygon): Polygon of footprint. + Examples: >>> shape = Shape( ... shape_type=ShapeType.BOUNDING_BOX, @@ -62,7 +67,7 @@ def _calculate_footprint(size: SizeType) -> Polygon: """Return a footprint of box as `Polygon` object. Args: - size (SizeType): Size of box ordering in (length, width, height). + size (SizeType): Size of box ordering in (width, length, height). Returns: Footprint in a clockwise order started from the top-right corner.