Hi :
I tried what paul's suggestion but I do not get the correct
result.Following are some tests what I do:
//rotate 30 degrees around x axis,45 degrees around y axis,60 degrees around
z axis
osg::Quat quat(0.52359876f,osg::Vec3f(1.0f,0.0f,0.0f),
0.785398f,osg::Vec3f(0.0f,1.0f,0.0f),
1.0471975f,osg::Vec3f(0.0f,0.0f,1.0f));
osg::Matrix matrix;
matrix.makeRotate(quat);
osg::Vec3f eye,center,up;
matrix.getLookAt(eye,center,up);
osg::Vec3f forward = center - eye;
double len = forward.length();
double x = forward._v[0]/len;//0.7071066
double y = forward._v[1]/len;//-0.35355
double z = forward._v[2]/len;//-0.6123725
osg::ref_ptr<osg::MatrixTransform> rotate = new osg::MatrixTransform;
rotate->setMatrix(osg::Matrix::rotate(0.52359876f,osg::Vec3(1.0f,0.0f,0.0f),0.785398f,osg::Vec3(0.0f,1.0f,0.0f),1.0471975f,osg::Vec3(0.0f,0.0f,1.0f))*
osg::Matrix::translate(0.0f,0.0f,0.0f));
osg::Matrix mt = rotate->getMatrix();
mt.getLookAt(eye,center,up);
forward = center - eye;
len = forward.length();
x = forward._v[0]/len;//0.7071066
y = forward._v[1]/len;//-0.35355
z = forward._v[2]/len;//-0.6123725
Ater I get the cosine value of each axis, the I try to get arcos value and
find it is not the initial value what I setted.I do not konw what is wrong.
ms yang
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org