Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose minimal oriented bounding box to python api #6946

Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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_minimal_from_points",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we name create_from_points_minimal instead so that it matches the C++ function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Is there any timeline regarding the 0.19 release?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As soon as we can get the Python 3.12 support PR merged. There are still some test failures blocking that.

&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
Loading