Hi,
seems like the matrix.getrotate is broken again. 'osgunittests quat'
also reports lots of problems.
I'm comparing with old working versions, will let you know.
jp
[EMAIL PROTECTED] wrote:
> I've run into a problem using Quaternion rotation with osg::Matrixd that I
> can't seem to figure out. Consider the following test example and resulting
> output:
>
> #define DEG2RAD(d) d*(2*M_PI/360.0)
> #define RAD2DEG(r) r*360.0/2*M_PI
>
> void testQuaternionRotation()
> {
> osg::Matrixd osgTrans;
> osgTrans.set(osg::Matrix::identity());
> osg::Vec3f axis(0.0,0.0,1.0);
> double osgTransAngle,osgQuatAngle;
>
>
> printf("\n*** Doing a 360 deg quaternion rotation about z-axis using
> OSG ***\n");
> for(int i = 0; i < 360; ++i)
> {
> double angle = DEG2RAD(i);
> osg::Quat quat(angle,axis);
> quat.getRotate(osgQuatAngle,axis);
>
> //Set the quat rotation on matrix
> osgTrans.setRotate(quat);
> quat = osgTrans.getRotate();
> quat.getRotate(osgTransAngle,axis);
> printf("Rot: %.1f osgQang: %.1f osgTransAng:
> %.1f\n",RAD2DEG(angle),RAD2DEG(osgQuatAngle),RAD2DEG(osgTransAngle));
> }
> }
>
> Output:
> Rot: 268.0 osgQang: 268.0 osgTransAng: 268.0
> Rot: 269.0 osgQang: 269.0 osgTransAng: 269.0
> Rot: 270.0 osgQang: 270.0 osgTransAng: 90.0
> Rot: 271.0 osgQang: 271.0 osgTransAng: 89.0
>
> Reading back rotation angles in the 4'th quadrant gives me invalid values. I
> would have expected to either get negative angle or the angle that I used to
> rotate about the z-axis. Am I missing a elementary consept here or is this an
> actual bug in the implementation?
> Setting the matrix using a quaternion with angles from the 4'th quaderant
> seems to be working just fine, it's only reading it back that doesn't work.
>
> Thanks for any help on this,
> Filip
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
--
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
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org