osg::TransformationMatrix< ValueTypeT > Class Template Reference

#include <OSGMatrix.h>

List of all members.


Internal Math

ValueTypeT rowMulCol4 (const TransformationMatrix &gRowMat, UInt32 iRow, const TransformationMatrix &gColMat, UInt32 iColumn) const
ValueTypeT det2 (const ValueTypeT a1, const ValueTypeT a2, const ValueTypeT b1, const ValueTypeT b2) const
ValueTypeT det3 (const ValueTypeT a1, const ValueTypeT a2, const ValueTypeT a3, const ValueTypeT b1, const ValueTypeT b2, const ValueTypeT b3, const ValueTypeT c1, const ValueTypeT c2, const ValueTypeT c3) const
bool jacobi (ValueTypeT evalues[JacobiRank], VectorType3f evectors[JacobiRank], Int32 &rots)
static const UInt32 JacobiRank = 3

Public Types

Types
typedef ValueTypeT ValueType
 Value type, eg Real32.
typedef VectorInterface< ValueTypeT,
VecStorage4< ValueTypeT > > 
VectorType
 Matrix vector type, eg Vec4f.
typedef QuaternionBase< ValueTypeQuaternionType
 Matrix quaternion type.
typedef VectorInterface< ValueTypeT,
VecStorage3< ValueTypeT > > 
VectorType3f
 Matrix vec3f type.
typedef PointInterface< ValueTypeT,
VecStorage3< ValueTypeT > > 
PointType3f
 Matrix pnt3f type.

Public Member Functions

Constructors
 TransformationMatrix (void)
 TransformationMatrix (const TransformationMatrix &source)
 TransformationMatrix (const VectorType3f &vector1, const VectorType3f &vector2, const VectorType3f &vector3)
 TransformationMatrix (const VectorType3f &vector1, const VectorType3f &vector2, const VectorType3f &vector3, const VectorType3f &vector4)
 TransformationMatrix (const ValueTypeT rVal00, const ValueTypeT rVal10, const ValueTypeT rVal20, const ValueTypeT rVal30, const ValueTypeT rVal01, const ValueTypeT rVal11, const ValueTypeT rVal21, const ValueTypeT rVal31, const ValueTypeT rVal02, const ValueTypeT rVal12, const ValueTypeT rVal22, const ValueTypeT rVal32, const ValueTypeT rVal03, const ValueTypeT rVal13, const ValueTypeT rVal23, const ValueTypeT rVal33)
Destructor
 ~TransformationMatrix (void)
Set
void setIdentity (void)
void setValue (const TransformationMatrix &mat)
void setValue (const VectorType3f &vector1, const VectorType3f &vector2, const VectorType3f &vector3)
void setValue (const VectorType3f &vector1, const VectorType3f &vector2, const VectorType3f &vector3, const VectorType3f &vector4)
void setValue (const ValueTypeT rVal00, const ValueTypeT rVal10, const ValueTypeT rVal20, const ValueTypeT rVal30, const ValueTypeT rVal01, const ValueTypeT rVal11, const ValueTypeT rVal21, const ValueTypeT rVal31, const ValueTypeT rVal02, const ValueTypeT rVal12, const ValueTypeT rVal22, const ValueTypeT rVal32, const ValueTypeT rVal03, const ValueTypeT rVal13, const ValueTypeT rVal23, const ValueTypeT rVal33)
void setValueTransposed (const ValueTypeT rVal00, const ValueTypeT rVal01, const ValueTypeT rVal02, const ValueTypeT rVal03, const ValueTypeT rVal10, const ValueTypeT rVal11, const ValueTypeT rVal12, const ValueTypeT rVal13, const ValueTypeT rVal20, const ValueTypeT rVal21, const ValueTypeT rVal22, const ValueTypeT rVal23, const ValueTypeT rVal30, const ValueTypeT rVal31, const ValueTypeT rVal32, const ValueTypeT rVal33)
void setValue (const ValueTypeT *pMat, bool bTransposed=true)
 Set value from an ValueTypeT array, be shure the sizes match.
void setValue (const VectorType *pMat)
 Set value from an VectorTypeT array, be shure the sizes match.
