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

Bugfix/bbox #1352

Merged
merged 8 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Changed imports of itertools to `compas.itertools` instead of `compas.utilities`.
* Updated `compas_rhino.conversions.point_to_compas` to allow for `Rhino.Geometry.Point` as input.
* Changed `compas.datastructures.Tree.print_hierarchy` to `compas.datastructures.Tree.__str__`.
* Fixed `compas.geometry.bbox_numpy.minimum_volume_box` to avoid `numpy.linalg.LinAlgError`.

### Removed

Expand Down
5 changes: 4 additions & 1 deletion src/compas/geometry/bbox_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from compas.geometry import local_to_world_coordinates_numpy
from compas.geometry import pca_numpy
from compas.geometry import world_to_local_coordinates_numpy
from compas.geometry import length_vector
from compas.tolerance import TOL

from .bbox import bounding_box
Expand Down Expand Up @@ -73,7 +74,7 @@ def oriented_bounding_box_numpy(points, tol=None):
>>> a = length_vector(subtract_vectors(bbox[1], bbox[0]))
>>> b = length_vector(subtract_vectors(bbox[3], bbox[0]))
>>> c = length_vector(subtract_vectors(bbox[4], bbox[0]))
>>> close(a * b * c, 30.)
>>> close(a * b * c, 30.0)
True

"""
Expand Down Expand Up @@ -198,6 +199,8 @@ def minimum_volume_box(points, return_size=False):
for simplex in hull.simplices:
a, b, c = points[simplex]
uvw = local_axes(a, b, c)
if not length_vector(uvw[0]) or not length_vector(uvw[1]):
continue
frame = [a, uvw[0], uvw[1]]
rst = world_to_local_coordinates_numpy(frame, xyz)
rmin, smin, tmin = amin(rst, axis=0)
Expand Down
Loading
Loading