gabyx / ApproxMVBB

Fast algorithms to compute an approximation of the minimal volume oriented bounding box of a point cloud in 3D.
Mozilla Public License 2.0
441 stars 93 forks source link

possible to get translation between frames K and I? #42

Closed carismoses closed 4 years ago

carismoses commented 4 years ago

I understand that m_q_KI is the rotation between frames K and I, but is there an easy way to get the translation between these two frames (from the world frame that the points are represented in to the center of the bounding box)?

gabyx commented 4 years ago

There is no translation between I and K. A OOBB oobb is represented by a simple rotation from coord. sys I to system K (3x3 Matrix). Here, represented by a quternion m_q_KI. Together with the two points m_minPoint and m_maxPoint it fully describes the box.

https://github.com/gabyx/ApproxMVBB/blob/5618ed4d3d56f8af704ecf5542212a0f67ea478e/include/ApproxMVBB/OOBB.hpp#L206

The center in coord. sys K is given by

Vector3 K_center = 0.5 * (oobb.m_maxPoint + oobb.m_minPoint);
// or 
K_center = oobb.center();

Transforming this back to the I system, results in

I_center = (oobb.m_q_KI * K_center).eval(); // corresponds to the coord. system transformation I_center = A_IK * K_center (where A_IK = 3x3x matrix)
gabyx commented 4 years ago

Look also at oobb.getCornerPoints https://github.com/gabyx/ApproxMVBB/blob/5618ed4d3d56f8af704ecf5542212a0f67ea478e/include/ApproxMVBB/OOBB.hpp#L181