void setValue (const VectorType3f *pMat)
 Set value from an VectorType3f array, be shure the sizes match.
void setValue (const Char8 *string, bool bTransposed=true)
 Set matrix by a given str (like "1.0 0.0 0.0 0.0 ... (16 entries at all)"), be shure the size matches.
Get
ValueTypeT * getValues (void)
 Returns an C++ pointer to the value store.
const ValueTypeT * getValues (void) const
Set Transformations
void setScale (const ValueTypeT s)
 Sets matrix to scale by given uniform factor.
void setScale (const ValueTypeT sx, const ValueTypeT sy, const ValueTypeT sz)
 Sets matrix to scale by given uniform factor.
void setScale (const VectorType3f &s)
 Sets matrix to scale by given vector.
void setTranslate (const ValueTypeT tx, const ValueTypeT ty, const ValueTypeT tz)
 Sets matrix to translate by given values.
void setTranslate (const VectorType3f &t)
 Sets matrix to translate by given vector.
void setTranslate (const PointType3f &t)
 Sets matrix to translate by given point.
void setRotate (const QuaternionType &q)
 Sets matrix to rotate by given rotation.
void setTransform (const VectorType3f &t)
 Composes the matrix based on a translation.
void setTransform (const QuaternionType &r)
 Composes the matrix based on a rotation.
void setTransform (const VectorType3f &t, const QuaternionType &r)
 Composes the matrix based on a translation and rotation.
void setTransform (const VectorType3f &t, const QuaternionType &r, const VectorType3f &s)
 Composes the matrix based on a translation, rotation and scale.
void setTransform (const VectorType3f &t, const QuaternionType &r, const VectorType3f &s, const QuaternionType &so)
 Composes the matrix based on a translation, rotation, scale and orientation.
void setTransform (const VectorType3f &translation, const QuaternionType &rotation, const VectorType3f &scaleFactor, const QuaternionType &scaleOrientation, const VectorType3f &center)
Get Transformations
void getTransform (VectorType3f &translation, QuaternionType &rotation, VectorType3f &scaleFactor, QuaternionType &scaleOrientation, const VectorType3f &center) const
 Decomposes the matrix into a translation, rotation, scale, and scale orientation. Any projection information is discarded. The decomposition depends upon choice of center point for rotation and scaling, which is optional as the last parameter. Note that if the center is 0, decompose() is the same as factor() where "t" is translation, "u" is rotation, "s" is scaleFactor, and "r" is ScaleOrientattion.
void getTransform (VectorType3f &translation, QuaternionType &rotation, VectorType3f &scaleFactor, QuaternionType &scaleOrientation) const
 Decomposes the matrix into a translation, rotation and scale.
bool factor (TransformationMatrix &r, VectorType3f &s, TransformationMatrix &u, VectorType3f &t, TransformationMatrix &proj) const
 Factors a matrix m into 5 pieces: m = r s rt u t, where rt means transpose of r, and r and u are rotations, s is a scale, and t is a translation. Any projection information is returned in proj.
Transform
void multMatrixPnt (const PointType3f &src, PointType3f &dst) const
 Multiplies matrix by given column point, where the resulting point is given.
void multMatrixPnt (PointType3f &pnt) const
 Multiplies matrix by given column point.
void multFullMatrixPnt (const PointType3f &src, PointType3f &dst) const
 Multiplies matrix by given column point, where the resulting point is given. The full (4x4) matrix is used.
void multFullMatrixPnt (PointType3f &pnt) const
 Multiplies matrix by given column point. The full (4x4) matrix is used.
void multMatrixVec (const VectorType3f &src, VectorType3f &dst) const
 Multiplies matrix by given column vector, where the resulting vector is given.
void multMatrixVec (VectorType3f &vec) const
 Multiplies matrix by given column vector.
void mult (const PointType3f &src, PointType3f &dst) const
 Transforms the given point by the matrix and stores the result in dest.
void mult (PointType3f &vec) const
 Transforms the given point by the matrix.
void mult (const VectorType3f &src, VectorType3f &dst) const
 Transforms the given vector by the matrix and stores the result in dest.
