Hi Lucie,

What you're looking for is how to convert the quaternion representation of a 
rotation into the Euler angle representation.  Take a look at 
http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles 
for more info and the equations.

Alternatively, you can get the rotation about an arbitrary axis this way:
1) Create a unit vector perpendicular to your axis (e.g. (0,1,0) for rotations 
about the z-axis)
2) Rotate this vector by the quat: rotated = quat * forward_vec * quat.conj()
3) Project the result onto the plane perpendicular to your axis (see 
http://www.euclideanspace.com/maths/geometry/elements/plane/lineOnPlane/index.htm
 for info on projecting vectors onto planes)
4) Normalize the result to unit length.
5) Take the dot product between your initial forward vector and this normalized 
rotated forward vector.
6) Take the inverse cosine to get the angle.

Cheers,
Tom

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=35869#35869





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to