_Matrix4< TYPE > Class Template Reference

#include <matrix4.h>

Detailed Description

template<class TYPE>
class _Matrix4< TYPE >

Generic four-by-four matrix mathematics. Can be used with the four-element vector _Vector4.

See also
Matrix for the standard matrix class.

Public Member Functions

 _Matrix4 (_DONTCONSTRUCT dc)
 
 _Matrix4 ()
 
 _Matrix4 (TYPE m00, TYPE m01, TYPE m02, TYPE m03, TYPE m10, TYPE m11, TYPE m12, TYPE m13, TYPE m20, TYPE m21, TYPE m22, TYPE m23, TYPE m30, TYPE m31, TYPE m32, TYPE m33)
 
 _Matrix4 (TYPE *p)
 
 _Matrix4 (const _Matrix4 &m)
 
 _Matrix4 (const Matrix32 &m)
 
 _Matrix4 (const Matrix64 &m)
 
Matrix32 GetSMatrix ()
 
Matrix64 GetLMatrix ()
 
_Matrix4 GetTranspose () const
 
void SetZero ()
 
void SetOffset (const Vector &v)
 
void Scale (TYPE r)
 
void ScaleDirections (TYPE r)
 
Bool IsInvertable ()
 

Public Attributes

union {
   struct {
      TYPE   _00
 
      TYPE   _01
 
      TYPE   _02
 
      TYPE   _03
 
      TYPE   _10
 
      TYPE   _11
 
      TYPE   _12
 
      TYPE   _13
 
      TYPE   _20
 
      TYPE   _21
 
      TYPE   _22
 
      TYPE   _23
 
      TYPE   _30
 
      TYPE   _31
 
      TYPE   _32
 
      TYPE   _33
 
   } 
 
   TYPE   m_prElements [4][4]
 
   TYPE   m_prArray [16]
 
}; 
 

Static Private Member Functions

static TYPE Det (TYPE a1, TYPE a2, TYPE a3, TYPE b1, TYPE b2, TYPE b3, TYPE c1, TYPE c2, TYPE c3)
 

Friends

const _Matrix4 operator* (const _Matrix4 &m1, const _Matrix4 &m2)
 
const Vector4d64 operator* (const _Matrix4 &m, const Vector4d64 &v)
 
const Vector4d32 operator* (const _Matrix4 &m, const Vector4d32 &v)
 
const Vector32 operator* (const _Matrix4 &m, const Vector32 &v)
 
const Vector64 operator* (const _Matrix4 &m, const Vector64 &v)
 
const _Matrix4 operator! (const _Matrix4 &m)
 
const _Matrix4 operator* (const TYPE s, const _Matrix4 &m)
 
Bool operator== (const _Matrix4 &a, const _Matrix4 &b)
 
Bool operator!= (const _Matrix4 &a, const _Matrix4 &b)
 

Constructor & Destructor Documentation

§ _Matrix4() [1/7]

_Matrix4 ( _DONTCONSTRUCT  dc)
explicit

Creates an uninitialized matrix.

Parameters
[in]dcDummy argument. Pass DC.

§ _Matrix4() [2/7]

_Matrix4 ( )

Default constructor. Creates a unit matrix.

§ _Matrix4() [3/7]

_Matrix4 ( TYPE  m00,
TYPE  m01,
TYPE  m02,
TYPE  m03,
TYPE  m10,
TYPE  m11,
TYPE  m12,
TYPE  m13,
TYPE  m20,
TYPE  m21,
TYPE  m22,
TYPE  m23,
TYPE  m30,
TYPE  m31,
TYPE  m32,
TYPE  m33 
)

Creates a matrix from the given parameters.

Parameters
[in]m00The first row first column element.
[in]m01The first row second column element.
[in]m02The first row third column element.
[in]m03The first row fourth column element.
[in]m10The second row first column element.
[in]m11The second row second column element.
[in]m12The second row third column element.
[in]m13The second row fourth column element.
[in]m20The third row first column element.
[in]m21The third row second column element.
[in]m22The third row third column element.
[in]m23The third row fourth column element.
[in]m30The fourth row first column element.
[in]m31The fourth row second column element.
[in]m32The fourth row third column element.
[in]m33The fourth row fourth column element.

§ _Matrix4() [4/7]

_Matrix4 ( TYPE *  p)
explicit

Creates a matrix from the 4x4 array p.

Parameters
[in]pAn array with 16 values to set matrix's components.

§ _Matrix4() [5/7]

_Matrix4 ( const _Matrix4< TYPE > &  m)

Copy constructor.

Parameters
[in]mThe matrix to copy.

§ _Matrix4() [6/7]

_Matrix4 ( const Matrix32 m)
explicit

Creates a matrix from the standard Matrix32.

Parameters
[in]mThe standard Matrix32 to copy.

§ _Matrix4() [7/7]

_Matrix4 ( const Matrix64 m)
explicit

Creates a matrix from the standard Matrix64.

Parameters
[in]mThe standard Matrix64 to copy.

Member Function Documentation

§ GetSMatrix()

Matrix32 GetSMatrix ( )

