3rd Eye Scene C#
3rd Eye Scene C# documentation
Tes::Maths::Matrix4 Struct Reference

A row major 4x4 transformation matrix. More...

List of all members.

Public Member Functions

Vector3 GetAxis (int index)
 Requests an axis or column from the matrix, dropping the last row.
void SetAxis (int index, Vector3 axis)
 Set an axis or column from the matrix.
void InitRotationX (float angle)
 Sets this matrix to a rotation matrix around the X axis.
void InitRotationY (float angle)
 Sets this matrix to a rotation matrix around the Y axis.
void InitRotationZ (float angle)
 Sets this matrix to a rotation matrix around the Z axis.
void InitTranslationMatrix (Vector3 trans)
 Initialise a translation matrix, no rotation or scale.
void InitRotation (float angleX, float angleY, float angleZ)
 Initialise this matrix from the given Euler angles.
void InitRotationTranslation (float angleX, float angleY, float angleZ, Vector3 trans)
 Initialise this matrix from the given Euler angles and translation.
void InitScaling (Vector3 scale)
 Initialise this matrix as a scaling matrix.
void ApplyScaling (Vector3 scaling)
 Scales the matrix basis vectors.
Vector3 RemoveScale ()
 Removes scaling from the matrix basis vectors.
void InitLookAt (Vector3 eye, Vector3 target, Vector3 axisUp, int forwardAxisIndex=1, int upAxisIndex=2)
 Initialise this matrix as a model or camera matrix.
void Transpose ()
 Transpose this matrix.
void Invert ()
 Inverse this matrix.
void RigidBodyInvert ()
 Calculate the inverse of a rigid body matrix (no skew or scaling).
Vector3 Transform (Vector3 v)
 Apply this transformation to the vector v .
Vector3 Rotate (Vector3 v)
 Transforms the vector v by the rotation component of this matrix.

Static Public Member Functions

static Matrix4 All (float val)
 Create a matrix with all components set to val .
static Matrix4 IdentityMatrix ()
 The 4x4 identity matrix.
static Matrix4 RotationX (float angle)
 Builds a rotation matrix around the X axis.
static Matrix4 RotationY (float angle)
 Sets this matrix to a rotation matrix around the Y axis.
static Matrix4 RotationZ (float angle)
 Sets this matrix to a rotation matrix around the Z axis.
static Matrix4 TranslationMatrix (Vector3 trans)
 Create a translation matrix, no rotation or scale.
static Matrix4 Rotation (float angleX, float angleY, float angleZ)
 Build a rotation matrix from the given Euler angles.
static Matrix4 RotationTranslation (float angleX, float angleY, float angleZ, Vector3 trans)
 Build a transformation matrix from the given Euler angles and translation.
static Matrix4 Scaling (Vector3 scale)
 Initialise a scaling matrix.
static Matrix4 LookAt (Vector3 eye, Vector3 target, Vector3 axisUp, int forwardAxisIndex=1, int upAxisIndex=2)
 Create a model or camera matrix at eye looking at target .
static Vector3 operator* (Matrix4 a, Vector3 v)
 Calculates the transformation Av.
static Matrix4 operator* (Matrix4 a, Matrix4 b)
 Calculates the matrix product of two 4x4 matrices.

Static Public Attributes

static Matrix4 Zero = All(0.0f)
 A matrix with all zero components.
static Matrix4 Identity = IdentityMatrix()
 The 4x4 identity matrix.

Properties

float this[int index] [get, set]
 Indexing accessor across the range [0, 15].
float this[int r, int c] [get, set]
 Row/column indexing accessor.
float Determinant [get]
 Calculate the determinant of this matrix.
Vector3 AxisX [get, set]
 Get/set the conceptual X axis from this matrix.
Vector3 AxisY [get, set]
 Get/set the conceptual Y axis from this matrix.
Vector3 AxisZ [get, set]
 Get/set the conceptual Z axis from this matrix.
Vector3 Translation [get, set]
 Get/set the conceptual translation axis from this matrix.
Vector3 Scale [get]
 Calculate the per axis scaling of this matrix.
Matrix4 Transposed [get]
 Return the transpose of this matrix.
Matrix4 Inverse [get]
 Get the inverse of this matrix.
Matrix4 RigidBodyInverse [get]
 Get the inverse of a rigid body matrix (no skew or scaling).

Detailed Description

A row major 4x4 transformation matrix.

The matrix is laid out as follows:

          | m00  m01  m02  m03 |   |  0   1   2   3 |   | xx  yx  zx  tx |
      M = | m10  m11  m12  m13 | = |  4   5   6   7 | = | xy  yy  zy  ty |
          | m20  m21  m22  m23 |   |  8   9  10  11 |   | xz  yz  zz  tz |
          | m30  m31  m32  m33 |   | 12  13  14  15 |   |  0   0   0   1 |

Where (xx, xy, xz) are the components of the X axis. Similarly, yn and zn form the Y axis and Z axis of the basis vectors respectively. Finally, (tx, ty, tz) is the translation.


