I have a rotation matrix like so:
[1, 0, 0] -> right axis (x) [0, 1, 0] -> up axis (y) [0, 0, 1] -> look direction (z) [M11, M12, M13] [M21, M22, M23] [M31, M32, M33]
I would like to extract the euler angles from this matrix where yaw is rotation around the y axis, pitch is rotation around the x axis, and roll is rotation around the z axis.
Here is my code so far:
yaw = Atan2(M31, M33); pitch = -Asin(M32); roll = Atan2(M21, M22);
The yaw and pitch are computed correctly. The roll, however, is incorrect. How should this 3D rotation matrix be decomposed?