Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
romanarust committed May 7, 2024
1 parent 2890d4c commit f40608c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +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 ignore `numpy.linalg.LinAlgError`.
* Fixed `compas.geometry.bbox_numpy.minimum_volume_box` to avoid `numpy.linalg.LinAlgError`.

### Removed

Expand Down
9 changes: 4 additions & 5 deletions src/compas/geometry/bbox_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
from numpy import sum
from numpy import vstack
from numpy import zeros
from numpy.linalg import LinAlgError
from scipy.spatial import ConvexHull

from compas.geometry import local_axes
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 @@ -199,11 +199,10 @@ def minimum_volume_box(points, return_size=False):
for simplex in hull.simplices:
a, b, c = points[simplex]
uvw = local_axes(a, b, c)
frame = [a, uvw[0], uvw[1]]
try:
rst = world_to_local_coordinates_numpy(frame, xyz)
except LinAlgError:
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)
rmax, smax, tmax = amax(rst, axis=0)
dr = rmax - rmin
Expand Down

0 comments on commit f40608c

Please sign in to comment.