Main Page | Class Hierarchy | Class List | Class Members

SC::Math::Matrix4 Struct Reference

List of all members.

Public Member Functions

 Matrix4 (float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
Matrix3 GetMatrix3 ()
Matrix4 Inverse ()
Matrix4 Transpose ()
void MakeFloatArray (float[] floats)
override string ToString ()
override int GetHashCode ()
override bool Equals (object obj)

Static Public Member Functions

Matrix4 Multiply (Matrix4 left, Matrix4 right)
Matrix4 operator * (Matrix4 left, Matrix4 right)
Vector3 Multiply (Matrix4 matrix, Vector3 vector)
Vector3 operator * (Matrix4 matrix, Vector3 vector)
Matrix4 operator * (Matrix4 left, float scalar)
Matrix4 Add (Matrix4 left, Matrix4 right)
Matrix4 operator+ (Matrix4 left, Matrix4 right)
Matrix4 Subtract (Matrix4 left, Matrix4 right)
Matrix4 operator- (Matrix4 left, Matrix4 right)
bool operator== (Matrix4 left, Matrix4 right)
bool operator!= (Matrix4 left, Matrix4 right)
Matrix4 FromMatrix3 (Matrix3 right)
implicit operator Matrix4 (Matrix3 right)

Properties

Matrix4 Identity
Matrix4 Zero
Vector3 Translation
Vector3 Scale
float this [int row, int col]
float Determinant

Detailed Description

Class encapsulating a standard 4x4 homogenous matrix. The engine uses column vectors when applying matrix multiplications, This means a vector is represented as a single column, 4-row matrix. This has the effect that the tranformations implemented by the matrices happens right-to-left e.g. if vector V is to be transformed by M1 then M2 then M3, the calculation would be M3 * M2 * M1 * V. The order that matrices are concatenated is vital since matrix multiplication is not cummatative, i.e. you can get a different result if you concatenate in the wrong order. <p/> The use of column vectors and right-to-left ordering is the standard in most mathematical texts, and is the same as used in OpenGL. It is, however, the opposite of Direct3D, which has inexplicably chosen to differ from the accepted standard and uses row vectors and left-to-right matrix multiplication. <p/> The engine deals with the differences between D3D and OpenGL etc. internally when operating through different render systems. The engine users only need to conform to standard maths conventions, i.e. right-to-left matrix multiplication, (The engine transposes matrices it passes to D3D to compensate). <p/> The generic form M * V which shows the layout of the matrix entries is shown below: <p/> | m[0][0] m[0][1] m[0][2] m[0][3] | {x} | m[1][0] m[1][1] m[1][2] m[1][3] | {y} | m[2][0] m[2][1] m[2][2] m[2][3] | {z} | m[3][0] m[3][1] m[3][2] m[3][3] | {1}


Constructor & Destructor Documentation

SC::Math::Matrix4::Matrix4 float  m00,
float  m01,
float  m02,
float  m03,
float  m10,
float  m11,
float  m12,
float  m13,
float  m20,
float  m21,
float  m22,
float  m23,
float  m30,
float  m31,
float  m32,
float  m33
[inline]
 

Creates a new Matrix4 with all the specified parameters.


Member Function Documentation

Matrix4 SC::Math::Matrix4::Add Matrix4  left,
Matrix4  right
[inline, static]
 

Used to add two matrices together.

override bool SC::Math::Matrix4::Equals object  obj  )  [inline]
 

Compares this Matrix to another object. This should be done because the equality operators (==, !=) have been overriden by this class.

Matrix4 SC::Math::Matrix4::FromMatrix3 Matrix3  right  )  [inline, static]
 

Used to allow assignment from a Matrix3 to a Matrix4 object.

override int SC::Math::Matrix4::GetHashCode  )  [inline]
 

Provides a unique hash code based on the member variables of this class. This should be done because the equality operators (==, !=) have been overriden by this class. <p/> The standard implementation is a simple XOR operation between all local member variables.

Matrix3 SC::Math::Matrix4::GetMatrix3  )  [inline]
 

Returns a 3x3 portion of this 4x4 matrix.

