Hi,
I'm a newbie and not good at math.
Please....
I'm so confused with osg::MatrixTransform::getMatrix().getTrans() and
getRotate().
I use the code below to rotate an object around y axis about 45 degrees.
model1->setMatrix(origin*osg::Matrix::rotate(osg::DegreesToRadians(45.0), 0, 0,
1));
I want to get the rotation of the model, so I used the function to get a
quat:
osg::Quat rotation = model1->getMatrix().getRotate();
I thought the rotation should be like (0.7853982,0,0,1)。but the result
is(0,0,0.382683,0,92388).
I've checked the source code of OSG, and I cann't get any inspriation
from it.
Another case, I thought I should move the object to its center and do
rotate then move it back (according to some book or paper). The code is below.
osg::Vec3 Center = model1->getBound().center();
model1->setMatrix(origin*osg::Matrix::translate(-Center)*osg::Matrix::rotate(osg::DegreesToRadians(45.0),
0, 0, 1)*osg::Matrix::translate(Center));
The object is on the same position and rotation as the first case.
I try to get the rotation, I get more confused..
I thought I didn't change the position of the model, the tranlation I
get
osg::Vec3 translation = model1->getMatrix().getTrans();
should be (0,0,0) but (-168.184,-141.218, 0) and the rotation is just like the
first case.
Could you please help me to figure out why I got those results?
Thank you!
Cheers,
Jiechang
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=70883#70883
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org