#include <OSGMatrix.h>
Types | |
| typedef VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > > | VectorType |
| Matrix vector type, eg Vec4f. | |
| typedef QuaternionBase< ValueType > | QuaternionType |
| Matrix quaternion type. | |
| typedef VectorInterface< ValueTypeT, VecStorage3< ValueTypeT > > | VectorType3f |
| Matrix vec3f type. | |
| typedef PointInterface< ValueTypeT, VecStorage3< ValueTypeT > > | PointType3f |
| Matrix pnt3f type. | |
| *typedef ValueTypeT | ValueType |
| Value type, eg Real32. | |
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 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 |
| Returns an C++ pointer to the value store. | |
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 ¢er) |
Get Transformations | |
| *void | getTransform (VectorType3f &translation, QuaternionType &rotation, VectorType3f &scaleFactor, QuaternionType &scaleOrientation, const VectorType3f ¢er) 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. | |
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 |
| Returns true iff all matrix elements are equal within the given tolerance. | |
| bool | invert3 (void) |
| Returns true iff all matrix elements are equal within the given tolerance. | |
| bool | invertFrom3 (const TransformationMatrix &matrix) |
| Returns true iff all matrix elements are equal within the given tolerance. | |
| bool | transposed (TransformationMatrix &result) const |
| Returns true iff all matrix elements are equal within the given tolerance. | |
| bool | transpose (void) |
| Returns true iff all matrix elements are equal within the given tolerance. | |
| bool | transposeFrom (const TransformationMatrix &matrix) |
| Returns true iff all matrix elements are equal within the given tolerance. | |
| void | mult (const TransformationMatrix &matrix) |
| Returns true iff all matrix elements are equal within the given tolerance. | |
| void | multLeft (const TransformationMatrix &matrix) |
| Returns true iff all matrix elements are equal within the given tolerance. | |
| 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 | |
| *VectorType & | operator[] (UInt32 uiIndex) |
| const VectorType & | operator[] (UInt32 uiIndex) const |
Assignment | |
| *TransformationMatrix & | operator= (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 TransformationMatrix & | identity (void) |
Protected Attributes | |
Storage | |
| *VectorType | _matrix [4] |
| Value store. | |
Static Private Attributes | |
| static TransformationMatrix | _identityMatrix |
Definition at line 64 of file OSGMatrix.h.
|
|||||
|
Definition at line 76 of file OSGMatrix.h. |
|
|||||
|
Definition at line 78 of file OSGMatrix.h. |
|
|||||
|
Definition at line 81 of file OSGMatrix.h. |
|
|||||
|
Definition at line 84 of file OSGMatrix.h. |
|
||||||||||
|
Definition at line 99 of file OSGMatrix.inl. References osg::TransformationMatrix< ValueTypeT >::_matrix. 00100 { 00101 for(UInt32 i = 0; i < 4; i++) 00102 { 00103 _matrix[i][i] = TypeTraits<ValueType>::getOneElement(); 00104 } 00105 }
|
|
||||||||||
|
Definition at line 108 of file OSGMatrix.inl. References osg::TransformationMatrix< ValueTypeT >::_matrix. 00110 { 00111 for(UInt32 i = 0; i < 4; i++) 00112 { 00113 _matrix[i] = source._matrix[i]; 00114 } 00115 }
|
|
||||||||||||||||||||
|
Definition at line 118 of file OSGMatrix.inl. References osg::TransformationMatrix< ValueTypeT >::_matrix, and osg::PointInterface< ValueTypeT, StorageInterfaceT >::setValue(). 00122 { 00123 _matrix[0].setValue(vector1); 00124 _matrix[1].setValue(vector2); 00125 _matrix[2].setValue(vector3); 00126 }
|
|
||||||||||||||||||||||||
|
Definition at line 129 of file OSGMatrix.inl. References osg::TransformationMatrix< ValueTypeT >::_matrix, and osg::PointInterface< ValueTypeT, StorageInterfaceT >::setValue(). 00134 { 00135 _matrix[0].setValue(vector1); 00136 _matrix[1].setValue(vector2); 00137 _matrix[2].setValue(vector3); 00138 _matrix[3].setValue(vector4); 00139 }
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Definition at line 142 of file OSGMatrix.inl. References osg::TransformationMatrix< ValueTypeT >::_matrix, and osg::VecStorage4< ValueTypeT >::setValues(). 00162 { 00163 _matrix[0].setValues(rVal00, rVal01, rVal02, rVal03); 00164 _matrix[1].setValues(rVal10, rVal11, rVal12, rVal13); 00165 _matrix[2].setValues(rVal20, rVal21, rVal22, rVal23); 00166 _matrix[3].setValues(rVal30, rVal31, rVal32, rVal33); 00167 }
|
|
||||||||||
|
Definition at line 173 of file OSGMatrix.inl.
|
|
||||||||||
|
Definition at line 90 of file OSGMatrix.inl. References osg::TransformationMatrix< ValueTypeT >::_identityMatrix. 00091 { 00092 return _identityMatrix; 00093 }
|
|
||||||||||
|
||||||||||
|
Definition at line 191 of file OSGMatrix.inl. References osg::TransformationMatrix< ValueTypeT >::_matrix. Referenced by osg::DisplayCalibration::createCMViewports(), osg::TransformationMatrix< ValueTypeT >::factor(), osg::FieldDataTraits< Matrix >::getFromString(), osg::ProjectionCameraDecorator::getProjectionTranslation(), osg::TransformationMatrix< ValueTypeT >::log(), osg::TransformationMatrix< ValueTypeT >::logOf(), osg::MatrixLookAt(), osg::TransformationMatrix< ValueTypeT >::setValue(), osg::TransformationMatrix< ValueTypeT >::sqrt(), and osg::TransformationMatrix< ValueTypeT >::sqrtOf(). 00193 { 00194 for(UInt32 i = 0; i < 4; i++) 00195 { 00196 _matrix[i] = mat._matrix[i]; 00197 } 00198 }
|
|
||||||||||||||||||||
|
Definition at line 201 of file OSGMatrix.inl. References osg::TransformationMatrix< ValueTypeT >::_matrix, and osg::PointInterface< ValueTypeT, StorageInterfaceT >::setValue(). 00204 { 00205 _matrix[0].setValue(vector1); 00206 _matrix[1].setValue(vector2); 00207 _matrix[2].setValue(vector3); 00208 }
|
|
||||||||||||||||||||||||
|
Definition at line 211 of file OSGMatrix.inl. References osg::TransformationMatrix< ValueTypeT >::_matrix, and osg::PointInterface< ValueTypeT, StorageInterfaceT >::setValue(). 00215 { 00216 _matrix[0].setValue(vector1); 00217 _matrix[1].setValue(vector2); 00218 _matrix[2].setValue(vector3); 00219 _matrix[3].setValue(vector4); 00220 }
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Definition at line 223 of file OSGMatrix.inl. References osg::TransformationMatrix< ValueTypeT >::_matrix, and osg::VecStorage4< ValueTypeT >::setValues(). 00242 { 00243 _matrix[0].setValues(rVal00, rVal01, rVal02, rVal03); 00244 _matrix[1].setValues(rVal10, rVal11, rVal12, rVal13); 00245 _matrix[2].setValues(rVal20, rVal21, rVal22, rVal23); 00246 _matrix[3].setValues(rVal30, rVal31, rVal32, rVal33); 00247 }
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Definition at line 250 of file OSGMatrix.inl. References osg::TransformationMatrix< ValueTypeT >::_matrix, and osg::VecStorage4< ValueTypeT >::setValues(). Referenced by osg::MatrixFrustum(), osg::MatrixOrthogonal(), osg::TransformationMatrix< ValueTypeT >::setValue(), osg::TransformationMatrix< ValueTypeT >::transposed(), and osg::TransformationMatrix< ValueTypeT >::transposeFrom(). 00270 { 00271 _matrix[0].setValues(rVal00, rVal01, rVal02, rVal03); 00272 _matrix[1].setValues(rVal10, rVal11, rVal12, rVal13); 00273 _matrix[2].setValues(rVal20, rVal21, rVal22, rVal23); 00274 _matrix[3].setValues(rVal30, rVal31, rVal32, rVal33); 00275 }
|
|
||||||||||||||||
|
Definition at line 280 of file OSGMatrix.inl. References osg::TransformationMatrix< ValueTypeT >::_matrix, and osg::PointInterface< ValueTypeT, StorageInterfaceT >::setValue(). 00282 { 00283 const ValueTypeT *pTmpMat = pMat; 00284 00285 if(bTransposed == true) 00286 { 00287 for(UInt32 i = 0; i < 4; i++) 00288 { 00289 _matrix[i].setValue(pTmpMat); 00290 00291 pTmpMat += 4; 00292 } 00293 } 00294 else 00295 { 00296 for(UInt32 i = 0; i < 4; i++) 00297 { 00298 for(UInt32 j = 0; j < 4; j++) 00299 { 00300 _matrix[i][j] = pTmpMat[j * 4 + i]; 00301 } 00302 } 00303 } 00304 }
|
|
||||||||||
|
Definition at line 309 of file OSGMatrix.inl. References osg::TransformationMatrix< ValueTypeT >::_matrix.
|
|
||||||||||
|
Definition at line 322 of file OSGMatrix.inl. References osg::TransformationMatrix< ValueTypeT >::_matrix, and osg::PointInterface< ValueTypeT, StorageInterfaceT >::setValue(). 00323 { 00324 for(UInt32 i = 0; i < 4; i++) 00325 { 00326 _matrix[i].setValue(pMat[i]); 00327 } 00328 }
|
|
||||||||||||||||
|
Definition at line 337 of file OSGMatrix.inl. References osg::TransformationMatrix< ValueTypeT >::setIdentity(), osg::TransformationMatrix< ValueTypeT >::setValue(), and osg::TransformationMatrix< ValueTypeT >::setValueTransposed(). 00339 { 00340 UInt32 i; 00341 UInt32 numOfToken = 16; 00342 00343 Char8 *c = const_cast<char*>(str); 00344 00345 Char8 *tokenC = 0; 00346 Char8 token[256]; 00347 00348 ValueTypeT vec[16]; 00349 00350 if( (str == NULL) || 00351 (*str == '\0') ) 00352 { 00353 setIdentity(); 00354 return; 00355 } 00356 00357 for(i = 0; i < numOfToken; c++) 00358 { 00359 switch (*c) 00360 { 00361 case '\0': 00362 if (tokenC) 00363 { 00364 *tokenC = 0; 00365 vec[i++] = TypeTraits<ValueTypeT>::getFromString(token); 00366 00367 } 00368 00369 while (i < numOfToken) 00370 { 00371 vec[i++] = TypeTraits<ValueTypeT>::getZeroElement(); 00372 } 00373 00374 break; 00375 case ' ': 00376 case '\t': 00377 case '\n': 00378 case ',': 00379 if (tokenC) 00380 { 00381 *tokenC = 0; 00382 vec[i++] = TypeTraits<ValueTypeT>::getFromString(token); 00383 tokenC = 0; 00384 } 00385 break; 00386 default: 00387 if (!tokenC) 00388 { 00389 tokenC = token; 00390 } 00391 *tokenC++ = *c; 00392 break; 00393 } 00394 } 00395 00396 if(bTransposed == true) 00397 { 00398 setValueTransposed(vec[0], vec[1], vec[2], vec[3], 00399 vec[4], vec[5], vec[6], vec[7], 00400 vec[8], vec[9], vec[10], vec[11], 00401 vec[12], vec[13], vec[14], vec[15]); 00402 } 00403 else 00404 { 00405 setValue(vec[0], vec[1], vec[2], vec[3], 00406 vec[4], vec[5], vec[6], vec[7], 00407 vec[8], vec[9], vec[10], vec[11], 00408 vec[12], vec[13], vec[14], vec[15]); 00409 } 00410 }
|
|
||||||||||