Skip to content

Commit

Permalink
fix: order of size
Browse files Browse the repository at this point in the history
Signed-off-by: ktro2828 <[email protected]>
  • Loading branch information
ktro2828 committed Nov 29, 2024
1 parent fb92f90 commit 61582af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion t4_devkit/dataclass/box.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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])
Expand Down
7 changes: 6 additions & 1 deletion t4_devkit/dataclass/shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.
Expand Down

0 comments on commit 61582af

Please sign in to comment.