3ds Max C++ API Reference
GMatrix Class Reference

This class implements a 4x4 matrix object. More...

#include <IGameType.h>

+ Inheritance diagram for GMatrix:

Public Member Functions

GRowGetAddr ()
 Return the Address of the GMatrix. This allows direct access via the [] operator. More...
 
const GRowGetAddr () const
 Return the Address of the GMatrix. This allows direct access via the [] operator.
More...
 
IGAMEEXPORT GMatrix ()
 Default constructor, set Identity matrix. More...
 
IGAMEEXPORT GMatrix (Matrix3)
 Constructor from a Matrix3. More...
 
void ResetMatrix ()
 Set all values to 0.0f. More...
 
IGAMEEXPORT BOOL IsIdentity (float epsilon=1E-5f)
 Determine whether or not the matrix is an Identity matrix. More...
 
IGAMEEXPORT void SetIdentity ()
 Set the Standard Identity Matrix. More...
 
IGAMEEXPORT float Determinant () const
 Return Determinant of matrix. More...
 
IGAMEEXPORT GMatrix Inverse ()
 Return Inverse of matrix. More...
 
IGAMEEXPORT Point3 Translation () const
 Return a translation transformation. More...
 
IGAMEEXPORT Quat Rotation () const
 Return a essential rotation transformation. More...
 
IGAMEEXPORT Point3 Scaling () const
 Return a scaling transformation. More...
 
Quat ScaleRotation () const
 Return a stretch transformation. More...
 
IGAMEEXPORT int Parity () const
 Return 'parity' sign of the matrix, -1 if negative, 1 otherwise. More...
 
IGAMEEXPORT Point4 GetColumn (int i) const
 Access to the matrix column. More...
 
IGAMEEXPORT void SetColumn (int i, Point4 col)
 Set the the matrix column. More...
 
Point4 GetRow (int i) const
 Access to the matrix row. More...
 
IGAMEEXPORT void SetRow (int i, Point4 row)
 Set to the matrix row to the desired data. More...
 
IGAMEEXPORT Matrix3 ExtractMatrix3 () const
 Extract a Matrix3 from the GMatrix. More...
 
Subscript Operator
Point4operator[] (int i)
 Return a reference to the 'i-th' Point4 of the matrix. More...
 
const Point4operator[] (int i) const
 Return a reference to the 'i-th' Point4 of the matrix. More...
 
Binary operators
IGAMEEXPORT GMatrix operator- (const GMatrix &) const
 
IGAMEEXPORT GMatrix operator* (const GMatrix &) const
 
IGAMEEXPORT GMatrix operator+ (const GMatrix &) const
 
Assignment operators
IGAMEEXPORT GMatrixoperator-= (const GMatrix &M)
 Assignment operator from a Matrix3. More...
 
IGAMEEXPORT GMatrixoperator+= (const GMatrix &M)
 Assignment operator from a Matrix3. More...
 
IGAMEEXPORT GMatrixoperator*= (const GMatrix &M)
 Assignment operator from a Matrix3. More...
 
IGAMEEXPORT GMatrixoperator*= (const float a)
 Assignment operator from a Matrix3. More...
 
IGAMEEXPORT GMatrixoperator= (const Matrix3 &)
 Assignment operator from a Matrix3. More...
 
Comparison operators
IGAMEEXPORT BOOL operator== (const GMatrix &M) const
 Test for equality within the specified tolerance. More...
 
IGAMEEXPORT BOOL Equals (const GMatrix &M, float epsilon=1E-5f) const
 Test for equality within the specified tolerance. More...
 

Friends

IGAMEEXPORT Point3 operator* (const Point3 &V, const GMatrix &A)
 Multiply a GMatrix with a Point3. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Detailed Description

This class implements a 4x4 matrix object.

Constructor & Destructor Documentation

◆ GMatrix() [1/2]

Default constructor, set Identity matrix.

◆ GMatrix() [2/2]

Constructor from a Matrix3.

Member Function Documentation

◆ operator[]() [1/2]

Point4& operator[] ( int  i)
inline

Return a reference to the 'i-th' Point4 of the matrix.

45 { return((Point4&)(*m[i]));}
Definition: point4.h:43

◆ operator[]() [2/2]

const Point4& operator[] ( int  i) const
inline

Return a reference to the 'i-th' Point4 of the matrix.

46 { return((Point4&)(*m[i])); }