Matrix4 SC::Math::Matrix4::Inverse  )  [inline]
 

Returns an inverted 4d matrix.

void SC::Math::Matrix4::MakeFloatArray float[]  floats  )  [inline]
 

Vector3 SC::Math::Matrix4::Multiply Matrix4  matrix,
Vector3  vector
[inline, static]
 

Transforms the given 3-D vector by the matrix, projecting the result back into w = 1. <p/> This means that the initial w is considered to be 1.0, and then all the tree elements of the resulting 3-D vector are divided by the resulting w. A Matrix4. A Vector3. A new vector.

Matrix4 SC::Math::Matrix4::Multiply Matrix4  left,
Matrix4  right
[inline, static]
 

Used to multiply (concatenate) two 4x4 Matrices.

Matrix4 SC::Math::Matrix4::operator * Matrix4  left,
float  scalar
[inline, static]
 

Used to multiply a Matrix4 object by a scalar value..

Vector3 SC::Math::Matrix4::operator * Matrix4  matrix,
Vector3  vector
[inline, static]
 

Transforms the given 3-D vector by the matrix, projecting the result back into w = 1. <p/> This means that the initial w is considered to be 1.0, and then all the tree elements of the resulting 3-D vector are divided by the resulting w. A Matrix4. A Vector3. A new vector.

Matrix4 SC::Math::Matrix4::operator * Matrix4  left,
Matrix4  right
[inline, static]
 

Used to multiply (concatenate) two 4x4 Matrices.

implicit SC::Math::Matrix4::operator Matrix4 Matrix3  right  )  [inline, static]
 

Used to allow assignment from a Matrix3 to a Matrix4 object.

bool SC::Math::Matrix4::operator!= Matrix4  left,
Matrix4  right
[inline, static]
 

Compares two Matrix4 instances for inequality. true if the Matrix 4 instances are not equal, false otherwise.

Matrix4 SC::Math::Matrix4::operator+ Matrix4  left,
Matrix4  right
[inline, static]
 

Used to add two matrices together.

Matrix4 SC::Math::Matrix4::operator- Matrix4  left,
Matrix4  right
[inline, static]
 

Used to subtract two matrices.

bool SC::Math::Matrix4::operator== Matrix4  left,
Matrix4  right
[inline, static]
 

Compares two Matrix4 instances for equality. true if the Matrix 4 instances are equal, false otherwise.

Matrix4 SC::Math::Matrix4::Subtract Matrix4  left,
Matrix4  right
[inline, static]
 

Used to subtract two matrices.

override string SC::Math::Matrix4::ToString  )  [inline]
 

Overrides the Object.ToString() method to provide a text representation of a Matrix4. A string representation of a vector3.

Matrix4 SC::Math::Matrix4::Transpose  )  [inline]
 

Swap the rows of the matrix with the columns. A transposed Matrix.


Property Documentation

float SC::Math::Matrix4::Determinant [get]
 

Gets the determinant of this matrix.

Matrix4 SC::Math::Matrix4::Identity [static, get]
 

Returns a matrix with the following form: | 1,0,0,0 | | 0,1,0,0 | | 0,0,1,0 | | 0,0,0,1 |

Vector3 SC::Math::Matrix4::Scale [get, set]
 

Gets/Sets the Translation portion of the matrix. |Sx 0 0 0 | | 0 Sy 0 0 | | 0 0 Sz 0 | | 0 0 0 0 |

float SC::Math::Matrix4::this [get, set]
 

Allows the Matrix to be accessed like a 2d array (i.e. matrix[2,3]) This indexer is only provided as a convenience, and is not recommended for use in intensive applications.

Vector3 SC::Math::Matrix4::Translation [get, set]
 

Gets/Sets the Translation portion of the matrix. | 0 0 0 Tx| | 0 0 0 Ty| | 0 0 0 Tz| | 0 0 0 1 |

Matrix4 SC::Math::Matrix4::Zero [static, get]
 

Returns a matrix with all elements set to 0.


The documentation for this struct was generated from the following file:
Generated on Sat Jan 15 23:59:00 2005 for StreamCtrl by doxygen 1.3.6