void mult (VectorType3f &vec) const
 Transforms the given vector by the matrix.
void multPntMatrix (const PointType3f &src, PointType3f &dst) const
 Multiplies given row point by matrix, where the resulting point is given (pT * M).
void multPntMatrix (PointType3f &pnt) const
 Multiplies given row point by matrix (pT * M).
void multPntFullMatrix (const PointType3f &src, PointType3f &dst) const
 Multiplies given row point by matrix, where the resulting point is given. The full (4x4) matrix is used (pT * M).
void multPntFullMatrix (PointType3f &pnt) const
 Multiplies given row point by matrix. The full (4x4) matrix is used (pT*M).
void multVecMatrix (const VectorType3f &src, VectorType3f &dst) const
 Multiplies given row vector by matrix, where the resulting vector is given (vT * M).
void multVecMatrix (VectorType3f &vec) const
 Multiplies given row vector by matrix.
void multMatrixVec (const VectorType &src, VectorType &dst) const
 Multiplies matrix by given column vector, where the resulting vector is given.
void multMatrixVec (VectorType &vec) const
 Multiplies matrix by given column vector.
Math
bool equals (const TransformationMatrix &matrix, const ValueType tol) const
 Returns true iff all matrix elements are equal within the given tolerance.
ValueTypeT det3 (void) const
 Returns the determinat of the upper 3x3 submatrix.
ValueTypeT det (void) const
 Returns the determinat of the whole 4x4 matrix.
bool inverse (TransformationMatrix &result) const
 Stores the inverse of the matrix into result, returns true if the matrix is not singular.
bool invert (void)
 Inverts the matrix, returns true if the matrix is not singular.
bool invertFrom (const TransformationMatrix &matrix)
 Set the matrix to be the inverse of the given one, returns true if the matrix is not singular.
bool inverse3 (TransformationMatrix &result) const
bool invert3 (void)
bool invertFrom3 (const TransformationMatrix &matrix)
bool transposed (TransformationMatrix &result) const
bool transpose (void)
bool transposeFrom (const TransformationMatrix &matrix)
void mult (const TransformationMatrix &matrix)
void multLeft (const TransformationMatrix &matrix)
void add (const TransformationMatrix &matrix)
 Adds the given matrix to this matrix.
void scale (ValueTypeT s)
 Scales the elements of this matrix.
void addScaled (const TransformationMatrix &matrix, ValueTypeT s)
 Adds a scaled version of the given matrix to this matrix.
void negate (void)
 Negates the matrix in place.
ValueTypeT norm1 (void) const
 Returns the 1-norm of _matrix matrix.
ValueTypeT norm2 (void) const
 Returns the 2-norm of this matrix.
ValueTypeT normInfinity (void) const
 Returns the infinity norm of this matrix.
bool sqrt (TransformationMatrix &result) const
 Computes the square root of the matrix and stores it in result, assumes det > 0.
bool sqrtOf (const TransformationMatrix &matrix)
 Sets this matrix to the square root of the given matrix, assumes det > 0.
bool sqrt (void)
 Sets this matrix to its square root, assumes det > 0.
bool log (TransformationMatrix &result) const
 Computes the logarithm of this matrix and stores it in result, assumes det > 0.
bool logOf (const TransformationMatrix &matrix)
 Sets this matrix to the logarithm of the given matrix, assumes det > 0.
bool exp (TransformationMatrix &result) const
 Computes the exponential of this matrix and stores it in result.
bool expOf (const TransformationMatrix &matrix)
 Sets this matrix to the exponential of the given matrix.
Element Access
VectorTypeoperator[] (UInt32 uiIndex)
const VectorTypeoperator[] (UInt32 uiIndex) const
Assignment
TransformationMatrixoperator= (const TransformationMatrix &source)
Comparison
bool operator== (const TransformationMatrix &other) const
 equal, returns true if all matrix elements are equal with the tolerance of Eps
bool operator!= (const TransformationMatrix &other) const
 not equal, returns true if all matrix elements are not equal with the tolerance of Eps

Static Public Member Functions

Class Get
static const TransformationMatrixidentity (void)

Protected Attributes

