I do a number of translations and rotations to set the view for my scene. Think of a camera on the end of a multi-jointed robotic arm. I translate and rotate through each segment until I have my camera set. This all works fine but for some other things I'm doing, I need to know the resulting angle of the camera in world coordinates in relation to the x and z axis.
I have managed to do this by getting a copy of the matrix with glGetFloatv(GL_MODELVIEW_MATRIX,&mv) and then copying the points (0,0,0) and (0,1,0) and using their translated locations to determine the angle. This works but due to the math, only returns an angle from 0 to 90 for any orientation. To go back and adjust this for the particular x, y, and z directions is becoming quite cumbersome.
I was wondering if there's an easier way to take the modelview matrix and extract the angles.
Any thoughts would be greatly appreciated.