#include <MMatrix.h>
A matrix math class for 4x4 matrices of doubles.
This class provides access to Maya's internal matrix math library allowing matrices to be handled easily, and in a manner compatible with internal Maya data structures.
All methods that query the matrix are threadsafe, all methods that modify the matrix are not threadsafe.
Public Member Functions | |
MMatrix () | |
The default contstructor. More... | |
MMatrix (const MMatrix &src) | |
The copy Constructor. More... | |
MMatrix (const double m[4][4]) | |
Initialize the instance with a 4x4 matrix of doubles. More... | |
MMatrix (const float m[4][4]) | |
Initialize the instance with a 4x4 matrix of floats. More... | |
~MMatrix () | |
The class destructor. | |
MMatrix & | operator= (const MMatrix &) |
The assignment operator. More... | |
double | operator() (unsigned int row, unsigned int col) const |
Index operator. More... | |
const double * | operator[] (unsigned int row) const |
Index operator. More... | |
MStatus | get (double dest[4][4]) const |
Fill a 4x4 matrix of doubles with the elements from the instance. More... | |
MStatus | get (float dest[4][4]) const |
Fill a 4x4 matrix of floats with the elements from the instance. More... | |
MMatrix | transpose () const |
Compute and return the transpose of this instance. More... | |
MMatrix & | setToIdentity () |
Set this instance to the 4x4 identity matrix. More... | |
MMatrix & | setToProduct (const MMatrix &left, const MMatrix &right) |
Set this instance to the inner product of the two argument matrices. More... | |
MMatrix & | operator+= (const MMatrix &right) |
The in place matrix addition operator. More... | |
MMatrix | operator+ (const MMatrix &right) const |
The matrix addition operator. More... | |
MMatrix & | operator-= (const MMatrix &right) |
The in place matrix subtraction operator. More... | |
MMatrix | operator- (const MMatrix &right) const |
The matrix subtraction operator. More... | |
MMatrix & | operator*= (const MMatrix &right) |
The in place matrix multiplication operator. More... | |
MMatrix | operator* (const MMatrix &right) const |
The matrix multiplication operator. More... | |
MMatrix & | operator*= (double) |
The in place matrix multiply by a scalar operator. More... | |
MMatrix | operator* (double) const |
The matrix multiply by a scalar operator. More... | |
bool | operator== (const MMatrix &other) const |
The matrix equality operator. More... | |
bool | operator!= (const MMatrix &other) const |
The matrix inequality operator. More... | |
MMatrix | inverse () const |
Compute and return the inverse of this instance. More... | |
MMatrix | adjoint () const |
Compute and return the adjoint of this instance. More... | |
MMatrix | homogenize () const |
Compute and return a homogenized version of this instance. More... | |
double | det4x4 () const |
Compute and return the determinant of this instance. More... | |
double | det3x3 () const |
Compute and return the determinant of the upper left 3x3 submatrix of this instance. More... | |
bool | isEquivalent (const MMatrix &other, double tolerance=MMatrix_kTol) const |
Determine if the given matrix is equivalent to this instance within the specified tolerance. More... | |
bool | isSingular () const |
Determines if the given matrix is singular. More... | |
double & | operator() (unsigned int row, unsigned int col) |
NO SCRIPT SUPPORT. More... | |
double * | operator[] (unsigned int row) |
NO SCRIPT SUPPORT. More... | |
Static Public Member Functions | |
static const char * | className () |
Returns the name of this class. More... | |
Public Attributes | |
double | matrix [4][4] |
The matrix data. | |
Static Public Attributes | |
static const MMatrix | identity |
The identity matrix. | |
Friends | |
OPENMAYA_EXPORT MMatrix | operator* (double, const MMatrix &right) |
NO SCRIPT SUPPORT. More... | |
OPENMAYA_EXPORT std::ostream & | operator<< (std::ostream &os, const MMatrix &m) |
NO SCRIPT SUPPORT. More... | |
MMatrix | ( | ) |
The default contstructor.
The instance is initialized to the 4x4 identity matrix.
MMatrix | ( | const double | src_matrix[4][4] | ) |
Initialize the instance with a 4x4 matrix of doubles.
[in] | src_matrix | 4x4 matrix of doubles |
MMatrix | ( | const float | src_matrix[4][4] | ) |
Initialize the instance with a 4x4 matrix of floats.
[in] | src_matrix | 4x4 matrix of floats |
The assignment operator.
[in] | src | Matrix whose value will be assigned to this one. |
|
inline |
Index operator.
Given row and column indices, it will return the value at the specified location in the matrix.
[in] | row | index of the row to access |
[in] | col | index of the column to access |
|
inline |
Index operator.
Returns an entire row of the matrix as an array of doubles.
[in] | row | index of the row to access |
MStatus get | ( | double | dest[4][4] | ) | const |
Fill a 4x4 matrix of doubles with the elements from the instance.
[out] | dest | 4x4 matrix of doubles to populate |
MStatus get | ( | float | dest[4][4] | ) | const |
Fill a 4x4 matrix of floats with the elements from the instance.
[out] | dest | 4x4 matrix of floats to populate |
MMatrix transpose | ( | ) | const |
Compute and return the transpose of this instance.
MMatrix & setToIdentity | ( | ) |
Set this instance to the 4x4 identity matrix.
Set this instance to the inner product of the two argument matrices.
[in] | left | the left hand matrix for the operation |
[in] | right | the right hand matrix for the operation |
The in place matrix addition operator.
Modifies this matrix.
[in] | right | Matrix to add. |
The matrix addition operator.
Does not modify this matrix.
[in] | right | Matrix to add to this one. |
The in place matrix subtraction operator.
Modifies this matrix.
[in] | right | Matrix to add to this one. |
The matrix subtraction operator.
Does not modify this matrix.
[in] | right | Matrix to subtract from this one. |
The in place matrix multiplication operator.
Modifies this matrix.
[in] | right | Matrix to multiply this one by. |
The matrix multiplication operator.
Does not modify this matrix.
[in] | right | Matrix to multiply this one by. |
MMatrix & operator*= | ( | double | factor | ) |
The in place matrix multiply by a scalar operator.
Modifies this matrix.
[in] | factor | Scalar to multiply this matrix by. |
MMatrix operator* | ( | double | factor | ) | const |
The matrix multiply by a scalar operator.
Does not modify this matrix.
[in] | factor | Scalar to multiply this matrix by. |
bool operator== | ( | const MMatrix & | other | ) | const |
The matrix equality operator.
The matrices must be identical.
[in] | other | Matrix to compare against. |
bool operator!= | ( | const MMatrix & | other | ) | const |
The matrix inequality operator.
[in] | other | Matrix to compare against. |
MMatrix inverse | ( | ) | const |
Compute and return the inverse of this instance.
MMatrix adjoint | ( | ) | const |
Compute and return the adjoint of this instance.
MMatrix homogenize | ( | ) | const |
Compute and return a homogenized version of this instance.
double det4x4 | ( | ) | const |
Compute and return the determinant of this instance.
double det3x3 | ( | ) | const |
Compute and return the determinant of the upper left 3x3 submatrix of this instance.
bool isEquivalent | ( | const MMatrix & | other, |
double | tolerance = MMatrix_kTol |
||
) | const |
Determine if the given matrix is equivalent to this instance within the specified tolerance.
[in] | other | the matrix to compare to |
[in] | tolerance | the tolerance to use during the comparison |
bool isSingular | ( | ) | const |
Determines if the given matrix is singular.
|
inline |
NO SCRIPT SUPPORT.
Index operator.
Given row and column indices, it will return the value at the specified location in the matrix.
[in] | row | index of the row to access |
[in] | col | index of the column to access |
|
inline |
NO SCRIPT SUPPORT.
Index operator.
Returns an entire row of the matrix as an array of doubles.
[in] | row | index of the row to access |
|
static |
Returns the name of this class.
NO SCRIPT SUPPORT.
Does not modify this matrix.
[in] | factor | Scalar to multiply this matrix by. |
[in] | right | This matrix. |
|
friend |
NO SCRIPT SUPPORT.
The format used is [[r11, r12, r13, r14] [r21, r22, r23, r24] [r31, r32, r33, r34] [r41, r42, r43, r44]].
[in] | os | the ostream to print to |
[in] | m | the MMatrix whose value is to be printed |