Open beneltayar opened 1 year ago
hi,
that is indeed a bug. when possible, the code tries to use the convex hull of the points to build the oriented box, but it doesn't check the validity of the simplices of the hull during that process, which it should.
i will have a look at how this can be done more robustly. in the meantime, you could use the function the algorithm normally falls back to if the convex hull algorithm fails. it is more robust but doesn't always produce the smallest oriented box for the input.
from compas.geometry import Point, Box
from compas.geometry.bbox.bbox_numpy import oabb_numpy
from compas_view2.app import App
points = [
[198.71435547, -18.45817566, 61.03982544],
[198.78266907, -18.38731384, 62.90990448],
[198.78266907, -18.38731384, 61.03982544],
[199.78454590, -17.34801292, 62.90990448],
[199.26994324, -17.88183594, 75.31147766],
[199.78454590, -17.34801292, 64.32066345],
[199.78454590, -17.34801292, 62.90989685],
]
box = oabb_numpy(points)
box = Box.from_bounding_box(box)
viewer = App()
for point in points:
viewer.add(Point(*point))
viewer.add(box)
viewer.run()
@beneltayar i think this is now resolved. would you mind having a look?
There are some valid inputs that cause
oriented_bounding_box_numpy
to throw annumpy.linalg.LinAlgError
To Reproduce
Output
Expected behavior Getting an oriented bounding box of this specific set of points
Desktop: