Matrix3 Class Reference
 
 
 
Matrix3 Class Reference

#include <matrix3.h>

Inheritance diagram for Matrix3:
MaxHeapOperators IdentityTM

Class Description

See also:
Class Point3, Matrix Representations of 3D Transformations, Class Quat, Class AngAxis, Structure AffineParts, Class BigMatrix.

Description:
This class implements a 4x3 3D transformation matrix object. Methods are provided to zero the matrix, set it to the identity, compute its inverse, apply incremental translation, rotation and scaling, and build new X, Y and Z rotation matrices. Operators are provided for matrix addition, subtraction, and multiplication. All methods are implemented by the system.

Note: In 3ds Max, all vectors are assumed to be row vectors. Under this assumption, multiplication of a vector with a matrix can be written either way (Matrix*Vector or Vector*Matrix), for ease of use, and the result is the same -- the (row) vector transformed by the matrix.
Data Members:
private:

float m[4][3];

Matrix storage.

DWORD flags;

Matrix Identity Flags.

POS_IDENT

Indicates the translation row of the matrix is the identity.

ROT_IDENT

Indicates the rotation elements of the matrix are the identity.

SCL_IDENT

Indicates the scale elements of the matrix are the identity.

MAT_IDENT

Indicates the matrix is the identity matrix. This is equivalent to (POS_IDENT|ROT_IDENT|SCL_IDENT).

Public Member Functions

const Point3 operator[] (int i) const
void  SetNotIdent ()
void  SetIdentFlags (DWORD f)
DWORD  GetIdentFlags () const
void  ClearIdentFlag (DWORD f)
BOOL  IsIdentity () const
void  ValidateFlags ()
MRow GetAddr ()
const MRow GetAddr () const
  Matrix3 ()
  Matrix3 (BOOL)
  Matrix3 (float(*fp)[3])
  Matrix3 (const Point3 &U, const Point3 &V, const Point3 &N, const Point3 &T)
Matrix3 Set (const Point3 &U, const Point3 &V, const Point3 &N, const Point3 &T)
int  operator== (const Matrix3 &M) const
int  Equals (const Matrix3 &M, float epsilon=1E-6f) const
Matrix3 operator-= (const Matrix3 &M)
Matrix3 operator+= (const Matrix3 &M)
Matrix3 operator*= (const Matrix3 &M)
  Multiply this matrix on the right by Matrix m.
Matrix3 operator*= (float a)
void  IdentityMatrix ()
void  Zero ()
Point3  GetRow (int i) const
void  SetRow (int i, Point3 p)
Point4  GetColumn (int i) const
void  SetColumn (int i, Point4 col)
Point3  GetColumn3 (int i) const
void  NoTrans ()
void  NoRot ()
void  NoScale ()
void  Orthogonalize ()
  Ortho-normalize the matrix.
void  SetTrans (const Point3 p)
void  SetTrans (int i, float v)
const Point3 GetTrans () const
void  Translate (const Point3 &p)
void  RotateX (float angle)
void  RotateY (float angle)
void  RotateZ (float angle)
void  Scale (const Point3 &s, BOOL trans=FALSE)
void  PreTranslate (const Point3 &p)
void  PreRotateX (float angle)
void  PreRotateY (float angle)
void  PreRotateZ (float angle)
void  PreScale (const Point3 &s, BOOL trans=FALSE)
void  SetTranslate (const Point3 &p)
void  SetRotateX (float angle)
void  SetRotateY (float angle)
void  SetRotateZ (float angle)
void  SetRotate (const Quat &q)
void  SetRotate (const AngAxis &aa)
void  SetRotate (float yaw, float pitch, float roll)
void  SetAngleAxis (const Point3 &axis, float angle)
void  SetScale (const Point3 &s)
void  SetFromToUp (const Point3 &from, const Point3 &to, const Point3 &up)
void  Invert ()
Matrix3  operator* (const Matrix3 &) const
Matrix3  operator+ (const Matrix3 &) const
Matrix3  operator- (const Matrix3 &) const
Point3  PointTransform (const Point3 &p) const
Point3  VectorTransform (const Point3 &p) const
void  TransformPoints (Point3 *array, int n, int stride=sizeof(Point3))
void  TransformPoints (const Point3 *array, Point3 *to, int n, int stride=sizeof(Point3), int strideTo=sizeof(Point3))
void  TransformVectors (Point3 *array, int n, int stride=sizeof(Point3))
void  TransformVectors (const Point3 *array, Point3 *to, int n, int stride=sizeof(Point3), int strideTo=sizeof(Point3))
void  GetYawPitchRoll (float *yaw, float *pitch, float *roll)
IOResult  Save (ISave *isave)
  Save this Matrix3 to disk.
IOResult  Load (ILoad *iload)
  Load the data for this Matrix3.
BOOL  Parity () const

Static Public Attributes

static const Matrix3  Identity
  An global instance of Matrix3 set to the identity.

Friends

class  Quat
Matrix3  RotateXMatrix (float angle)
Matrix3  RotateYMatrix (float angle)
Matrix3  RotateZMatrix (float angle)
Matrix3  TransMatrix (const Point3 &p)
Matrix3  ScaleMatrix (const Point3 &s)
Matrix3  RotateYPRMatrix (float Yaw, float Pitch, float Roll)
Matrix3  RotAngleAxisMatrix (Point3 &axis, float angle)
Matrix3  Inverse (const Matrix3 &M)
Matrix3  InverseHighPrecision (const Matrix3 &M)
Point3  operator* (const Matrix3 &A, const Point3 &V)
Point3  operator* (const Point3 &V, const Matrix3 &A)
Point3  VectorTransform (const Matrix3 &M, const Point3 &V)
Matrix3  XFormMat (const Matrix3 &xm, const Matrix3 &m)
Point3  VectorTransform (const Point3 &V, const Matrix3 &M)
void  MatrixMultiply (Matrix3 &outMatrix, const Matrix3 &matrixA, const Matrix3 &matrixB)
void  Inverse (Matrix3 &outMatrix, const Matrix3 &M)

Constructor & Destructor Documentation

Matrix3 ( ) [inline]
Remarks:
Constructor. Note that no initialization is done. Use Zero() or Identity(), or the constructors below.
{ flags = 0; }
Matrix3 ( BOOL  ) [inline]
Remarks:
Constructor. If TRUE is passed to the method the matrix is set to the identity.
Parameters:
init Specifies if the Matrix3 should be initialized to the identity.
{flags=0; IdentityMatrix();}
Matrix3 ( float(*)  fp[3] )
Remarks:
Constructor. The matrix is initialized to fp.
Parameters:
fp Specifies the initial values for the matrix.
Matrix3 ( const Point3 U,
const Point3 V,
const Point3 N,
const Point3 T 
) [inline]
Remarks:
Constructor. Initializes the matrix with the row data passed and validates the matrix flags.
Parameters:
U The data for row 0.
V The data for row 1.
N The data for row 2.
T The data for row 3.
{ Set(U, V, N, T); }

Member Function Documentation

const Point3& operator[] ( int  i ) const [inline]
Remarks:
Returns a reference to the 'i-th' Point3 of the matrix.
{ return((Point3&)(*m[i])); }
void SetNotIdent ( ) [inline]
Remarks:
This clears the MAT_IDENT flag to indicate the matrix is not the identity. If any changes are made to components directly via GetAddr(), this method must be called.
{ flags &= ~MAT_IDENT; }
void SetIdentFlags ( DWORD  f ) [inline]
Remarks:
This sets the specified identity flag(s).
Parameters:
f Specifies the identity flag bit(s) to set. See Matrix Identity Flags above.
{ flags &= ~MAT_IDENT; flags |= f; }
DWORD GetIdentFlags ( ) const [inline]
Remarks:
Returns the identity flags.
{ return flags; }
void ClearIdentFlag ( DWORD  f ) [inline]
Remarks:
Clears the specified identity flag(s). See Matrix Identity Flags above.
Parameters:
f Specifies the identity flag bit(s) to clear.
{ flags &= ~f; }
BOOL IsIdentity ( ) const [inline]
Remarks:
Returns TRUE if the matrix is the identity matrix (based on the flags); otherwise FALSE.
{ return ((flags&MAT_IDENT)==MAT_IDENT); }
void ValidateFlags ( )
Remarks:
This method may be used to recompute the *_IDENT flags for this matrix. For instance, if you call a method, such as INode::GetObjTMAfterWSM(), and it returns a matrix, you cannot use the IsIdentity() method to check if the matrix is indeed the identity. This is because the flags that method checks are not initialized by the INode method. What you can do however is call this method first. This will validate the flags in the matrix so they accuratly reflect the properties of the matrix. If after calling this method, and then calling IsIdentity(), the proper result would be returned.
MRow* GetAddr ( ) [inline]
Remarks:
Returns the address of this Matrix3.

