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

A row major 3x3 rotation 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 InitRotation (float angleX, float angleY, float angleZ)
 Initialise this matrix from the given Euler angles.
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.
float GetAdjoint (ref Matrix3 adj)
 Calculate the adjoint for this matrix into adj .
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 Matrix3 All (float val)
 Create a matrix with all components set to val .
static Matrix3 IdentityMatrix ()
 The 3x3 identity matrix.
static Matrix3 RotationX (float angle)
 Builds a rotation matrix around the X axis.
static Matrix3 RotationY (float angle)
 Builds a rotation matrix around the Y axis.
static Matrix3 RotationZ (float angle)
 Builds a rotation matrix around the Z axis.
static Matrix3 Rotation (float angleX, float angleY, float angleZ)
 Build a rotation matrix from the given Euler angles.
static Matrix3 Scaling (Vector3 scale)
 Initialise a scaling matrix.
static Matrix3 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* (Matrix3 a, Vector3 v)
 Calculates the rotation Av.
static Matrix3 operator* (Matrix3 a, Matrix3 b)
 Calculates the matrix product of two 3x3 matrices.

Static Public Attributes

static Matrix3 Zero = All(0.0f)
 A matrix with all zero components.
static Matrix3 Identity = IdentityMatrix()
 The 3x3 identity matrix.

Properties

float this[int index] [get, set]
 Indexing accessor across the range [0, 8].
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 Scale [get]
 Calculate the per axis scaling of this matrix.
Matrix3 Transposed [get]
 Return the transpose of this matrix.
Matrix3 Inverse [get]
 Get the inverse of this matrix.
Matrix3 RigidBodyInverse [get]
 Get the inverse of a rigid body matrix (no skew or scaling).

Detailed Description

A row major 3x3 rotation matrix.

The matrix is laid out as follows:

          | m00  m01  m02 |   |  0   1   2 |   | xx  yx  zx |
      M = | m10  m11  m12 | = |  3   4   5 | = | xy  yy  zy |
          | m20  m21  m22 |   |  6   7   8 |   | xz  yz  zz |

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 Matrix3 Tes::Maths::Matrix3::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::Matrix3::ApplyScaling ( Vector3  scaling) [inline]

Scales the matrix basis vectors.

Parameters:
scalingPer axis scaling. Each coordinate corresponds to a column of the matrix.
float Tes::Maths::Matrix3::GetAdjoint ( ref Matrix3  adj) [inline]

Calculate the adjoint for this matrix into adj .

Parameters:
adjThe matrix in which to store the result.
Returns:
The determinant of this matrix.
Vector3 Tes::Maths::Matrix3::GetAxis ( int  index) [inline]

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

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

The 3x3 identity matrix.

Returns:
The identity matrix.
void Tes::Maths::Matrix3::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::Matrix3::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::Matrix3::InitRotationX ( float  angle) [inline]

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

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

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

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

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

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

Initialise this matrix as a scaling matrix.

Parameters:
scaleThe scaling factor. Each coordinate corresponds to a column of the matrix.
void Tes::Maths::Matrix3::Invert ( ) [inline]

Inverse this matrix.

Undefined behaviour for singular matrices.

static Matrix3 Tes::Maths::Matrix3::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.

Note: the resulting matrix can only represent the rotation part of the matrix and the eye translation is essentially dropped. Use Matrix4 where the translation is required.

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 Vector3 Tes::Maths::Matrix3::operator* ( Matrix3  a,
Vector3  v 
) [inline, static]

Calculates the rotation Av.

Parameters:
aThe rotation matrix.
vThe vector to transform.
Returns:
The matrix product Av where A is this matrix and v is the vector argument.
static Matrix3 Tes::Maths::Matrix3::operator* ( Matrix3  a,
Matrix3  b 
) [inline, static]

Calculates the matrix product of two 3x3 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 .
Vector3 Tes::Maths::Matrix3::RemoveScale ( ) [inline]

Removes scaling from the matrix basis vectors.

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

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

Performs a matrix transpose.

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

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

No translation is applied.

Returns:
Av, where A is this matrix converted to a 3x3 rotation matrix (no translation).
static Matrix3 Tes::Maths::Matrix3::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 Matrix3 Tes::Maths::Matrix3::RotationX ( float  angle) [inline, static]

Builds a rotation matrix around the X axis.

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

Builds a rotation matrix around the Y axis.

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

Builds a rotation matrix around the Z axis.

Parameters:
angleThe rotation angle (radians)
Returns:
The rotation matrix.
static Matrix3 Tes::Maths::Matrix3::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::Matrix3::SetAxis ( int  index,
Vector3  axis 
) [inline]

Set an axis or column from the matrix.

Parameters:
indexThe axis/column index [0, 2]
axisThe axis value.
Vector3 Tes::Maths::Matrix3::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.

Property Documentation

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

Get/set the conceptual X axis from this matrix.

This equates to column 0.

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

Get/set the conceptual Y axis from this matrix.

This equates to column 1.

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

Get/set the conceptual Z axis from this matrix.

This equates to column 2.

Matrix3 Tes::Maths::Matrix3::Inverse [get]

Get the inverse of this matrix.

Undefined behaviour for singular matrices.

Matrix3 Tes::Maths::Matrix3::RigidBodyInverse [get]

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

Performs a matrix transpose.

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

Indexing accessor across the range [0, 8].

See class documentation on the matrix layout.

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

Row/column indexing accessor.

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

See class documentation on the matrix layout.

Parameters:
rThe row index [0, 2].
cThe column index [0, 2].
Returns:
The requested component.
Exceptions:
IndexOutOfRangeExceptionThrown when r or c are out of range.

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