Member Function Documentation

static Matrix4 Tes::Maths::Matrix4::All ( float  val) [inline, static]

Create a matrix with all components set to val .

Parameters:
valThe value to assign to each component.
Returns:
The matrix with all components val .
void Tes::Maths::Matrix4::ApplyScaling ( Vector3  scaling) [inline]

Scales the matrix basis vectors.

The translation column is left unmodified.

Parameters:
scalingPer axis scaling. Each coordinate corresponds to a column of the matrix.
Vector3 Tes::Maths::Matrix4::GetAxis ( int  index) [inline]

Requests an axis or column from the matrix, dropping the last row.

A Vector4 class is need to properly extract the whole column.

Parameters:
indexThe axis/column index [0, 3]
Returns:
The requested axis.
static Matrix4 Tes::Maths::Matrix4::IdentityMatrix ( ) [inline, static]

The 4x4 identity matrix.

Returns:
The identity matrix.
void Tes::Maths::Matrix4::InitLookAt ( Vector3  eye,
Vector3  target,
Vector3  axisUp,
int  forwardAxisIndex = 1,
int  upAxisIndex = 2 
) [inline]

Initialise this matrix as a model or camera matrix.

LookAt(Vector3, Vector3, Vector3, int, int).

Parameters:
eyeThe position of the eye/camera.
targetThe target to look at. Should not be equal to eye .
axisUpThe axis defining the initial up vector. Must be normalised.
forwardAxisIndexThe index of the forward axis. This is to point at target .
upAxisIndexThe index of the up axis. Must not be equal to forwardAxisIndex .
void Tes::Maths::Matrix4::InitRotation ( float  angleX,
float  angleY,
float  angleZ 
) [inline]

Initialise this matrix from the given Euler angles.

Parameters:
angleXThe rotation around the X axis (radians).
angleYThe rotation around the Y axis (radians).
angleZThe rotation around the Z axis (radians).
void Tes::Maths::Matrix4::InitRotationTranslation ( float  angleX,
float  angleY,
float  angleZ,
Vector3  trans 
) [inline]

Initialise this matrix from the given Euler angles and translation.

Parameters:
angleXThe rotation around the X axis (radians).
angleYThe rotation around the Y axis (radians).
angleZThe rotation around the Z axis (radians).
transThe translation component for matrix.
void Tes::Maths::Matrix4::InitRotationX ( float  angle) [inline]

Sets this matrix to a rotation matrix around the X axis.

Parameters:
angleThe rotation angle (radians)
void Tes::Maths::Matrix4::InitRotationY ( float  angle) [inline]

Sets this matrix to a rotation matrix around the Y axis.

Parameters:
angleThe rotation angle (radians)
void Tes::Maths::Matrix4::InitRotationZ ( float  angle) [inline]

Sets this matrix to a rotation matrix around the Z axis.

Parameters:
angleThe rotation angle (radians)
void Tes::Maths::Matrix4::InitScaling ( Vector3  scale) [inline]

Initialise this matrix as a scaling matrix.

Parameters:
scaleThe scaling factor. Each coordinate corresponds to one of the first three columns of the matrix.
void Tes::Maths::Matrix4::InitTranslationMatrix ( Vector3  trans) [inline]

Initialise a translation matrix, no rotation or scale.

Parameters:
transThe translation to apply.
void Tes::Maths::Matrix4::Invert ( ) [inline]

Inverse this matrix.

Undefined behaviour for singular matrices.

static Matrix4 Tes::Maths::Matrix4::LookAt ( Vector3  eye,
Vector3  target,
Vector3  axisUp,
int  forwardAxisIndex = 1,
int  upAxisIndex = 2 
) [inline, static]

Create a model or camera matrix at eye looking at target .

Supports specifying the up and forward axes (inferring the left/right axis), where the indices [0, 1, 2] correspond to the axes (X, Y, Z).

The default behaviour is to use Y as the forward axis and Z as up.

Parameters:
eyeThe position of the eye/camera.
targetThe target to look at. Should not be equal to eye .
axisUpThe axis defining the initial up vector. Must be normalised.
forwardAxisIndexThe index of the forward axis. This is to point at target .
upAxisIndexThe index of the up axis. Must not be equal to forwardAxisIndex .
Returns:
A model matrix at eye pointing at target . Returns identity if there are errors in the specification of forwardAxisIndex and upAxisIndex .
static Matrix4 Tes::Maths::Matrix4::operator* ( Matrix4  a,
Matrix4  b 
) [inline, static]

Calculates the matrix product of two 4x4 matrices.

Conceptually, when the resulting matrix transforms a vector, the matrix b is applied first, then a .

Parameters:
aA matrix operand.
bA matrix operand.
Returns:
The matrix product of a and b .
static Vector3 Tes::Maths::Matrix4::operator* ( Matrix4  a,
Vector3  v 
) [inline, static]

Calculates the transformation Av.

Parameters:
aThe transformation matrix.
vThe vector to transform.
Returns:
The matrix product Av where A is this matrix and v is the vector argument.
Vector3 Tes::Maths::Matrix4::RemoveScale ( ) [inline]