The Matrix3 class keeps flags indicating identity for rotation, scale, position, and the matrix as a whole, and thus the direct access via the [] operator is restricted to prevent developers from modifying the matrix without updating the flags. This method, GetAddr(), still lets you get at the matrix itself and then you can use the [] operator on the result. Note: If you change the matrix via this pointer, you MUST clear the proper IDENT flags!

Also Note: typedef float MRow[3];
Returns:
The address of the Matrix3.
{ return (MRow *)(m); }   
const MRow* GetAddr ( ) const [inline]
Remarks:
Returns the address of this Matrix3.

The Matrix3 class keeps flags indicating identity for rotation, scale, position, and the matrix as a whole, and thus the direct access via the [] operator is restricted to prevent developers from modifying the matrix without updating the flags. This method, GetAddr(), still lets you get at the matrix itself and then you can use the [] operator on the result. Note: If you change the matrix via this pointer, you MUST clear the proper IDENT flags!

Also Note: typedef float MRow[3];
{ return (MRow *)(m); }
Matrix3& Set ( const Point3 U,
const Point3 V,
const Point3 N,
const Point3 T 
) [inline]
Remarks:
Initializes the matrix with the row data passed and validates the matrix flags.
Parameters:
U The data for row 0.
V The data for row 1.
N The data for row 2.
T The data for row 3.
Returns:
A reference to this matrix.
                                                                                     {
            flags = 0; SetRow(kXAxis, U); SetRow(kYAxis, V); SetRow(kZAxis, N); SetRow(kTrans, T); 
        ValidateFlags(); return *this; }
int operator== ( const Matrix3 M ) const
Remarks:
Compares the elements of this matrix and the one specified element by element for exact equality. Returns nonzero if they are equal; otherwise zero.
Parameters:
M The matrix to compare against.
int Equals ( const Matrix3 M,
float  epsilon = 1E-6f 
) const
Remarks:
Compares the elements of this matrix and the one specified element by element for equality within the specified tolerance epsilon. Returns nonzero if they are 'equal'; otherwise zero.
Parameters:
M The matrix to compare against.
epsilon The tolerance for comparison. If the values in the matrix are within this value (+ epsilon or - epsilon) they are considered equal.
Matrix3& operator-= ( const Matrix3 M )
Remarks:
Subtracts a Matrix3 from this Matrix3.
Matrix3& operator+= ( const Matrix3 M )
Remarks:
Adds a Matrix3 to this Matrix3.
Matrix3& operator*= ( const Matrix3 M )

Multiply this matrix on the right by Matrix m.

Remarks:
Multiplies this Matrix3 by the specified Matrix3 (*this = (*this)*M;).
                        Matrix3 tm1, tm2;
                        Matrix3 tm3 = tm1 * tm2;        // Is equivalent to the below
                        tm1 *= tm2;                                     // tm1 now equals tm3
Parameters:
M The matrix multiplied to the right of this matrix
Returns:
A reference to this matrix
Matrix3& operator*= ( float  a )
Remarks:
Multiplies each element of this Matrix3 by a float.
                        Matrix3 tm1(1), tm2(2);
                        tm1 *= 0.7f;    // This multiplies all elements by 0.7f
                        tm2.Scale(Point3(0.7f, 0.7f, 0.7f), TRUE); // This multiplies all elements by 0.7f
                        tm1 == tm2; // is true
