Hi,
Steven Saunderson wrote:
----- From: John Vidar Larring at 2008-10-30 21:42-----
Hi Steven,
Here is a snipplet of code from the osgautocapture example that I just
sent to osg-submissions (if my email got through?), provided as is. I
hope it might be of help:
Hi John,
Thanks for the code. I tried it (and it also rekindled my interest in
ViewMatrixLookAt) but I still got gimbal-lock. Perhaps my
implementation of your code is faulty.
I've spent days now trying to learn enough about quaternions. This
almost works but my calculation for the rotation angle is still wrong.
Is there a function in OSG for calculating a quaternion from euler
angles ? I've searched but haven't found anything.
You can make a quat from three angles and three axes:
osg::Quat lori = osg::Quat(osg::DegreesToRadians(heading),
osg::Vec3d(0,0,1),
osg::DegreesToRadians(pitch),
osg::Vec3d(0,1,0),
osg::DegreesToRadians(roll),
osg::Vec3d(1,0,0));
Make sure the order is what you need.
The standard code to calculate a quaternion uses w = cosx * cosy * cosz
+ sinx * siny * sinz. This doesn't seem right to me and it doesn't work
in my testing. I would expect the final rotation to be between the
largest input rotation and PI.
I hope this post is sufficiently on-topic for the osg-users list. I
apologise if I should be looking elsewhere.
Thanks,
Steven
jp
--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard.
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean. MailScanner thanks Transtec Computers for their support.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org