I'm using a rotation matrices to represent the orientation of an object, but I need the 3 Euler angles, represented by this matrix. If I m applying my rotation matrix to the ModelviewMatrix before drawing the object (OpenGL) everything works fine. But if I apply the 3 angles independently in a:
gl.glRotated(yaw, 0.0, 1.0, 0.0); gl.glRotated(pitch, 1.0, 0.0, 0.0); gl.glRotated(roll, 0.0, 0.0, -1.0);
the whole orientation of the object gets messed up!
I extract the 3 angles from my 3x3 matrix the following way:
yaw = Math.atan2(-m[6], m[0]); pitch = Math.atan2(-m[5], m[4]); roll = Math.asin(m[3]);
Does anyone got any idea on this? It seems that some sources are advising not to use this kind of conversion, but I can't understand why. The problem is that once I 'roll' my object 90 degrees to the left, a pitch maneuver will 'yaw' the object etc...
many thanks in advance!











