# Rotation Matrix Angle

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

## 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 on other sites
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 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 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.

1. 1
2. 2
3. 3
Rutin
21
4. 4
5. 5
khawk
14

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633654
• Total Posts
3013170
×