◆ GetAddr() [1/2]

GRow* GetAddr ( )
inline

Return the Address of the GMatrix. This allows direct access via the [] operator.

Returns
The address of the GMatrix
53 {return (GRow *)(m);}
float GRow[4]
GMatrix row.
Definition: IGameType.h:27

◆ GetAddr() [2/2]

const GRow* GetAddr ( ) const
inline

Return the Address of the GMatrix. This allows direct access via the [] operator.

This method is const aware.

Returns
The address of the GMatrix
59 { return (GRow *)(m); }

◆ ResetMatrix()

void ResetMatrix ( )

Set all values to 0.0f.

◆ IsIdentity()

IGAMEEXPORT BOOL IsIdentity ( float  epsilon = 1E-5f)

Determine whether or not the matrix is an Identity matrix.

within the specified tolerance

Parameters
epsilonTolerance defaulted to epsilon = 1E-5f
Returns
True if the matrix is the Identity matrix

◆ SetIdentity()

IGAMEEXPORT void SetIdentity ( )

Set the Standard Identity Matrix.

◆ Determinant()

IGAMEEXPORT float Determinant ( ) const

Return Determinant of matrix.

◆ Inverse()

IGAMEEXPORT GMatrix Inverse ( )

Return Inverse of matrix.

◆ Translation()

IGAMEEXPORT Point3 Translation ( ) const

Return a translation transformation.

◆ Rotation()

IGAMEEXPORT Quat Rotation ( ) const

Return a essential rotation transformation.

◆ Scaling()

IGAMEEXPORT Point3 Scaling ( ) const

Return a scaling transformation.

◆ ScaleRotation()

Quat ScaleRotation ( ) const

Return a stretch transformation.

This is the axis system of the scaling application

◆ Parity()

IGAMEEXPORT int Parity ( ) const

Return 'parity' sign of the matrix, -1 if negative, 1 otherwise.

◆ GetColumn()

IGAMEEXPORT Point4 GetColumn ( int  i) const

Access to the matrix column.

Parameters
iThe number of the column to retrieve
Returns
A Point4 containing the column

◆ SetColumn()

IGAMEEXPORT void SetColumn ( int  i,
Point4  col 
)

Set the the matrix column.

◆ GetRow()

Point4 GetRow ( int  i) const
inline

Access to the matrix row.

119 { return (*this)[i]; }

◆ SetRow()

IGAMEEXPORT void SetRow ( int  i,
Point4  row 
)

Set to the matrix row to the desired data.

◆ operator-()

IGAMEEXPORT GMatrix operator- ( const GMatrix ) const

◆ operator*()

IGAMEEXPORT GMatrix operator* ( const GMatrix ) const

◆ operator+()

IGAMEEXPORT GMatrix operator+ ( const GMatrix ) const

◆ operator-=()

IGAMEEXPORT GMatrix& operator-= ( const GMatrix M)

Assignment operator from a Matrix3.

◆ operator+=()

IGAMEEXPORT GMatrix& operator+= ( const GMatrix M)

Assignment operator from a Matrix3.

◆ operator*=() [1/2]

IGAMEEXPORT GMatrix& operator*= ( const GMatrix M)

Assignment operator from a Matrix3.

◆ operator*=() [2/2]

IGAMEEXPORT GMatrix& operator*= ( const float  a)

Assignment operator from a Matrix3.

◆ operator=()

IGAMEEXPORT GMatrix& operator= ( const Matrix3 )

Assignment operator from a Matrix3.

◆ operator==()

IGAMEEXPORT BOOL operator== ( const GMatrix M) const

Test for equality within the specified tolerance.

◆ Equals()

IGAMEEXPORT BOOL Equals ( const GMatrix M,
float  epsilon = 1E-5f 
) const

Test for equality within the specified tolerance.

◆ ExtractMatrix3()

IGAMEEXPORT Matrix3 ExtractMatrix3 ( ) const

Extract a Matrix3 from the GMatrix.

This is for backward compatibility. This is only of use if you use 3ds Max as a coordinate system, other wise standard 3ds Max algebra might not be correct for your format.

Returns
A 3ds Max Matrix3 form of the GMatrix

Friends And Related Function Documentation

◆ operator*

IGAMEEXPORT Point3 operator* ( const Point3 V,
const GMatrix A 
)
friend

Multiply a GMatrix with a Point3.