3rd Eye Scene C#
3rd Eye Scene C# documentation
|
A row major 3x3 rotation matrix. More...
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). |
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.
static Matrix3 Tes::Maths::Matrix3::All | ( | float | val | ) | [inline, static] |
Create a matrix with all components set to val .
val | The value to assign to each component. |
void Tes::Maths::Matrix3::ApplyScaling | ( | Vector3 | scaling | ) | [inline] |
Scales the matrix basis vectors.
scaling | Per 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 .
adj | The matrix in which to store the result. |
Vector3 Tes::Maths::Matrix3::GetAxis | ( | int | index | ) | [inline] |
Requests an axis or column from the matrix, dropping the last row.
index | The axis/column index [0, 2] |
static Matrix3 Tes::Maths::Matrix3::IdentityMatrix | ( | ) | [inline, static] |
The 3x3 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).
eye | The position of the eye/camera. |
target | The target to look at. Should not be equal to eye . |
axisUp | The axis defining the initial up vector. Must be normalised. |
forwardAxisIndex | The index of the forward axis. This is to point at target . |
upAxisIndex | The 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.
angleX | The rotation around the X axis (radians). |
angleY | The rotation around the Y axis (radians). |
angleZ | The 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.
angle | The rotation angle (radians) |
void Tes::Maths::Matrix3::InitRotationY | ( | float | angle | ) | [inline] |
Sets this matrix to a rotation matrix around the Y axis.
angle | The rotation angle (radians) |
void Tes::Maths::Matrix3::InitRotationZ | ( | float | angle | ) | [inline] |
Sets this matrix to a rotation matrix around the Z axis.
angle | The rotation angle (radians) |
void Tes::Maths::Matrix3::InitScaling | ( | Vector3 | scale | ) | [inline] |
Initialise this matrix as a scaling matrix.
scale | The 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.
eye | The position of the eye/camera. |
target | The target to look at. Should not be equal to eye . |
axisUp | The axis defining the initial up vector. Must be normalised. |
forwardAxisIndex | The index of the forward axis. This is to point at target . |
upAxisIndex | The index of the up axis. Must not be equal to forwardAxisIndex . |
Calculates the rotation Av
.
a | The rotation matrix. |
v | The vector to transform. |
Av
where A
is this matrix and v
is the vector argument.Calculates the matrix product of two 3x3 matrices.
Conceptually, when the resulting matrix transforms a vector, the matrix b is applied first, then a .
a | A matrix operand. |
b | A matrix operand. |
Vector3 Tes::Maths::Matrix3::RemoveScale | ( | ) | [inline] |
Removes scaling from the matrix basis vectors.
void Tes::Maths::Matrix3::RigidBodyInvert | ( | ) | [inline] |
Calculate the inverse of a rigid body matrix (no skew or scaling).
Performs a matrix transpose.
Transforms the vector v by the rotation component of this matrix.
No translation is applied.
static Matrix3 Tes::Maths::Matrix3::Rotation | ( | float | angleX, |
float | angleY, | ||
float | angleZ | ||
) | [inline, static] |
Build a rotation matrix from the given Euler angles.
angleX | The rotation around the X axis (radians). |
angleY | The rotation around the Y axis (radians). |
angleZ | The rotation around the Z axis (radians). |
static Matrix3 Tes::Maths::Matrix3::RotationX | ( | float | angle | ) | [inline, static] |
Builds a rotation matrix around the X axis.
angle | The rotation angle (radians) |
static Matrix3 Tes::Maths::Matrix3::RotationY | ( | float | angle | ) | [inline, static] |
Builds a rotation matrix around the Y axis.
angle | The rotation angle (radians) |
static Matrix3 Tes::Maths::Matrix3::RotationZ | ( | float | angle | ) | [inline, static] |
Builds a rotation matrix around the Z axis.
angle | The rotation angle (radians) |
Initialise a scaling matrix.
scale | The 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.
index | The axis/column index [0, 2] |
axis | The axis value. |
Apply this transformation to the vector v .
v | The vector to transform. |
Av
where A
is this matrix and v
is the vector argument.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.
index | The component index [0, 8]. |
IndexOutOfRangeException | Thrown 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.
r | The row index [0, 2]. |
c | The column index [0, 2]. |
IndexOutOfRangeException | Thrown when r or c are out of range. |