Made the following name changes to Matrix and Quat to clean them up and make

the functionality clear given the name.  This will break user code unfortunately
so please be away of the following mapping.

  osg::Matrix::makeTrans(..)?\026 -> osg::Matrix::makeTranslate(..)
  osg::Matrix::makeRot(..)?\026   -> osg::Matrix::makeRotate(..)
  osg::Matrix::trans(..)?\026     -> osg::Matrix::translate(..)

  osg::Quat::makeRot(..)?\026     -> osg::Quat::makeRotate(..)

Also updated the rest of the OSG distribution to use the new names, and
have removed the old deprecated Matrix methods too.
This commit is contained in:
Robert Osfield
2001-12-12 20:29:10 +00:00
parent 79c1fb531d
commit f848c54ba3
21 changed files with 71 additions and 240 deletions

View File

@@ -7,8 +7,6 @@
#include <math.h>
// #define USE_DEGREES_INTERNALLY
#if defined(WIN32) || defined (macintosh)
#include <float.h>
#define M_E 2.7182818284590452354
@@ -70,13 +68,8 @@
namespace osg {
#ifdef USE_DEGREES_INTERNALLY
inline double inDegrees(double angle) { return angle; }
inline double inRadians(double angle) { return angle*180.0/M_PI; }
#else
inline double inDegrees(double angle) { return angle*M_PI/180.0; }
inline double inRadians(double angle) { return angle; }
#endif
inline double inDegrees(double angle) { return angle*M_PI/180.0; }
inline double inRadians(double angle) { return angle; }
inline double DegreesToRadians(double angle) { return angle*M_PI/180.0; }
inline double RadiansToDegrees(double angle) { return angle*180.0/M_PI; }

View File

@@ -17,9 +17,6 @@ using std::ostream;
using std::endl;
#endif
// temporary #define to keep backwards compatibility.
//#define USE_DEPRECATED_MATRIX_METHODS
namespace osg {
class Quat;
@@ -71,17 +68,17 @@ class SG_EXPORT Matrix : public Object
void makeScale( const Vec3& );
void makeScale( float, float, float );
void makeTrans( const Vec3& );
void makeTrans( float, float, float );
void makeTranslate( const Vec3& );
void makeTranslate( float, float, float );
//TODO: original preTrans was optimized (M=Tr*M)
// but also has the assumption that M (this) is an affine transformation Matrix
// can I still do something to optimize the same case now?
void makeRot( const Vec3& from, const Vec3& to );
void makeRot( float angle, const Vec3& axis );
void makeRot( float angle, float x, float y, float z );
void makeRot( const Quat& );
void makeRot( float, float, float ); //Euler angles
void makeRotate( const Vec3& from, const Vec3& to );
void makeRotate( float angle, const Vec3& axis );
void makeRotate( float angle, float x, float y, float z );
void makeRotate( const Quat& );
void makeRotate( float, float, float ); //Euler angles
bool invert( const Matrix& );
bool invertAffine( const Matrix& );
@@ -90,8 +87,8 @@ class SG_EXPORT Matrix : public Object
inline static Matrix identity( void );
inline static Matrix scale( const Vec3& );
inline static Matrix scale( float, float, float );
inline static Matrix trans( const Vec3& );
inline static Matrix trans( float, float, float );
inline static Matrix translate( const Vec3& );
inline static Matrix translate( float, float, float );
inline static Matrix rotate( const Vec3&, const Vec3& );
inline static Matrix rotate( float, float, float, float );
inline static Matrix rotate( float angle, const Vec3& axis);
@@ -108,32 +105,10 @@ class SG_EXPORT Matrix : public Object
void setTrans( const Vec3& v );
Vec3 getTrans() const { ensureRealized(); return Vec3(_mat[3][0],_mat[3][1],_mat[3][2]); }
#ifdef USE_DEPRECATED_MATRIX_METHODS
void copy( const Matrix& );
void preScale( float sx, float sy, float sz, const Matrix& m );
void postScale( const Matrix& m, float sx, float sy, float sz );
void preScale( float sx, float sy, float sz );
void postScale( float sx, float sy, float sz );
void preTrans( float tx, float ty, float tz, const Matrix& m );
void postTrans( const Matrix& m, float tx, float ty, float tz );
void preTrans( float tx, float ty, float tz);
void postTrans( float tx, float ty, float tz );
void preRot( float deg, float x, float y, float z, const Matrix& m );
void postRot( const Matrix& m, float deg, float x, float y, float z );
void preRot( float deg, float x, float y, float z );
void postRot( float deg, float x, float y, float z );
#endif
/** apply apply an 3x3 transform of v*M[0..2,0..2] */
inline static Vec3 transform3x3(const Vec3& v,const Matrix& m);
/** apply apply an 3x3 transform of M[0..2,0..2]*v */
inline static Vec3 transform3x3(const Matrix& m,const Vec3& v);
//end of Deprecated methods
// basic Matrix multiplication, our workhorse methods.
@@ -201,40 +176,40 @@ inline Matrix Matrix::scale(const Vec3& v )
return scale(v.x(), v.y(), v.z() );
}
inline Matrix Matrix::trans(float tx, float ty, float tz)
inline Matrix Matrix::translate(float tx, float ty, float tz)
{
Matrix m;
m.makeTrans(tx,ty,tz);
m.makeTranslate(tx,ty,tz);
return m;
}
inline Matrix Matrix::trans(const Vec3& v )
inline Matrix Matrix::translate(const Vec3& v )
{
return trans(v.x(), v.y(), v.z() );
return translate(v.x(), v.y(), v.z() );
}
inline Matrix Matrix::rotate( const Quat& q )
{
Matrix m;
m.makeRot( q );
m.makeRotate( q );
return m;
}
inline Matrix Matrix::rotate(float angle, float x, float y, float z )
{
Matrix m;
m.makeRot(angle,x,y,z);
m.makeRotate(angle,x,y,z);
return m;
}
inline Matrix Matrix::rotate(float angle, const Vec3& axis )
{
Matrix m;
m.makeRot(angle,axis);
m.makeRotate(angle,axis);
return m;
}
inline Matrix Matrix::rotate(const Vec3& from, const Vec3& to )
{
Matrix m;
m.makeRot(from,to);
m.makeRotate(from,to);
return m;
}

View File

@@ -199,16 +199,16 @@ class SG_EXPORT Quat
Not inlined - see the Quat.cpp file for implementation
-------------------------------------------------------- */
void makeRot ( const float angle,
void makeRotate ( const float angle,
const float x, const float y, const float z );
void makeRot ( const float angle, const Vec3& vec );
void makeRotate ( const float angle, const Vec3& vec );
/** Make a rotation Quat which will rotate vec1 to vec2.
Generally take adot product to get the angle between these
and then use a cross product to get the rotation axis
Watch out for the two special cases of when the vectors
are co-incident or opposite in direction.*/
void makeRot( const Vec3& vec1, const Vec3& vec2 );
void makeRotate( const Vec3& vec1, const Vec3& vec2 );
/** Return the angle and vector components represented by the quaternion.*/
void getRot ( float& angle, float& x, float& y, float& z ) const;

View File

@@ -63,12 +63,6 @@ class SG_EXPORT Transform : public Group
(*_matrix) = (*_matrix) * mat;
dirtyBound();
}
#ifdef USE_DEPRECATED_MATRIX_METHODS
void preScale( const float sx, const float sy, const float sz );
void preTranslate( const float tx, const float ty, const float tz );
void preRotate( const float deg, const float x, const float y, const float z );
#endif
protected :