Skip to content

Commit

Permalink
Expose minimal oriented bounding box to python api (#6946)
Browse files Browse the repository at this point in the history
---------
Co-authored-by: Sharon Berezalsky <sharon@buildots.com>
  • Loading branch information
sharon-br authored Sep 4, 2024
1 parent b2d1f78 commit 553ca86
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cpp/pybind/geometry/boundingvolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,27 @@ The returned bounding box is an approximation to the minimal bounding box.
open3d.geometry.OrientedBoundingBox: The oriented bounding box. The
bounding box is oriented such that the axes are ordered with respect to
the principal components.
)doc")
.def_static("create_from_points_minimal",
&OrientedBoundingBox::CreateFromPointsMinimal,
"points"_a, "robust"_a = false,
R"doc(
Creates the oriented bounding box with the smallest volume.
The algorithm makes use of the fact that at least one edge of
the convex hull must be collinear with an edge of the minimum
bounding box: for each triangle in the convex hull, calculate
the minimal axis aligned box in the frame of that triangle.
at the end, return the box with the smallest volume
Args:
points (open3d.utility.Vector3dVector): Input points.
robust (bool): If set to true uses a more robust method which works in
degenerate cases but introduces noise to the points coordinates.
Returns:
open3d.geometry.OrientedBoundingBox: The oriented bounding box. The
bounding box is oriented such that its volume is minimized.
)doc")
.def("volume", &OrientedBoundingBox::Volume,
"Returns the volume of the bounding box.")
Expand Down

0 comments on commit 553ca86

Please sign in to comment.