The Open Toolkit library
1.0
|
Represents a 3x3 matrix containing 3D rotation and scale. More...
Inherits IEquatable< Matrix3 >.
Public Member Functions | |
Matrix3 (Vector3 row0, Vector3 row1, Vector3 row2) | |
Constructs a new instance. More... | |
Matrix3 (float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22) | |
Constructs a new instance. More... | |
Matrix3 (Matrix4 matrix) | |
Constructs a new instance. More... | |
void | Invert () |
Converts this instance into its inverse. More... | |
void | Transpose () |
Converts this instance into its transpose. More... | |
Matrix3 | Normalized () |
Returns a normalised copy of this instance. More... | |
void | Normalize () |
Divides each element in the Matrix by the Determinant. More... | |
Matrix3 | Inverted () |
Returns an inverted copy of this instance. More... | |
Matrix3 | ClearScale () |
Returns a copy of this Matrix3 without scale. More... | |
Matrix3 | ClearRotation () |
Returns a copy of this Matrix3 without rotation. More... | |
Vector3 | ExtractScale () |
Returns the scale component of this instance. More... | |
Quaternion | ExtractRotation (bool row_normalise=true) |
Returns the rotation component of this instance. Quite slow. More... | |
override string | ToString () |
Returns a System.String that represents the current Matrix3d. More... | |
override int | GetHashCode () |
Returns the hashcode for this instance. More... | |
override bool | Equals (object obj) |
Indicates whether this instance and a specified object are equal. More... | |
bool | Equals (Matrix3 other) |
Indicates whether the current matrix is equal to another matrix. More... | |
Static Public Member Functions | |
static void | CreateFromAxisAngle (Vector3 axis, float angle, out Matrix3 result) |
Build a rotation matrix from the specified axis/angle rotation. More... | |
static Matrix3 | CreateFromAxisAngle (Vector3 axis, float angle) |
Build a rotation matrix from the specified axis/angle rotation. More... | |
static void | CreateFromQuaternion (ref Quaternion q, out Matrix3 result) |
Build a rotation matrix from the specified quaternion. More... | |
static Matrix3 | CreateFromQuaternion (Quaternion q) |
Build a rotation matrix from the specified quaternion. More... | |
static void | CreateRotationX (float angle, out Matrix3 result) |
Builds a rotation matrix for a rotation around the x-axis. More... | |
static Matrix3 | CreateRotationX (float angle) |
Builds a rotation matrix for a rotation around the x-axis. More... | |
static void | CreateRotationY (float angle, out Matrix3 result) |
Builds a rotation matrix for a rotation around the y-axis. More... | |
static Matrix3 | CreateRotationY (float angle) |
Builds a rotation matrix for a rotation around the y-axis. More... | |
static void | CreateRotationZ (float angle, out Matrix3 result) |
Builds a rotation matrix for a rotation around the z-axis. More... | |
static Matrix3 | CreateRotationZ (float angle) |
Builds a rotation matrix for a rotation around the z-axis. More... | |
static Matrix3 | CreateScale (float scale) |
Creates a scale matrix. More... | |
static Matrix3 | CreateScale (Vector3 scale) |
Creates a scale matrix. More... | |
static Matrix3 | CreateScale (float x, float y, float z) |
Creates a scale matrix. More... | |
static void | CreateScale (float scale, out Matrix3 result) |
Creates a scale matrix. More... | |
static void | CreateScale (ref Vector3 scale, out Matrix3 result) |
Creates a scale matrix. More... | |
static void | CreateScale (float x, float y, float z, out Matrix3 result) |
Creates a scale matrix. More... | |
static Matrix3 | Mult (Matrix3 left, Matrix3 right) |
Multiplies two instances. More... | |
static void | Mult (ref Matrix3 left, ref Matrix3 right, out Matrix3 result) |
Multiplies two instances. More... | |
static void | Invert (ref Matrix3 mat, out Matrix3 result) |
Calculate the inverse of the given matrix More... | |
static Matrix3 | Invert (Matrix3 mat) |
Calculate the inverse of the given matrix More... | |
static Matrix3 | Transpose (Matrix3 mat) |
Calculate the transpose of the given matrix More... | |
static void | Transpose (ref Matrix3 mat, out Matrix3 result) |
Calculate the transpose of the given matrix More... | |
static Matrix3 | operator* (Matrix3 left, Matrix3 right) |
Matrix multiplication More... | |
static bool | operator== (Matrix3 left, Matrix3 right) |
Compares two instances for equality. More... | |
static bool | operator!= (Matrix3 left, Matrix3 right) |
Compares two instances for inequality. More... | |
Public Attributes | |
Vector3 | Row0 |
First row of the matrix. More... | |
Vector3 | Row1 |
Second row of the matrix. More... | |
Vector3 | Row2 |
Third row of the matrix. More... | |
Static Public Attributes | |
static readonly Matrix3 | Identity = new Matrix3(Vector3.UnitX, Vector3.UnitY, Vector3.UnitZ) |
The identity matrix. More... | |
static readonly Matrix3 | Zero = new Matrix3(Vector3.Zero, Vector3.Zero, Vector3.Zero) |
The zero matrix. More... | |
Properties | |
float | Determinant [get] |
Gets the determinant of this matrix. More... | |
Vector3 | Column0 [get] |
Gets the first column of this matrix. More... | |
Vector3 | Column1 [get] |
Gets the second column of this matrix. More... | |
Vector3 | Column2 [get] |
Gets the third column of this matrix. More... | |
float | M11 [get, set] |
Gets or sets the value at row 1, column 1 of this instance. More... | |
float | M12 [get, set] |
Gets or sets the value at row 1, column 2 of this instance. More... | |
float | M13 [get, set] |
Gets or sets the value at row 1, column 3 of this instance. More... | |
float | M21 [get, set] |
Gets or sets the value at row 2, column 1 of this instance. More... | |
float | M22 [get, set] |
Gets or sets the value at row 2, column 2 of this instance. More... | |
float | M23 [get, set] |
Gets or sets the value at row 2, column 3 of this instance. More... | |
float | M31 [get, set] |
Gets or sets the value at row 3, column 1 of this instance. More... | |
float | M32 [get, set] |
Gets or sets the value at row 3, column 2 of this instance. More... | |
float | M33 [get, set] |
Gets or sets the value at row 3, column 3 of this instance. More... | |
Vector3 | Diagonal [get, set] |
Gets or sets the values along the main diagonal of the matrix. More... | |
float | Trace [get] |
Gets the trace of the matrix, the sum of the values along the diagonal. More... | |
float | this[int rowIndex, int columnIndex] [get, set] |
Gets or sets the value at a specified row and column. More... | |
Represents a 3x3 matrix containing 3D rotation and scale.
Constructs a new instance.
row0 | Top row of the matrix |
row1 | Second row of the matrix |
row2 | Bottom row of the matrix |
OpenTK.Matrix3.Matrix3 | ( | float | m00, |
float | m01, | ||
float | m02, | ||
float | m10, | ||
float | m11, | ||
float | m12, | ||
float | m20, | ||
float | m21, | ||
float | m22 | ||
) |
Constructs a new instance.
m00 | First item of the first row of the matrix. |
m01 | Second item of the first row of the matrix. |
m02 | Third item of the first row of the matrix. |
m10 | First item of the second row of the matrix. |
m11 | Second item of the second row of the matrix. |
m12 | Third item of the second row of the matrix. |
m20 | First item of the third row of the matrix. |
m21 | Second item of the third row of the matrix. |
m22 | Third item of the third row of the matrix. |
OpenTK.Matrix3.Matrix3 | ( | Matrix4 | matrix | ) |
Constructs a new instance.
matrix | A Matrix4 to take the upper-left 3x3 from. |
|
static |
Build a rotation matrix from the specified axis/angle rotation.
axis | The axis to rotate about. |
angle | Angle in radians to rotate counter-clockwise (looking in the direction of the given axis). |
result | A matrix instance. |
Build a rotation matrix from the specified axis/angle rotation.
axis | The axis to rotate about. |
angle | Angle in radians to rotate counter-clockwise (looking in the direction of the given axis). |
|
static |
Build a rotation matrix from the specified quaternion.
q | Quaternion to translate. |
result | Matrix result. |
|
static |
Build a rotation matrix from the specified quaternion.
q | Quaternion to translate. |
|
static |
Builds a rotation matrix for a rotation around the x-axis.
angle | The counter-clockwise angle in radians. |
result | The resulting Matrix3 instance. |
|
static |
Builds a rotation matrix for a rotation around the x-axis.
angle | The counter-clockwise angle in radians. |
|
static |
Builds a rotation matrix for a rotation around the y-axis.
angle | The counter-clockwise angle in radians. |
result | The resulting Matrix3 instance. |
|
static |
Builds a rotation matrix for a rotation around the y-axis.
angle | The counter-clockwise angle in radians. |
|
static |
Builds a rotation matrix for a rotation around the z-axis.
angle | The counter-clockwise angle in radians. |
result | The resulting Matrix3 instance. |
|
static |
Builds a rotation matrix for a rotation around the z-axis.
angle | The counter-clockwise angle in radians. |
|
static |
Creates a scale matrix.
scale | Single scale factor for the x, y, and z axes. |
Creates a scale matrix.
scale | Scale factors for the x, y, and z axes. |
|
static |
Creates a scale matrix.
x | Scale factor for the x axis. |
y | Scale factor for the y axis. |
z | Scale factor for the z axis. |
|
static |
Creates a scale matrix.
scale | Single scale factor for the x, y, and z axes. |
result | A scale matrix. |
Creates a scale matrix.
scale | Scale factors for the x, y, and z axes. |
result | A scale matrix. |
|
static |
Creates a scale matrix.
x | Scale factor for the x axis. |
y | Scale factor for the y axis. |
z | Scale factor for the z axis. |
result | A scale matrix. |
override bool OpenTK.Matrix3.Equals | ( | object | obj | ) |
Indicates whether this instance and a specified object are equal.
obj | The object to compare to. |
bool OpenTK.Matrix3.Equals | ( | Matrix3 | other | ) |
Indicates whether the current matrix is equal to another matrix.
other | A matrix to compare with this matrix. |
Quaternion OpenTK.Matrix3.ExtractRotation | ( | bool | row_normalise = true | ) |
Returns the rotation component of this instance. Quite slow.
row_normalise | Whether the method should row-normalise (i.e. remove scale from) the Matrix. Pass false if you know it's already normalised. |
Vector3 OpenTK.Matrix3.ExtractScale | ( | ) |
Returns the scale component of this instance.
override int OpenTK.Matrix3.GetHashCode | ( | ) |
Returns the hashcode for this instance.
void OpenTK.Matrix3.Invert | ( | ) |
Converts this instance into its inverse.
Calculate the inverse of the given matrix
mat | The matrix to invert |
result | The inverse of the given matrix if it has one, or the input if it is singular |
InvalidOperationException | Thrown if the Matrix3 is singular. |
Calculate the inverse of the given matrix
mat | The matrix to invert |
InvalidOperationException | Thrown if the Matrix4 is singular. |
Matrix3 OpenTK.Matrix3.Inverted | ( | ) |
Returns an inverted copy of this instance.
Multiplies two instances.
left | The left operand of the multiplication. |
right | The right operand of the multiplication. |
Multiplies two instances.
left | The left operand of the multiplication. |
right | The right operand of the multiplication. |
result | A new instance that is the result of the multiplication |
void OpenTK.Matrix3.Normalize | ( | ) |
Divides each element in the Matrix by the Determinant.
Matrix3 OpenTK.Matrix3.Normalized | ( | ) |
Returns a normalised copy of this instance.
Compares two instances for inequality.
left | The first instance. |
right | The second instance. |
Matrix multiplication
left | left-hand operand |
right | right-hand operand |
Compares two instances for equality.
left | The first instance. |
right | The second instance. |
override string OpenTK.Matrix3.ToString | ( | ) |
Returns a System.String that represents the current Matrix3d.
void OpenTK.Matrix3.Transpose | ( | ) |
Converts this instance into its transpose.
Calculate the transpose of the given matrix
mat | The matrix to transpose |
Calculate the transpose of the given matrix
mat | The matrix to transpose |
result | The result of the calculation |
|
static |
The identity matrix.
Vector3 OpenTK.Matrix3.Row0 |
First row of the matrix.
Vector3 OpenTK.Matrix3.Row1 |
Second row of the matrix.
Vector3 OpenTK.Matrix3.Row2 |
Third row of the matrix.
The zero matrix.
|
get |
Gets the first column of this matrix.
|
get |
Gets the second column of this matrix.
|
get |
Gets the third column of this matrix.
|
get |
Gets the determinant of this matrix.
|
getset |
Gets or sets the values along the main diagonal of the matrix.
|
getset |
Gets or sets the value at row 1, column 1 of this instance.
|
getset |
Gets or sets the value at row 1, column 2 of this instance.
|
getset |
Gets or sets the value at row 1, column 3 of this instance.
|
getset |
Gets or sets the value at row 2, column 1 of this instance.
|
getset |
Gets or sets the value at row 2, column 2 of this instance.
|
getset |
Gets or sets the value at row 2, column 3 of this instance.
|
getset |
Gets or sets the value at row 3, column 1 of this instance.
|
getset |
Gets or sets the value at row 3, column 2 of this instance.
|
getset |
Gets or sets the value at row 3, column 3 of this instance.
|
getset |
Gets or sets the value at a specified row and column.
|
get |
Gets the trace of the matrix, the sum of the values along the diagonal.