trimesh.bounds.oriented_bounds
is slow for NumPy array input.
#2342
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
While using
trimesh==4.5.0
to compute the minimum volume oriented bounding box of a mesh, I noticed the following bug. Running the below code seems to take an extremely long time:But running this similar piece of code completed in ~7 seconds:
My best guess is that, in the first case, the computed convex hull's face adjacencies seem to be wrong although I'm not sure how exactly. Line 253 in
bounds.py
computes 139156 edges that need to be checked, which doesn't seem right. In the second case, only 516 edges are checked.I noticed that, in the first case, the convex hull is being computed by
trimesh.convex.convex_hull(..., repair=False)
and, in the second case, the convex hull is effectively being computed withtrimesh.convex.convex_hull(..., repair=True)
. This PR makes both cases userepair = True
. Hopefully the solution is indeed that simple.Thanks for the great library!