• Advertisement

Archived

This topic is now archived and is closed to further replies.

Extracting rotation angles from 4x4 Matrixes

This topic is 5526 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

Is there any way to extract the X, Y and Z rotation angles from a 4x4 matrix, once the matrix has been concentrated from each of the X, Y and Z rotation matrixes ? I was thinking that creating an inverse matrix for each of the X, Y and Z elements might be possible, but I have yet to understand how inverse matrixes work or if it is possible to use one for the solution to my problem. The reason I need calculate the angles, instead of just store the angles used to create the matrix in the first place, is that I just implemented a LookAt() function into my code. The LookAt() function applies a concentrated rotation matrix - Which means I don''t know the angles used for this calculation. Thanks in advance. - Mort

Share this post


Link to post
Share on other sites
Advertisement
Yes there is a way but it''s quite some work.

First, you expand your rotation matrix in their maths forms (in sin,cos from a maths book) in the particular euler order you want ( on paper ).

If you expand the sin,cos correctly, you should see some terms cancel each other off. You can use asin, atan2 to obtain the 3 angles.

Share this post


Link to post
Share on other sites
A 4x4 3d rotation matrix? Are you using it to make rigid rotation for projective vectors?

In that case the last row and column are simply null-vectors with R44=1 and a 3x3 rotation matrix is the first 3x3 submatrix.

Then the angles could be extracted but with a lot of ambiguity. First of all they''ll be only accurate up to a Pi and even then, one you recover the Y and Z angles you will have to choose between several solutions for X as it becomes a non-linear problem (I think when I did it I had 2 roots).

I am not sure this is what your problem is but I hope this helps.
I use quaternion matrices as it is much easier and faster to extract angles from them.

EPHERE

Share this post


Link to post
Share on other sites

  • Advertisement