I have two objects A and B, with a start transformation matrices MA1 and MB1 (they include translation, rotation and scale). End matrix of the first object is MA2. How do I apply the same rotation as a rotation of object A from MA1 to MA2 ( difference) to object B and get MB2?
1 Answer
$\begingroup$
$\endgroup$
1
First you extract rotation matrix from transformation matrix. You take top-left 3×3 submatrix $T$ and use polar decomposition to find rotation matrix $U$. If you know that scale is the same on all axes, then you can just divide $T$ by cubic root of determinant: $U=T/\sqrt[3]{\det T}$.
Finally, $U_{1\to2} = U_{A2} U_{A1}^{-1}$
-
$\begingroup$ I have the problem in the final step. I use
B1 *(U1→2)^-1
for objectB
and this looks like it applies the rotationU1→2
to objectB
around the object'sB
coordinate system. It works as needed if MA1 is identity. $\endgroup$– pazduhaDec 20, 2018 at 13:35