Added DOFTransform, MatrixTransform and PositionAttitudeTransform to NodeVisitor.

Added osg::Matrix/Quat::makeRotate(angle1,axis1,angle2,axis2,angle3,axis3) and
osg::Matrix::rotate(angle1,axis1,angle2,axis2,angle3,axis3) method.

Made osg::Matrix/Quat::makeRotate(heading,pitch,roll) and
osg::Matrix::rotate(heading,pitch,roll) all deprecated API.

Fixed the Quat*Quat & Quat*=Quat multiplication methods so that they multiplied
in the correct order - they were reversed originally due to the Quat code being
based on code example which used the v' = M v ordering, rather than the OSG's
v' = v M ordering.
This commit is contained in:
Robert Osfield
2002-08-18 14:42:43 +00:00
parent a9732aa046
commit 22d54f05e4
6 changed files with 121 additions and 39 deletions

View File

@@ -136,12 +136,25 @@ void Matrix::makeRotate( const Quat& q )
q.get(*this);
}
#ifdef USE_DEPRECATED_API
void Matrix::makeRotate( float heading, float pitch, float roll)
{
Quat quat;
quat.makeRotate(heading,pitch,roll);
quat.get(*this);
}
#endif
void Matrix::makeRotate( float angle1, const Vec3& axis1,
float angle2, const Vec3& axis2,
float angle3, const Vec3& axis3)
{
Quat quat;
quat.makeRotate(angle1, axis1,
angle2, axis2,
angle3, axis3);
quat.get(*this);
}
void Matrix::mult( const Matrix& lhs, const Matrix& rhs )
{

View File

@@ -36,6 +36,7 @@ void Quat::makeRotate( const float angle, const Vec3& vec )
makeRotate( angle, vec[0], vec[1], vec[2] );
}
#ifdef USE_DEPRECATED_API
// assume Z up, Y north, X east and euler convention
// as per Open Flight & Performer.
@@ -48,13 +49,20 @@ void Quat::makeRotate( float heading, float pitch, float roll)
Quat q_pitch; q_pitch.makeRotate(pitch,1.0,0.0,0.0);
Quat q_heading; q_heading.makeRotate(-heading,0.0,0.0,1.0);
// note reverse order than would be done using matrices
// which raises the interesting question whether the definition
// of Quat*Quat should be changed to fit with the v' = v x M
// convention of Matrix. Will investigate further later on.
// Robert Osfield. April 2002.
*this = q_heading*q_pitch*q_roll;
*this = q_roll*q_pitch*q_heading;
}
#endif
void Quat::makeRotate ( float angle1, const Vec3& axis1,
float angle2, const Vec3& axis2,
float angle3, const Vec3& axis3)
{
Quat q1; q1.makeRotate(angle1,axis1);
Quat q2; q2.makeRotate(angle2,axis2);
Quat q3; q3.makeRotate(angle3,axis3);
*this = q1*q2*q3;
}
// Make a rotation Quat which will rotate vec1 to vec2
// Generally take adot product to get the angle between these