Storage
VectorType _matrix [4]
 Value store.

Static Private Attributes

static TransformationMatrix _identityMatrix

Detailed Description

template<class ValueTypeT>
class osg::TransformationMatrix< ValueTypeT >

TransformationMatrix, for details about the vector, point and matrix desing see PageBaseMath, nevertheless the following applies : M=(V0 V1 V2 V3), M[Column][Row], M[0] = V0 M[0][0] = V0[0] M.getValues() returns M transposed (as it returns the raw storage)

Definition at line 72 of file OSGMatrix.h.


Member Typedef Documentation

template<class ValueTypeT>
PointInterface< ValueTypeT, VecStorage3< ValueTypeT > > osg::TransformationMatrix< ValueTypeT >::PointType3f
 

Matrix pnt3f type.

Definition at line 92 of file OSGMatrix.h.

template<class ValueTypeT>
QuaternionBase< ValueType > osg::TransformationMatrix< ValueTypeT >::QuaternionType
 

Matrix quaternion type.

Definition at line 86 of file OSGMatrix.h.

template<class ValueTypeT>
osg::TransformationMatrix< ValueTypeT >::ValueType
 

Value type, eg Real32.

Definition at line 82 of file OSGMatrix.h.

template<class ValueTypeT>
VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > > osg::TransformationMatrix< ValueTypeT >::VectorType
 

Matrix vector type, eg Vec4f.

Definition at line 84 of file OSGMatrix.h.

template<class ValueTypeT>
VectorInterface< ValueTypeT, VecStorage3< ValueTypeT > > osg::TransformationMatrix< ValueTypeT >::VectorType3f
 

Matrix vec3f type.

Definition at line 89 of file OSGMatrix.h.


Constructor & Destructor Documentation

template<class ValueTypeT>
osg::TransformationMatrix< ValueTypeT >::TransformationMatrix void   )  [inline]
 

Definition at line 91 of file OSGMatrix.inl.

References osg::TransformationMatrix< ValueTypeT >::_matrix.

00092 {
00093     for(UInt32 i = 0; i < 4; i++)
00094     {
00095         _matrix[i][i] = TypeTraits<ValueType>::getOneElement();
00096     }
00097 }

template<class ValueTypeT>
osg::TransformationMatrix< ValueTypeT >::TransformationMatrix const TransformationMatrix< ValueTypeT > &  source  )  [inline]
 

Definition at line 100 of file OSGMatrix.inl.

References osg::TransformationMatrix< ValueTypeT >::_matrix.

00102 {
00103     for(UInt32 i = 0; i < 4; i++)
00104     {
00105         _matrix[i] = source._matrix[i];
00106     }
00107 }

template<class ValueTypeT>
osg::TransformationMatrix< ValueTypeT >::TransformationMatrix const VectorType3f vector1,
const VectorType3f vector2,
const VectorType3f vector3
[inline]
 

Definition at line 110 of file OSGMatrix.inl.

References osg::TransformationMatrix< ValueTypeT >::_matrix, and osg::PointInterface< ValueTypeT, StorageInterfaceT >::setValue().

00114 {
00115     _matrix[0].setValue(vector1);
00116     _matrix[1].setValue(vector2);
00117     _matrix[2].setValue(vector3);
00118 }

template<class ValueTypeT>
osg::TransformationMatrix< ValueTypeT >::TransformationMatrix const VectorType3f vector1,
const VectorType3f vector2,
const VectorType3f vector3,
const VectorType3f vector4
[inline]
 

Definition at line 121 of file OSGMatrix.inl.

References osg::TransformationMatrix< ValueTypeT >::_matrix, and osg::PointInterface< ValueTypeT, StorageInterfaceT >::setValue().

00126 {
00127     _matrix[0].setValue(vector1);
00128     _matrix[1].setValue(vector2);
00129     _matrix[2].setValue(vector3);
00130     _matrix[3].setValue(vector4);
00131 }

