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

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