Added Matrix*::getRotate()/setRotate(Quat), deprecating Matrix*::get(Quat&), Matrix*::set(Quat&)

This commit is contained in:
Robert Osfield
2006-07-31 17:31:21 +00:00
parent 28cf404a25
commit 564ee34f76
20 changed files with 99 additions and 80 deletions

View File

@@ -184,7 +184,7 @@ void GliderManipulator::addMouseEvent(const GUIEventAdapter& ea)
void GliderManipulator::setByMatrix(const osg::Matrixd& matrix)
{
_eye = matrix.getTrans();
matrix.get(_rotation);
_rotation = matrix.getRotate();
_distance = 1.0f;
}
@@ -214,8 +214,7 @@ void GliderManipulator::computePosition(const osg::Vec3& eye,const osg::Vec3& lv
_eye = eye;
_distance = lv.length();
rotation_matrix.get(_rotation);
_rotation = _rotation.inverse();
_rotation = rotation_matrix.getRotate().inverse();
}

View File

@@ -182,7 +182,7 @@ void TestManipulator::addMouseEvent(const GUIEventAdapter& ea)
void TestManipulator::setByMatrix(const osg::Matrixd& matrix)
{
_center = matrix.getTrans();
matrix.get(_rotation);
_rotation = matrix.getRotate();
_distance = 1.0f;
}
@@ -212,8 +212,7 @@ void TestManipulator::computePosition(const osg::Vec3& eye,const osg::Vec3& lv,c
_center = eye+lv;
_distance = lv.length();
rotation_matrix.get(_rotation);
_rotation = _rotation.inverse();
_rotation = rotation_matrix.getRotate().inverse();
}

View File

@@ -180,8 +180,7 @@ class TexMatCullCallback : public osg::NodeCallback
osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
if (cv)
{
osg::Quat quat;
cv->getModelViewMatrix().get(quat);
osg::Quat quat = cv->getModelViewMatrix().getRotate();
_texmat->setMatrix(osg::Matrix::rotate(quat.inverse()));
}
}

View File

@@ -222,14 +222,14 @@ void testGetQuatFromMatrix() {
// create two matrices based on the input quats
osg::Matrixd mat1,mat2;
mat1.set(rot_quat1);
mat2.set(rot_quat2);
mat1.makeRotate(rot_quat1);
mat2.makeRotate(rot_quat2);
// create an output quat by matrix multiplication and get
osg::Matrixd out_mat;
out_mat = mat2 * mat1;
osg::Quat out_quat2;
out_mat.get(out_quat2);
out_quat2 = out_mat.getRotate();
// if the output quat length is not one
// or if the component magnitudes do not match,

View File

@@ -183,8 +183,7 @@ public:
const osg::Matrix R = osg::Matrix::rotate( osg::DegreesToRadians(112.0f), 0.0f,0.0f,1.0f)*
osg::Matrix::rotate( osg::DegreesToRadians(90.0f), 1.0f,0.0f,0.0f);
osg::Quat q;
MV.get(q);
osg::Quat q = MV.getRotate();
const osg::Matrix C = osg::Matrix::rotate( q.inverse() );
_texMat.setMatrix( C*R );