template<class ValueTypeT>
osg::TransformationMatrix< ValueTypeT >::TransformationMatrix const ValueTypeT  rVal00,
const ValueTypeT  rVal10,
const ValueTypeT  rVal20,
const ValueTypeT  rVal30,
const ValueTypeT  rVal01,
const ValueTypeT  rVal11,
const ValueTypeT  rVal21,
const ValueTypeT  rVal31,
const ValueTypeT  rVal02,
const ValueTypeT  rVal12,
const ValueTypeT  rVal22,
const ValueTypeT  rVal32,
const ValueTypeT  rVal03,
const ValueTypeT  rVal13,
const ValueTypeT  rVal23,
const ValueTypeT  rVal33
[inline]
 

Definition at line 134 of file OSGMatrix.inl.

References osg::TransformationMatrix< ValueTypeT >::_matrix, and osg::VecStorage4< ValueTypeT >::setValues().

00154 {
00155     _matrix[0].setValues(rVal00, rVal01, rVal02, rVal03);
00156     _matrix[1].setValues(rVal10, rVal11, rVal12, rVal13);
00157     _matrix[2].setValues(rVal20, rVal21, rVal22, rVal23);
00158     _matrix[3].setValues(rVal30, rVal31, rVal32, rVal33);
00159 }

template<class ValueTypeT>
osg::TransformationMatrix< ValueTypeT >::~TransformationMatrix void   )  [inline]
 

Definition at line 165 of file OSGMatrix.inl.

00166 {
00167 }


Member Function Documentation

template<class ValueTypeT>
void osg::TransformationMatrix< ValueTypeT >::add const TransformationMatrix< ValueTypeT > &  matrix  )  [inline]
 

Adds the given matrix to this matrix.

Definition at line 2089 of file OSGMatrix.inl.

References osg::TransformationMatrix< ValueTypeT >::_matrix.

02090 {
02091     _matrix[0][0] += matrix._matrix[0][0];
02092     _matrix[0][1] += matrix._matrix[0][1];
02093     _matrix[0][2] += matrix._matrix[0][2];
02094     _matrix[0][3] += matrix._matrix[0][3];
02095 
02096     _matrix[1][0] += matrix._matrix[1][0];
02097     _matrix[1][1] += matrix._matrix[1][1];
02098     _matrix[1][2] += matrix._matrix[1][2];
02099     _matrix[1][3] += matrix._matrix[1][3];
02100 
02101     _matrix[2][0] += matrix._matrix[2][0];
02102     _matrix[2][1] += matrix._matrix[2][1];
02103     _matrix[2][2] += matrix._matrix[2][2];
02104     _matrix[2][3] += matrix._matrix[2][3];
02105 
02106     _matrix[3][0] += matrix._matrix[3][0];
02107     _matrix[3][1] += matrix._matrix[3][1];
02108     _matrix[3][2] += matrix._matrix[3][2];
02109     _matrix[3][3] += matrix._matrix[3][3];
02110 }

template<class ValueTypeT>
void osg::TransformationMatrix< ValueTypeT >::addScaled const TransformationMatrix< ValueTypeT > &  matrix,
ValueTypeT  s
[inline]
 

Adds a scaled version of the given matrix to this matrix.

Definition at line 2141 of file OSGMatrix.inl.

References osg::TransformationMatrix< ValueTypeT >::_matrix.

Referenced by osg::TransformationMatrix< ValueTypeT >::exp(), osg::TransformationMatrix< ValueTypeT >::expOf(), osg::TransformationMatrix< ValueTypeT >::log(), osg::TransformationMatrix< ValueTypeT >::logOf(), osg::TransformationMatrix< ValueTypeT >::sqrt(), and osg::TransformationMatrix< ValueTypeT >::sqrtOf().

02144 {
02145     _matrix[0][0] += s*matrix._matrix[0][0];
02146     _matrix[0][1] += s*matrix._matrix[0][1];
02147     _matrix[0][2] += s*matrix._matrix[0][2];
02148     _matrix[0][3] += s*matrix._matrix[0][3];
02149 
02150     _matrix[1][0] += s*matrix._matrix[1][0];
02151     _matrix[1][1] += s*matrix._matrix[1][1];
02152     _matrix[1][2] += s*matrix._matrix[1][2];
02153     _matrix[1][3] += s*matrix._matrix[1][3];
02154 
02155     _matrix[2][0] += s*matrix._matrix[2][0];
02156     _matrix[2][1] += s*matrix._matrix[2][1];
02157     _matrix[2][2] += s*matrix._matrix[2][2];
02158     _matrix[2][3] += s*matrix._matrix[2][3];
02159 
02160     _matrix[3][0] += s*matrix._matrix[3][0];
02161     _matrix[3][1] += s*matrix._matrix[3][1];
02162     _matrix[3][2] += s*matrix._matrix[3][2];
02163     _matrix[3][3] += s*matrix._matrix[3][3];
02164 }

