GMatrix Class Reference

GMatrix Class Reference

#include <IGameType.h>

Class Description

This class implements a 4x4 matrix object.

+ 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
 
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)
 
IGAMEEXPORT GMatrixoperator+= (const GMatrix &M)
 
IGAMEEXPORT GMatrixoperator*= (const GMatrix &M)
 
IGAMEEXPORT GMatrixoperator*= (const float a)
 
IGAMEEXPORT GMatrixoperator= (const Matrix3 &)
 Assignment operator from a Matrix3. More...
 
Comparison operators
IGAMEEXPORT BOOL operator== (const GMatrix &M) const
 
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...
 

Constructor & Destructor Documentation

Default constructor, set Identity matrix.

Constructor from a Matrix3.

Member Function Documentation

Point4& operator[] ( int  i)
inline

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

45 { return((Point4&)(*m[i]));}
Definition: point4.h:41
const Point4& operator[] ( int  i) const
inline
46 { return((Point4&)(*m[i])); }
Definition: point4.h:41
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
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); }
float GRow[4]
GMatrix row.
Definition: IGameType.h:27
void ResetMatrix ( )

Set all values to 0.0f.

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
IGAMEEXPORT void SetIdentity ( )

Set the Standard Identity Matrix.

IGAMEEXPORT float Determinant ( ) const

Return Determinant of matrix.

IGAMEEXPORT GMatrix Inverse ( )

Return Inverse of matrix.

IGAMEEXPORT Point3 Translation ( ) const

Return a translation transformation.

IGAMEEXPORT Quat Rotation ( ) const

Return a essential rotation transformation.

IGAMEEXPORT Point3 Scaling ( ) const

Return a scaling transformation.

Quat ScaleRotation ( ) const

Return a stretch transformation.

This is the axis system of the scaling application

IGAMEEXPORT int Parity ( ) const

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

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
IGAMEEXPORT void SetColumn ( int  i,
Point4  col 
)

Set the the matrix column.

Point4 GetRow ( int  i) const
inline

Access to the matrix row.

119 { return (*this)[i]; }
IGAMEEXPORT void SetRow ( int  i,
Point4  row 
)

Set to the matrix row to the desired data.

IGAMEEXPORT GMatrix operator- ( const GMatrix ) const
IGAMEEXPORT GMatrix operator* ( const GMatrix ) const
IGAMEEXPORT GMatrix operator+ ( const GMatrix ) const
IGAMEEXPORT GMatrix& operator-= ( const GMatrix M)
IGAMEEXPORT GMatrix& operator+= ( const GMatrix M)
IGAMEEXPORT GMatrix& operator*= ( const GMatrix M)
IGAMEEXPORT GMatrix& operator*= ( const float  a)
IGAMEEXPORT GMatrix& operator= ( const Matrix3 )

Assignment operator from a Matrix3.

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

Test for equality within the specified tolerance.

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

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

Multiply a GMatrix with a Point3.