Removes scaling from the matrix basis vectors.

Returns:
The scale before modification.
void Tes::Maths::Matrix4::RigidBodyInvert ( ) [inline]

Calculate the inverse of a rigid body matrix (no skew or scaling).

Performs a matrix transpose and negates the translation.

Vector3 Tes::Maths::Matrix4::Rotate ( Vector3  v) [inline]

Transforms the vector v by the rotation component of this matrix.

No translation is applied.

Parameters:
vThe vector to rotate.
Returns:
Av, where A is this matrix converted to a 3x3 rotation matrix (no translation).

FIXME: remove scaling effects.

static Matrix4 Tes::Maths::Matrix4::Rotation ( float  angleX,
float  angleY,
float  angleZ 
) [inline, static]

Build a rotation matrix from the given Euler angles.

Parameters:
angleXThe rotation around the X axis (radians).
angleYThe rotation around the Y axis (radians).
angleZThe rotation around the Z axis (radians).
Returns:
The rotation matrix.
static Matrix4 Tes::Maths::Matrix4::RotationTranslation ( float  angleX,
float  angleY,
float  angleZ,
Vector3  trans 
) [inline, static]

Build a transformation matrix from the given Euler angles and translation.

Parameters:
angleXThe rotation around the X axis (radians).
angleYThe rotation around the Y axis (radians).
angleZThe rotation around the Z axis (radians).
transThe translation component for matrix.
Returns:
The transformation matrix.
static Matrix4 Tes::Maths::Matrix4::RotationX ( float  angle) [inline, static]

Builds a rotation matrix around the X axis.

Parameters:
angleThe rotation angle (radians)
Returns:
The rotation matrix.
static Matrix4 Tes::Maths::Matrix4::RotationY ( float  angle) [inline, static]

Sets this matrix to a rotation matrix around the Y axis.

Parameters:
angleThe rotation angle (radians)
static Matrix4 Tes::Maths::Matrix4::RotationZ ( float  angle) [inline, static]

Sets this matrix to a rotation matrix around the Z axis.

Parameters:
angleThe rotation angle (radians)
static Matrix4 Tes::Maths::Matrix4::Scaling ( Vector3  scale) [inline, static]

Initialise a scaling matrix.

Parameters:
scaleThe scaling factor. Each coordinate corresponds to a column of the matrix.
void Tes::Maths::Matrix4::SetAxis ( int  index,
Vector3  axis 
) [inline]

Set an axis or column from the matrix.

The last row is set to either zero for columns [0, 2] and 1 for column 3. A Vector4 class is need to properly set the whole column.

Parameters:
indexThe axis/column index [0, 3]
axisThe axis value.
Vector3 Tes::Maths::Matrix4::Transform ( Vector3  v) [inline]

Apply this transformation to the vector v .

Parameters:
vThe vector to transform.
Returns:
The matrix product Av where A is this matrix and v is the vector argument.
static Matrix4 Tes::Maths::Matrix4::TranslationMatrix ( Vector3  trans) [inline, static]

Create a translation matrix, no rotation or scale.

Parameters:
transThe translation to apply.
Returns:
The constructed translation matrix.

Property Documentation

Vector3 Tes::Maths::Matrix4::AxisX [get, set]

Get/set the conceptual X axis from this matrix.

This equates to column 0.

Vector3 Tes::Maths::Matrix4::AxisY [get, set]

Get/set the conceptual Y axis from this matrix.

This equates to column 1.

Vector3 Tes::Maths::Matrix4::AxisZ [get, set]

Get/set the conceptual Z axis from this matrix.

This equates to column 2.

float Tes::Maths::Matrix4::Determinant [get]

Calculate the determinant of this matrix.

Not a cheap operation.

Matrix4 Tes::Maths::Matrix4::Inverse [get]

Get the inverse of this matrix.

Undefined behaviour for singular matrices.

Matrix4 Tes::Maths::Matrix4::RigidBodyInverse [get]

Get the inverse of a rigid body matrix (no skew or scaling).

Performs a matrix transpose and negates the translation.

float Tes::Maths::Matrix4::this[int index] [get, set]

Indexing accessor across the range [0, 15].

See class documentation on the matrix layout.

Parameters:
indexThe component index [0, 15].
Returns:
The requested component.
Exceptions:
IndexOutOfRangeExceptionThrown when index is out of range.
float Tes::Maths::Matrix4::this[int r, int c] [get, set]

Row/column indexing accessor.

Valid row and column ranges are: [0, 3].

See class documentation on the matrix layout.

Parameters:
rThe row index [0, 3].
cThe column index [0, 3].
Returns:
The requested component.
Exceptions:
IndexOutOfRangeExceptionThrown when r or c are out of range.
Vector3 Tes::Maths::Matrix4::Translation [get, set]

Get/set the conceptual translation axis from this matrix.

This equates to column 3.


The documentation for this struct was generated from the following file:
 All Classes Namespaces Functions Variables Enumerations Properties Events