I was wondering what would be an easy way to isolate the X, Y and Z rotation from an OpenGL-matrix. Let’s say I’ve got the rotation information in the upper left 3x3 sub matrix of a standard 4x4 OpenGL matrix (which is normally the case) and that this sub matrix contains a mix of rotations about the X, Y and Z axis. How do I extract the individual rotations from this matrix? Any help would be greatly appreciated. Thanks in advance.
[This message has been edited by VuurSnikkel (edited 01-27-2004).]
This link may help you:
You are trying to get the three Euler angles out of a rotation matrix (just to help you understand what this guy is talking about).
heading = atan(m01/m00)
bank = atan(m12/m22)
attitude = asin(-m02)
I’m stuck on a related question that is not directly solved by the above:
I have a 3x1 rotation vector, i.e. a unit vector pointing in the direction that I’m looking. Now I want to convert that vector into three Euler angles so I can display to the user what direction they are facing.
I know this should be really easy (I can do it in 2D using basic trig functions) but I’m confused about exactly how to do it in 3D and can’t seem to find the right Google phrase to search for today.
Anyone know the right formulas?
Just remembered that a lone 3D vector can’t fully describe three Euler angles. Maybe two angles, but that’s it.
That would explain why I can’t find any info on how to do it! I’ll try a matrix method.