Open tpetri94 opened 6 years ago
The algorithm that ContOrientedBox3() uses is not the minimal oriented bounding box, it's just a containing oriented box. It is a very simple/fast algorithm, based on computing the covariance matrix of the point set.
To compute the minimal box, first it is necessary to compute the convex hull, and then do rotating calipers on the convex hull. This is much slower and I've only done it for the 2D case so far. There is C++ code here that uses many of the same class-names/conventions as g3Sharp (lots of g3Sharp is ported from this library):
https://www.geometrictools.com/GTEngine/Include/Mathematics/GteMinimumVolumeBox3.h
but it's not cut-and-paste porting, unfortunately.
In ContOrientedBox3, is there a value of rotation matrix stored? I want to keep a rotation matrix.
Hi, @rms80 there is a plan to porting the minimal oriented bounding box?
Hi,
I'm using the the ContOrientedBox3() class to generate oriented bounding boxes from convex point sets. The problem that I encountered is that these boxes, while seemingly having the correct size, are oriented in weird directions.
My code looks as following:
When I use axis aligned bounding boxes and generate the rotation quaternion exactly as above, I get decent results. Here are two results for the same 3 point sets (which form a pistol). Left oriented, right AA:
I repainted the edges manually, as the boxes were just plain white before, which was harder to see. Before using g3s, I used trimesh in Python, which also has an implementation for oriented bounding boxes - which produced different, good looking results for the same underlying points .