template<class ValueTypeT>
ValueTypeT osg::TransformationMatrix< ValueTypeT >::det void   )  const [inline]
 

Returns the determinat of the whole 4x4 matrix.

Definition at line 1443 of file OSGMatrix.inl.

References osg::TransformationMatrix< ValueTypeT >::_matrix, and osg::TransformationMatrix< ValueTypeT >::det3().

Referenced by osg::TransformationMatrix< ValueTypeT >::factor(), osg::TransformationMatrix< ValueTypeT >::inverse(), osg::TransformationMatrix< ValueTypeT >::invert(), osg::TransformationMatrix< ValueTypeT >::invertFrom(), osg::TransformationMatrix< ValueTypeT >::sqrt(), and osg::TransformationMatrix< ValueTypeT >::sqrtOf().

01444 {
01445     ValueTypeT
01446         a1, a2, a3, a4,
01447         b1, b2, b3, b4,
01448         c1, c2, c3, c4,
01449         d1, d2, d3, d4;
01450 
01451     a1 = _matrix[0][0];
01452     b1 = _matrix[1][0];
01453     c1 = _matrix[2][0];
01454     d1 = _matrix[3][0];
01455 
01456     a2 = _matrix[0][1];
01457     b2 = _matrix[1][1];
01458     c2 = _matrix[2][1];
01459     d2 = _matrix[3][1];
01460 
01461     a3 = _matrix[0][2];
01462     b3 = _matrix[1][2];
01463     c3 = _matrix[2][2];
01464     d3 = _matrix[3][2];
01465 
01466     a4 = _matrix[0][3];
01467     b4 = _matrix[1][3];
01468     c4 = _matrix[2][3];
01469     d4 = _matrix[3][3];
01470 
01471     return(   a1 * det3(b2, b3, b4, c2, c3, c4, d2, d3, d4)
01472             - b1 * det3(a2, a3, a4, c2, c3, c4, d2, d3, d4)
01473             + c1 * det3(a2, a3, a4, b2, b3, b4, d2, d3, d4)
01474             - d1 * det3(a2, a3, a4, b2, b3, b4, c2, c3, c4));
01475 
01476 }

template<class ValueTypeT>
ValueTypeT osg::TransformationMatrix< ValueTypeT >::det2 const ValueTypeT  a1,
const ValueTypeT  a2,
const ValueTypeT  b1,
const ValueTypeT  b2
const [inline, protected]
 

Definition at line 438 of file OSGMatrix.inl.

Referenced by osg::TransformationMatrix< ValueTypeT >::inverse3(), osg::TransformationMatrix< ValueTypeT >::invert3(), and osg::TransformationMatrix< ValueTypeT >::invertFrom3().

00441 {
00442     return (a1 * b2) - (a2 * b1);
00443 }

template<class ValueTypeT>
ValueTypeT osg::TransformationMatrix< ValueTypeT >::det3 const ValueTypeT  a1,
const ValueTypeT  a2,
const ValueTypeT  a3,
const ValueTypeT  b1,
const ValueTypeT  b2,
const ValueTypeT  b3,
const ValueTypeT  c1,
const ValueTypeT  c2,
const ValueTypeT  c3
const [inline, protected]
 

Definition at line 446 of file OSGMatrix.inl.

00456 {
00457     return
00458         (a1 * b2 * c3) + (a2 * b3 * c1) + (a3 * b1 * c2) -
00459         (a1 * b3 * c2) - (a2 * b1 * c3) - (a3 * b2 * c1);
00460 }

