Hi all,
As I play around bounding box, it looks like the current bounding box implementation is AABB rotated according to mesh local rotation.
I have modified the playground of Mesh Intersection from docs.
From left to right:
- AABB
- OBB with local rotation
- OBB with baked rotation as vertex data
As you can see, the 3rd bounding box is actually the same as AABB.
I would prefer to get result similar to 2nd bounding box, is there any way to get more accurate bounding box?
1 Like
I have done some more searching about the topic, looks like what I’m looking for is call Minimum volume bounding box (MVBB) / Optimal bounding box.
Thanks to the efforts of this awesome community, I could stand on the shoulders of giants by using other libraries with little boilerplate.
Here are 2 versions I came up with:
- Yuka.js
The rotation is not quite right but at least it is much better than the AABB version.
- CGAL (using wasm)
The visualization looks exactly what I want. But I’m not sure how to do intersection test on the generated OBB without box directions.
Credit: Cgal library webassembly port
2 Likes
Nice! I plan to expose most of the cgal functions, make it easier to use.
For the intersection issue you can probably do refreshBoundingInfo or use raycaster instead