# Difference in rotation matrix

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?

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}$$
• I have the problem in the final step. I use B1 *(U1→2)^-1 for object B and this looks like it applies the rotation U1→2 to object B around the object's B coordinate system. It works as needed if MA1 is identity. – pazduha Dec 20 '18 at 13:35