template<class ValueTypeT>
ValueTypeT osg::TransformationMatrix< ValueTypeT >::det3 void   )  const [inline]
 

Returns the determinat of the upper 3x3 submatrix.

Definition at line 1430 of file OSGMatrix.inl.

References osg::TransformationMatrix< ValueTypeT >::_matrix.

Referenced by osg::TransformationMatrix< ValueTypeT >::det(), osg::TransformationMatrix< ValueTypeT >::inverse(), osg::TransformationMatrix< ValueTypeT >::inverse3(), osg::TransformationMatrix< ValueTypeT >::invert(), osg::TransformationMatrix< ValueTypeT >::invert3(), osg::TransformationMatrix< ValueTypeT >::invertFrom(), and osg::TransformationMatrix< ValueTypeT >::invertFrom3().

01431 {
01432     return (_matrix[0][0] * _matrix[1][1] * _matrix[2][2] +
01433             _matrix[0][1] * _matrix[1][2] * _matrix[2][0] +
01434             _matrix[0][2] * _matrix[1][0] * _matrix[2][1] -
01435             _matrix[0][2] * _matrix[1][1] * _matrix[2][0] -
01436             _matrix[0][1] * _matrix[1][0] * _matrix[2][2] -
01437             _matrix[0][0] * _matrix[1][2] * _matrix[2][1]);
01438 }

template<class ValueTypeT>
bool osg::TransformationMatrix< ValueTypeT >::equals const TransformationMatrix< ValueTypeT > &  matrix,
const ValueType  tol
const [inline]
 

Returns true iff all matrix elements are equal within the given tolerance.

Definition at line 1409 of file OSGMatrix.inl.

References osg::TransformationMatrix< ValueTypeT >::_matrix.

Referenced by osg::TransformationMatrix< ValueTypeT >::operator==().

01412 {
01413     UInt32 i;
01414     bool returnValue = true;
01415 
01416     for(i = 0; i < 4; i++)
01417     {
01418         returnValue &= _matrix[i].equals(matrix._matrix[i], tolerance);
01419 
01420         if(returnValue == false)
01421             break;
01422     }
01423 
01424     return returnValue;
01425 }

template<class ValueTypeT>
bool osg::TransformationMatrix< ValueTypeT >::exp TransformationMatrix< ValueTypeT > &  result  )  const [inline]
 

Computes the exponential of this matrix and stores it in result.

Definition at line 2542 of file OSGMatrix.inl.

References osg::TransformationMatrix< ValueTypeT >::addScaled(), osg::TransformationMatrix< ValueTypeT >::multLeft(), osg::TransformationMatrix< ValueTypeT >::normInfinity(), osg::osgLog(), osg::TransformationMatrix< ValueTypeT >::scale(), and osg::TransformationMatrix< ValueTypeT >::setIdentity().

02543 {
02544     const Int32                q = 6;
02545 
02546           TransformationMatrix A(*this);
02547           TransformationMatrix D;
02548           TransformationMatrix N;
02549 
02550           Int32                j = 1;
02551           Int32                k;
02552 
02553           ValueTypeT           c(1.0);
02554 
02555     j += Int32(osgLog(A.normInfinity() / 0.693));
02556 
02557     if(j < 0) 
02558         j = 0;
02559 
02560     A.scale(ValueTypeT(1.0f / (1 << j)));
02561 
02562     result.setIdentity();
02563 
02564     for(k = 1; k <= q; k++)
02565     {
02566         c *= ValueTypeT(q - k + 1) / ValueTypeT(k * (2 * q - k + 1));
02567 
02568         result.multLeft(A);
02569 
02570         N.addScaled(result, c);
02571 
02572         if(k % 2) 
02573         {
02574             D.addScaled(result, -c);
02575         }
02576         else
02577         {
02578             D.addScaled(result,  c);
02579         }
02580     }
02581 
02582     result.invertFrom(D);
02583     result.mult      (N);
02584 
02585     for(k = 0; k < j; k++)
02586         result.mult(result);
02587 
02588     // ToDo: return value
02589     return true;
02590 }

template<class ValueTypeT>
bool osg::TransformationMatrix< ValueTypeT >::expOf const TransformationMatrix< ValueTypeT > &  matrix  )  [inline]
 