Parameters:
a The scale to apply to each element of this matrix
Returns:
a reference to this matrix
void IdentityMatrix ( )
Remarks:
Set this matrix to the Identity Matrix.
void Zero ( )
Remarks:
This method sets all elements of the matrix to 0.0f
Point3 GetRow ( int  i ) const [inline]
Remarks:
Returns the specified row of this matrix.
Parameters:
i Specifies the row to retrieve.
{ return (*this)[i]; }
void SetRow ( int  i,
Point3  p 
)
Remarks:
Sets the specified row of this matrix to the specified values.
Parameters:
i Specifies the row to set.
p The values to set.
Point4 GetColumn ( int  i ) const
Remarks:
Returns the 'i-th' column of this matrix.
Parameters:
i Specifies the column to get (0-2).
void SetColumn ( int  i,
Point4  col 
)
Remarks:
Sets the 'i-th' column of this matrix to the specified values.
Parameters:
i Specifies the column to set (0-2).
col The values to set.
Point3 GetColumn3 ( int  i ) const
Remarks:
Returns the upper three entries in the specified column.
Parameters:
i Specifies the partial column to get (0-2).
void NoTrans ( )
Remarks:
This method zeros the translation portion of this matrix.
void NoRot ( )
Remarks:
This method zeros the rotation and scale portion of this matrix.
void NoScale ( )
Remarks:
The method zeros the scale portion of this matrix without orthogonalization. If the matrix was sheared (skewed) then the method is not able to remove scale component completely. Use Orthogonalize() method first, and then NoScale() to remove scale component entirely. Read SCL_IDENT flag to check if NoScale() method was enough to make the matrix to be orthogonal (with perpendicular axes of unit length).Prototype:

void Orthogonalize();
This is an "unbiased" orthogonalization of this matrix. The algorithm seems to take a maximum of 4 iterations to converge. An orthogonal matrix has an axis system where each axis is 90 degrees from the others (it's not skewed).
void Orthogonalize ( )

Ortho-normalize the matrix.

This ensures that each axis of the basis is of length 1 and at right angles to the other. This is an "unbiased" orthogonalization, which means that no single axis is used as the basis for the other axis, and all axis will be modified equally.

Note:
This is an iterative process, and should not be used in high-performance situations. It seems to take a maximum of 4 iterations to converge.
void SetTrans ( const Point3  p ) [inline]
Remarks:
Sets the translation row of this matrix to the specified values. The POS_IDENT flag is cleared.
Parameters:
p Specifies the values for the translation row.
{ (*this)[kTrans] = p;  flags &= ~POS_IDENT; }
void SetTrans ( int  i,
float  v 
) [inline]
Remarks:
Sets the specified component of the translation row of this matrix to the specified value. The POS_IDENT flag is cleared.
Parameters:
i Specifies the component of the translation row of this matrix to set.
v The value to set.
{ (*this)[kTrans][i] = v; flags &= ~POS_IDENT; }
const Point3& GetTrans ( ) const [inline]
Remarks:
Returns the translation row of this matrix.
Returns:
The translation row of this matrix.
{ return (*this)[kTrans]; }
void Translate ( const Point3 p )
Remarks:
Apply an incremental translation transformation to this matrix. This is equivalent to multiplying on the RIGHT by the transform.
Parameters:
p Specifies the translation.
void RotateX ( float  angle )
Remarks:
Apply an incremental X rotation transformation to this matrix. This is equivalent to multiplying on the RIGHT by the transform.
Parameters:
angle Specifies the X rotation in radians.
void RotateY ( float  angle )
Remarks:
Apply an incremental Y rotation transformation to this matrix. This is equivalent to multiplying on the RIGHT by the transform.
Parameters:
angle Specifies the Y rotation in radians.
void RotateZ ( float  angle )
Remarks:
Apply an incremental Z rotation transformation to this matrix. This is equivalent to multiplying on the RIGHT by the transform.
Parameters:
angle Specifies the Z rotation in radians.
void Scale ( const Point3 s,
BOOL  trans = FALSE 
)
Remarks:
Apply an incremental scaling transformation to this matrix. This is equivalent to multiplying on the RIGHT by the transform.
Parameters:
s The scale values.
trans If set to TRUE, the translation component is scaled. If trans = FALSE the translation component is unaffected. When 3ds Max was originally written there was a bug in the code for this method where the translation portion of the matrix was not being scaled. This meant that when a matrix was scaled the bottom row was not scaled. Thus it would always scale about the local origin of the object, but it would scale the world axes. When this bug was discovered, dependencies existed in the code upon this bug. Thus it could not simply be fixed because it would break the existing code that depended upon it working the incorrect way. To correct this the trans parameter was added. If this is set to TRUE, the translation component will be scaled correctly. The existing plug-ins don't use this parameter, it defaults to FALSE, and the code behaves the old way.
void PreTranslate ( const Point3 p )
Remarks:
Apply an incremental translation transformation to this matrix. This is equivalent to multiplying on the LEFT by the transform. param p Specifies the translation distance.
void PreRotateX ( float  angle )
Remarks:
Apply an incremental X rotation transformation to this matrix. This is equivalent to multiplying on the LEFT by the transform.
Parameters:
angle Specifies the X rotation in radians.
void PreRotateY ( float  angle )
Remarks:
Apply an incremental Y rotation transformation to this matrix. This is equivalent to multiplying on the LEFT by the transform.
Parameters:
angle Specifies the Y rotation in radians.
void PreRotateZ ( float  angle )
Remarks:
Apply an incremental Z rotation transformation to this matrix. This is equivalent to multiplying on the LEFT by the transform.
Parameters:
angle Specifies the Z rotation in radians.
void PreScale ( const Point3 s,
BOOL  trans = FALSE 
)
Remarks:
Apply an incremental scaling transformation to this matrix. This is equivalent to multiplying on the LEFT by the transform.
Parameters:
s The scale values.
trans = FALSE If trans = FALSE the translation component is unaffected.
void SetTranslate ( const Point3 p )
Remarks:
Sets this matrix to the identity and the translation components to the specified values.
Parameters:
p The translation values to store.
void SetRotateX ( float  angle )
Remarks:
Sets this matrix to the identity and the rotation components to the specified X rotation.
Parameters:
angle The angle for X rotation (in radians).
void SetRotateY ( float  angle )
Remarks:
Sets this matrix to the identity and the rotation components to the specified Y rotation.
Parameters:
angle The angle for Y rotation (in radians).
void SetRotateZ ( float  angle )
Remarks:
Sets this matrix to the identity and the rotation components to the specified Z rotation.
Parameters:
angle The angle for Z rotation (in radians).
void SetRotate ( const Quat q )
Remarks:
Sets the rotation components of the matrix as specified by the quaternion. The translation and scale components will match the identity matrix.
Parameters:
q Specifies the rotation to use for the matrix.
void SetRotate ( const AngAxis aa )
Remarks:
Sets the rotation components of the matrix as specified by the AngAxis. The translation and scale components will match the identity matrix.
Parameters:
aa Specifies the rotation to use for the matrix.
void SetRotate ( float  yaw,
float  pitch,
float  roll 
)
Remarks:
Sets the rotation components of this matrix using yaw, pitch and roll angles. There are many different conventions for specifying a rotation by means of three Euler angles. This function uses the convention of rotating around the world Z axis, then the X axis, then the Y axis; the three arguments are given in the order Y, X, Z.

This one is equivalent to:

M.IdentityMatrix();

M.RotateZ(roll);

M.RotateX(pitch);

M.RotateY(yaw);

--Which presupposes Y is vertical, X is sideways, Z is forward
Parameters:
yaw The yaw angle in radians.
pitch The pitch angle in radians.
roll The roll angle in radians.
void SetAngleAxis ( const Point3 axis,
float  angle 
)
Remarks:
Sets the rotation portion of the matrix to the rotation specified by the angle and axis and sets the translation portion to zeros.
Parameters:
axis The axis of rotation.
angle The angle of rotation about the axis in radians.
void SetScale ( const Point3 s )
Remarks:
Sets the scale components of this matrix to the specified values. The other components to this matrix will match the identity.
Parameters:
s The scale factors for the matrix.
void SetFromToUp ( const Point3 from,
const Point3 to,
const Point3 up 
)
Remarks:
This creates a matrix describing a viewpoint which is at the 'from' location, looking toward the 'to' location; the viewpoint is tilted so that the 'up' vector points to the top of the view.
Parameters:
from This specifies the viewpoint source location.
to This vector specifies the direction of view.
up This vector points to the top of the view.
void Invert ( )
Remarks:
This method performs an in-place inversion on this matrix. An inverted matrix, when multiplied by the original, yields the identity.
Matrix3 operator* ( const Matrix3 ) const
Remarks:
Perform matrix multiplication.
Matrix3 operator+ ( const Matrix3 ) const
Remarks:
Perform matrix addition.
Matrix3 operator- ( const Matrix3 ) const
Remarks:
Perform matrix subtraction.
Point3 PointTransform ( const Point3 p ) const
Remarks:
Returns the specified point transformed by this matrix.
Parameters:
p The point to transform by this matrix.
Point3 VectorTransform ( const Point3 p ) const
Remarks:
Returns the specified vector transformed by this matrix.
Parameters:
p The vector to transform by this matrix.
void TransformPoints ( Point3 array,
int  n,
int  stride = sizeof(Point3) 
)
Remarks:
Transforms the specified list of points with this matrix.
Parameters:
array The array of points to transform with this matrix.
n The number of points in the array.
stride The size of the increment used when moving to the next point. If you wish to transform an array of data objects which contain x, y, and z coordinates in order (such as a Point4, or a structure containing a Point3 as a member) you can specify a 'stride' value (for instance sizeof(data_object)).
void TransformPoints ( const Point3 array,
Point3 to,
int  n,
int  stride = sizeof(Point3),
int  strideTo = sizeof(Point3) 
)
Remarks:
Transforms the specified list of points with this matrix and stores the resulting transformed points in the storage passed.
Parameters:
array The array of points to transform (the source).
to The array to store the transformed points (the destination).
n The number of points in the source array.
stride The size increment used when moving to the next source location.
strideTo The size increment used when moving to the next storage location.
void TransformVectors ( Point3 array,
int  n,
int  stride = sizeof(Point3) 
)
Remarks:
Transforms the specified list of vectors with this matrix.
Parameters:
array The array of vectors to transform with this matrix.
n The number of vectors in the array.
stride The size of the increment used when moving to the next vector. If you wish to transform an array of data objects which contain x, y, and z coordinates in order (such as a Point4, or a structure containing a Point3 as a member) you can specify a 'stride' value (for instance sizeof(data_object)).
void TransformVectors ( const Point3 array,
Point3 to,
int  n,
int  stride = sizeof(Point3),
int  strideTo = sizeof(Point3) 
)
Remarks:
Transforms the specified list of vectors with this matrix and stores the resulting transformed vectors in the storage passed.
Parameters:
Point3 *array The array of vectors to transform (the source).
to The array to store the transformed vectors (the destination).
n The number of vectors in the source array.
stride The size increment used when moving to the next source location.
strideTo The size increment used when moving to the next storage location.
void GetYawPitchRoll ( float *  yaw,
float *  pitch,
float *  roll 
)
Remarks:
Retrieves the yaw, pitch and roll angles represented by the rotation in this matrix.
Parameters:
yaw The yaw rotation angle is stored here (in radians).
pitch The pitch rotation angle is stored here (in radians).
roll The roll rotation angle is stored here (in radians).
IOResult Save ( ISave isave )

Save this Matrix3 to disk.

Parameters:
isave The interface responsible for actually saving the data
Returns:
IO_OK on success, or a failure code
IOResult Load ( ILoad iload )

Load the data for this Matrix3.

Parameters:
iload The interface responsible for actually loading the data
Returns:
IO_OK on success, or a failure code
BOOL Parity ( ) const
Remarks:
Returns the 'parity' of the matrix. Scaling one axis of the matrix negatively switches the 'parity'. However if you scale two axis the parity will flip back. Scaling three axis switches the parity again.

When rendering a mesh, if you scale something along one axis, it turns 'inside out'. That is the direction when the normals are reversed. This method may be used to detect that case and then reverse the normals. The 3ds Max renderer does this -- if this method returns TRUE it flips all the normals so it won't turn inside out.

Friends And Related Function Documentation

friend class Quat [friend]
Matrix3 RotateXMatrix ( float  angle ) [friend]
Remarks:
Builds a new matrix for use as a X rotation transformation.
Parameters:
angle Specifies the angle of rotation in radians.
Returns:
A new X rotation Matrix3.
Matrix3 RotateYMatrix ( float  angle ) [friend]
Remarks:
Builds a new matrix for use as a Y rotation transformation.
Parameters:
angle Specifies the angle of rotation in radians.
Returns:
A new Y rotation Matrix3.
Matrix3 RotateZMatrix ( float  angle ) [friend]
Remarks:
Builds a new matrix for use as a Z rotation transformation.
Parameters:
angle Specifies the angle of rotation in radians.
Returns:
A new Z rotation Matrix3.
Matrix3 TransMatrix ( const Point3 p ) [friend]
Remarks:
Builds a new matrix for use as a translation transformation.
Parameters:
p Specifies the translation values.
Returns:
A new translation Matrix3.
Matrix3 ScaleMatrix ( const Point3 s ) [friend]
Remarks:
Builds a new matrix for use as a scale transformation.
Parameters:
s Specifies the scale values.
Returns:
A new scale Matrix3.
Matrix3 RotateYPRMatrix ( float  Yaw,
float  Pitch,
float  Roll 
) [friend]
Remarks:
Builds a new matrix for use as a rotation transformation by specifying yaw, pitch and roll angles.

This definition will depend on what our coordinate system is. This one is equivalent to:

M.IdentityMatrix();

M.RotateZ(roll);

M.RotateX(pitch);

M.RotateY(yaw);

Which presupposes Y is vertical, X is sideways, Z is forward
Parameters:
Yaw Specifies the yaw angle in radians.
Pitch Specifies the pitch angle in radians.
Roll Specifies the roll angle in radians.
Returns:
A new rotation Matrix3.
Matrix3 RotAngleAxisMatrix ( Point3 axis,
float  angle 
) [friend]
Remarks:
Builds a new matrix for use as a rotation transformation by specifying an angle and axis.
Parameters:
axis Specifies the axis of rotation. Note that this angle is expected to be normalized.
angle Specifies the angle of rotation. Note: The direction of the angle in this method is opposite of that in AngAxisFromQ().
Returns:
A new rotation Matrix3.
Matrix3 Inverse ( const Matrix3 M ) [friend]
Remarks:
Return the inverse of the matrix
Parameters:
M The matrix to compute the inverse of.
Matrix3 InverseHighPrecision ( const Matrix3 M ) [friend]
Remarks:
Return the inverse of the matrix using doubles for the intermediary results
Parameters:
M The matrix to compute the inverse of.
Point3 operator* ( const Matrix3 A,
const Point3 V 
) [friend]
Remarks:
These transform a Point3 with a Matrix3. These two versions of transforming a point with a matrix do the same thing, regardless of the order of operands (linear algebra rules notwithstanding).
Parameters:
A The matrix to transform the point with.
V The point to transform.
Returns:
The transformed Point3.
Point3 operator* ( const Point3 V,
const Matrix3 A 
) [friend]
Remarks:
These transform a Point3 with a Matrix3. These two versions of transforming a point with a matrix do the same thing, regardless of the order of operands (linear algebra rules notwithstanding).
Parameters:
V The point to transform.
A The matrix to transform the point with.
Returns:
The transformed Point3.
Point3 VectorTransform ( const Matrix3 M,
const Point3 V 
) [friend]
Remarks:
Transform the vector (Point3) with the specified matrix.
Parameters:
M The matrix to transform the vector with.
V The vector to transform.
Returns:
The transformed vector (as a Point3).
Matrix3 XFormMat ( const Matrix3 xm,
const Matrix3 m 
) [friend]
Remarks:
This method is used to build a matrix that constructs a transformation in a particular space. For example, say you have a rotation you want to apply, but you want to perform the rotation in another coordinate system. To do this, you typically transform into the space of the coordinate system, then apply the transformation, and then transform out of that coordinate system. This method constructs a matrix that does just this. It transforms matrix m so it is applied in the space of matrix xm. It returns a Matrix3 that is xm*m*Inverse(xm).
Parameters:
xm Specifies the coordinate system you want to work in.
m Specifies the transformation matrix.
Returns:
Returns a Matrix3 that is xm*m*Inverse(xm).
Point3 VectorTransform ( const Point3 V,
const Matrix3 M 
) [friend]
void MatrixMultiply ( Matrix3 outMatrix,
const Matrix3 matrixA,
const Matrix3 matrixB 
) [friend]
Remarks:
Same as Maxtrix3::operator[]. Perform matrix multiplication without additional matrix copy
Parameters:
outMatrix The result of matrixA * matrixB
matrixA First matrix to multiply
matrixB Second matrix to multiply
void Inverse ( Matrix3 outMatrix,
const Matrix3 M 
) [friend]
Remarks:
Same as Maxtrix3::Inverse. Compute the inverse of the matrix without additional matrix copy
Parameters:
outMatrix The inversed matrix.
M The matrix to compute the inverse of.

Member Data Documentation

const Matrix3 Identity [static]

An global instance of Matrix3 set to the identity.

An identity matrix has no rotation, scale or translation on it. In other words, it is a matrix that has no effect when multiplied with another matrix.
the structure of the Matrix is as follows:

[1, 0, 0]
[0, 1, 0]
[0, 0, 1]
[0, 0, 0]