# rotation matrix and glRotate()

hi all,
thanx for the prompt responses i received last time.
this time new problem.
given a 3d rotation matrix how do you find out what parameters were given
ex:
if i had the 3d rotation matrix
-0.001 1.00 -0.027
0.964 0.265 -0.036
-0.029 -0.026 -0.964
what was the value of :theta,x,y,z
in GlRotate i.e.
glRotatef(theta,x,y,z);
if the q is not clear to you,tell me and i shall give more explanation on it.

Originally posted by Shweta:
hi all,
thanx for the prompt responses i received last time.
this time new problem.
given a 3d rotation matrix how do you find out what parameters were given
ex:
if i had the 3d rotation matrix
-0.001 1.00 -0.027
0.964 0.265 -0.036
-0.029 -0.026 -0.964
what was the value of :theta,x,y,z
in GlRotate i.e.
glRotatef(theta,x,y,z);
if the q is not clear to you,tell me and i shall give more explanation on it.

I think you would have to use the inverse of the rotation matrices. Perhaps why donâ€™t you try it out on paper first using the rotation matrices that can be found in any grafix book. Use the quarternion matrix cos i think the glRotatef uses it.
Thanx
MMM

lookup matrix decomposition, which is not that trivial to do, especially if your matrix has non uniform scaling and so on.

http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm

that site has a bunch of maths info btw