How to get more accurate bounding box when local rotation does not help?

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:

  1. AABB
  2. OBB with local rotation
  3. 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?

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. :smiley:

Here are 2 versions I came up with:

  1. Yuka.js
    The rotation is not quite right but at least it is much better than the AABB version.
  1. 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