Sets this matrix to the exponential of the given matrix.

Definition at line 2596 of file OSGMatrix.inl.

References osg::TransformationMatrix< ValueTypeT >::addScaled(), osg::TransformationMatrix< ValueTypeT >::multLeft(), osg::TransformationMatrix< ValueTypeT >::normInfinity(), osg::osgLog(), osg::TransformationMatrix< ValueTypeT >::scale(), and osg::TransformationMatrix< ValueTypeT >::setIdentity().

Referenced by osg::LinearTransform< ValueTypeT >::getTransform().

02598 {
02599     const Int32                q = 6;
02600 
02601           TransformationMatrix A(matrix);
02602           TransformationMatrix D;
02603           TransformationMatrix N;
02604 
02605           Int32                j = 1;
02606           Int32                k;
02607 
02608           ValueTypeT           c(1.0);
02609 
02610     j += int(osgLog(A.normInfinity() / 0.693));
02611 
02612     if(j < 0) 
02613         j = 0;
02614 
02615     A.scale(1.0 / (ValueTypeT(1 << j)));
02616 
02617     setIdentity();
02618 
02619     for(k = 1; k <= q; k++)
02620     {
02621         c *= ValueTypeT(q - k + 1) / ValueTypeT(k * (2 *q - k + 1));
02622 
02623         multLeft(A);
02624 
02625         N.addScaled(*this,c);
02626 
02627         if(k % 2) 
02628         {
02629             D.addScaled(*this, -c);
02630         }
02631         else 
02632         {
02633             D.addScaled(*this,  c);
02634         }
02635     }
02636 
02637     invertFrom(D);
02638     mult      (N);
02639 
02640     for(k = 0; k < j; k++)
02641         mult(*this);
02642 
02643     // ToDo: return value
02644     return true;
02645 }

template<class ValueTypeT>
bool osg::TransformationMatrix< ValueTypeT >::factor TransformationMatrix< ValueTypeT > &  r,
VectorType3f s,
TransformationMatrix< ValueTypeT > &  u,
VectorType3f t,
TransformationMatrix< ValueTypeT > &  proj
const [inline]
 

Factors a matrix m into 5 pieces: m = r s rt u t, where rt means transpose of r, and r and u are rotations, s is a scale, and t is a translation. Any projection information is returned in proj.

Definition at line 1025 of file OSGMatrix.inl.

References osg::TransformationMatrix< ValueTypeT >::_matrix, osg::TransformationMatrix< ValueTypeT >::det(), and osg::TransformationMatrix< ValueTypeT >::setIdentity().

Referenced by osg::TransformationMatrix< ValueTypeT >::getTransform().

01030 {
01031     Real64               det;       
01032     Real64               det_sign;   
01033     Real64               scratch;
01034     Int32                i;
01035     Int32                j;
01036     Int32                junk;
01037     TransformationMatrix a;
01038     TransformationMatrix aT;
01039     TransformationMatrix rT;
01040     TransformationMatrix b;
01041     TransformationMatrix si;
01042     ValueTypeT           evalues [3];
01043     VectorType3f         evectors[3];
01044     
01045     a = *this;
01046 
01047     proj.setIdentity();
01048 
01049     scratch = 1.0;
01050     
01051     for (i = 0; i < 3; i++) 
01052     {
01053         for (j = 0; j < 3; j++) 
01054         {
01055             a._matrix[i][j] *= ValueTypeT(scratch);
01056         }
01057 
01058         t[i] = _matrix[3][i] * ValueTypeT(scratch);
01059 
01060         a._matrix[3][i] = a._matrix[i][3] = 0.0;
01061     }
01062 
01063     a._matrix[3][3] = 1.0;
01064     
01065     /* (3) Compute det A. If negative, set sign = -1, else sign = 1 */
01066 
01067     det      = a.det3();
01068 
01069     det_sign = (det < 0.0 ? -1.0 : 1.0);
01070 
01071     if(det_sign * det < 1e-12)
01072         return false;      // singular
01073     
01074     /* (4) B = A * A^  (here A^ means A transpose) */
01075