• Advertisement

# Rotation Matrix Angle

This topic is 3138 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Ive been reading, that you can get the get the axis angle from a matrix. The first part being getting the angle via :- angle = acos(( m00 + m11 + m22 - 1)/2) Now this makes sense for single matrices, of axes around x,y and z, as their trace is always 2Cos +1. But how is this working when you concatenate. For example, if you have
M1 = RotationMatrixX;
M2 = RotationMatrixY;

MFinal = M1 * M2;

angle = acos(( MFinal.m00 + MFinal.m11 + MFinal.m22 - 1)/2);


In that case the diagonal elements of MFinal are not made up of 2cos() and a 1, but 2cos() and a cos()^2.

#### Share this post

##### Share on other sites
Advertisement
When you multiply two rotation matrices together, the result is also a rotation matrix. Have a look here:

http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/

#### Share this post

##### Share on other sites
Yeah, i can see how that works. But when you multiply 2 rotation matrices togeather, one of the diagonal elements becomes the sum of cos()*cos().

And so i dont see how the

angle = acos(( m00 + m11 + m22 - 1)/2)

technique now works.

#### Share this post

##### Share on other sites
Quote:
 Original post by maya18222Yeah, i can see how that works. But when you multiply 2 rotation matrices togeather, one of the diagonal elements becomes the sum of cos()*cos().

A product of two rotation matrices is a rotation matrix itself. It's just no longer a rotation around one of the old axes. That's why the cos^2 terms appear. You could fix that by going to the correct coordinate system, where one of the axes is the axis of rotation. But you don't have to do that, since trace is invariant wrt linear transformation. So you can still do the trick above and get the rotation angle. The only thing is, it will be around some unknown axis (not necessarily around Z, for example). The link mmakrzem gave seems to explain how to find the axis as well.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement
• ### Popular Tags

• Advertisement
• ### Popular Now

• 12
• 11
• 22
• 11
• 15
• Advertisement