Sign in to follow this  
maya18222

Rotation Matrix Angle

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


Link to post
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 this post


Link to 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


Link to post
Share on other sites
Quote:
Original post by maya18222
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().

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


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this