Gets the matrix as regular single-precision matrix.

Returns
The matrix converted to a Matrix32.

§ GetLMatrix()

Matrix64 GetLMatrix ( )

Gets the matrix as regular double-precision matrix.

Returns
The matrix converted to a Matrix64.

§ GetTranspose()

_Matrix4 GetTranspose ( ) const

Gets the matrix's transpose.

Returns
The matrix's transpose.

§ SetZero()

void SetZero ( )

Sets all matrix components to zero.

§ SetOffset()

void SetOffset ( const Vector v)

Sets the translation vector for the matrix.

Parameters
[in]vThe translation vector.

§ Scale()

void Scale ( TYPE  r)

Divides the component 33 of the matrix by r. Used for scaling when working with vectors and matrices.

Parameters
[in]rThe scale factor.

§ ScaleDirections()

void ScaleDirections ( TYPE  r)

Multiplies the 3x3 matrix components by the scalar r.

Parameters
[in]rThe scale factor.

§ IsInvertable()

Bool IsInvertable ( )

Checks if the matrix can be inverted.

Returns
true if the matrix can be inverted, otherwise false.

§ Det()

static TYPE Det ( TYPE  a1,
TYPE  a2,
TYPE  a3,
TYPE  b1,
TYPE  b2,
TYPE  b3,
TYPE  c1,
TYPE  c2,
TYPE  c3 
)
staticprivate

Friends And Related Function Documentation

§ operator* [1/6]

const _Matrix4 operator* ( const _Matrix4< TYPE > &  m1,
const _Matrix4< TYPE > &  m2 
)
friend

Multiplies the 2 matrices.

Parameters
[in]m1The first matrix.
[in]m2The second matrix.
Returns
The result of the matrix multiplication.

§ operator* [2/6]

const Vector4d64 operator* ( const _Matrix4< TYPE > &  m,
const Vector4d64 v 
)
friend

Transforms the vector v by the matrix.

Parameters
[in]mThe matrix.
[in]vThe vector.
Returns
The vector v transformed by the matrix.

§ operator* [3/6]

const Vector4d32 operator* ( const _Matrix4< TYPE > &  m,
const Vector4d32 v 
)
friend

Transforms the vector v by the matrix.

Parameters
[in]mThe matrix.
[in]vThe vector.
Returns
The vector v transformed by the matrix.

§ operator* [4/6]

const Vector32 operator* ( const _Matrix4< TYPE > &  m,
const Vector32 v 
)
friend

Transforms the vector v by the matrix.

Parameters
[in]mThe matrix.
[in]vThe vector.
Returns
The vector v transformed by the matrix.

§ operator* [5/6]

const Vector64 operator* ( const _Matrix4< TYPE > &  m,
const Vector64 v 
)
friend

Transforms the vector v by the matrix.

Parameters
[in]mThe matrix.
[in]vThe vector.
Returns
The vector v transformed by the matrix.

§ operator!

const _Matrix4 operator! ( const _Matrix4< TYPE > &  m)
friend

Gets the matrix's inverse.

Parameters
[in]mThe matrix.
Returns
The matrix's inverse.

§ operator* [6/6]

const _Matrix4 operator* ( const TYPE  s,
const _Matrix4< TYPE > &  m 
)
friend

Multiplies the matrix components by a scalar.

Parameters
[in]sThe scalar.
[in]mThe matrix.
Returns
The result of the multiplication.

§ operator==

Bool operator== ( const _Matrix4< TYPE > &  a,
const _Matrix4< TYPE > &  b 
)
friend

Equality operator. Checks if the 2 matrices are equal.

Parameters
[in]aThe first matrix.
[in]bThe second matrix.
Returns
true if the 2 matrices are equal, otherwise false.

§ operator!=

Bool operator!= ( const _Matrix4< TYPE > &  a,
const _Matrix4< TYPE > &  b 
)
friend

Inequality operator. Checks if the 2 matrices are not equal.

Parameters
[in]aThe first matrix.
[in]bThe second matrix.
Returns
true if the 2 matrices are not equal, otherwise false.

Member Data Documentation

§ _00

TYPE _00

The first row first column element.

§ _01

TYPE _01

The first row second column element.

§ _02

TYPE _02

The first row third column element.

§ _03

TYPE _03

The first row fourth column element.

§ _10

TYPE _10

The second row first column element.

§ _11

TYPE _11

The second row second column element.

§ _12

TYPE _12

The second row third column element.

§ _13

TYPE _13

The second row fourth column element.

§ _20

TYPE _20

The third row first column element.

§ _21

TYPE _21

The third row second column element.

§ _22

TYPE _22

The third row third column element.

§ _23

TYPE _23

The third row fourth column element.

§ _30

TYPE _30

The fourth row first column element.

§ _31

TYPE _31

The fourth row second column element.

§ _32

TYPE _32

The fourth row third column element.

§ _33

TYPE _33

The fourth row fourth column element.

§ m_prElements

TYPE m_prElements[4][4]

4x4 component array.

§ m_prArray

TYPE m_prArray[16]

16 elements component array.

§ @965

union { ... }