Struct Matrix3x3
Represents a 3x3 matrix. Assimp docs say their matrices are always row-major, and it looks like they're only describing the memory layout. Matrices are treated as column vectors however (X base in the first column, Y base the second, and Z base the third)
Implements
Inherited Members
Namespace: SharpAssimp
Assembly: SharpAssimp.dll
Syntax
public record struct Matrix3x3 : IEquatable<Matrix3x3>
Constructors
| Edit this page View SourceMatrix3x3(Matrix4x4)
Constructs a new Matrix3x3.
Declaration
public Matrix3x3(Matrix4x4 rotMatrix)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x4 | rotMatrix | A 4x4 matrix to construct from, only taking the rotation/scaling part. |
Matrix3x3(float, float, float, float, float, float, float, float, float)
Represents a 3x3 matrix. Assimp docs say their matrices are always row-major, and it looks like they're only describing the memory layout. Matrices are treated as column vectors however (X base in the first column, Y base the second, and Z base the third)
Declaration
public Matrix3x3(float A1, float A2, float A3, float B1, float B2, float B3, float C1, float C2, float C3)
Parameters
Type | Name | Description |
---|---|---|
float | A1 | Value at row 1, column 1 of the matrix. |
float | A2 | Value at row 1, column 2 of the matrix. |
float | A3 | Value at row 1, column 3 of the matrix. |
float | B1 | Value at row 2, column 1 of the matrix. |
float | B2 | Value at row 2, column 2 of the matrix. |
float | B3 | Value at row 2, column 3 of the matrix. |
float | C1 | Value at row 3, column 1 of the matrix. |
float | C2 | Value at row 3, column 2 of the matrix. |
float | C3 | Value at row 3, column 3 of the matrix. |
Properties
| Edit this page View SourceA1
Value at row 1, column 1 of the matrix.
Declaration
public float A1 { readonly get; set; }
Property Value
Type | Description |
---|---|
float |
A2
Value at row 1, column 2 of the matrix.
Declaration
public float A2 { readonly get; set; }
Property Value
Type | Description |
---|---|
float |
A3
Value at row 1, column 3 of the matrix.
Declaration
public float A3 { readonly get; set; }
Property Value
Type | Description |
---|---|
float |
B1
Value at row 2, column 1 of the matrix.
Declaration
public float B1 { readonly get; set; }
Property Value
Type | Description |
---|---|
float |
B2
Value at row 2, column 2 of the matrix.
Declaration
public float B2 { readonly get; set; }
Property Value
Type | Description |
---|---|
float |
B3
Value at row 2, column 3 of the matrix.
Declaration
public float B3 { readonly get; set; }
Property Value
Type | Description |
---|---|
float |
C1
Value at row 3, column 1 of the matrix.
Declaration
public float C1 { readonly get; set; }
Property Value
Type | Description |
---|---|
float |
C2
Value at row 3, column 2 of the matrix.
Declaration
public float C2 { readonly get; set; }
Property Value
Type | Description |
---|---|
float |
C3
Value at row 3, column 3 of the matrix.
Declaration
public float C3 { readonly get; set; }
Property Value
Type | Description |
---|---|
float |
Identity
Gets the identity matrix.
Declaration
public static Matrix3x3 Identity { get; }
Property Value
Type | Description |
---|---|
Matrix3x3 |
IsIdentity
Gets if this matrix is an identity matrix.
Declaration
public bool IsIdentity { get; }
Property Value
Type | Description |
---|---|
bool |
this[int, int]
Gets or sets the value at the specific one-based row, column index. E.g. i = 1, j = 2 gets the value in row 1, column 2 (MA2). Indices out of range return a value of zero.
Declaration
public float this[int i, int j] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
int | i | One-based Row index |
int | j | One-based Column index |
Property Value
Type | Description |
---|---|
float | Matrix value |
Methods
| Edit this page View SourceDeterminant()
Compute the determinant of this matrix.
Declaration
public float Determinant()
Returns
Type | Description |
---|---|
float | The determinant |
FromAngleAxis(float, Vector3)
Creates a rotation matrix for a rotation about an arbitrary axis.
Declaration
public static Matrix3x3 FromAngleAxis(float radians, Vector3 axis)
Parameters
Type | Name | Description |
---|---|---|
float | radians | Rotation angle, in radians |
Vector3 | axis | Rotation axis, which should be a normalized vector. |
Returns
Type | Description |
---|---|
Matrix3x3 | The rotation matrix |
FromEulerAnglesXYZ(Vector3)
Creates a rotation matrix from a set of euler angles.
Declaration
public static Matrix3x3 FromEulerAnglesXYZ(Vector3 angles)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | angles | Vector containing the rotation angles about the x, y, z axes, in radians. |
Returns
Type | Description |
---|---|
Matrix3x3 | The rotation matrix |
FromEulerAnglesXYZ(float, float, float)
Creates a rotation matrix from a set of euler angles.
Declaration
public static Matrix3x3 FromEulerAnglesXYZ(float x, float y, float z)
Parameters
Type | Name | Description |
---|---|---|
float | x | Rotation angle about the x-axis, in radians. |
float | y | Rotation angle about the y-axis, in radians. |
float | z | Rotation angle about the z-axis, in radians. |
Returns
Type | Description |
---|---|
Matrix3x3 | The rotation matrix |
FromRotationX(float)
Creates a rotation matrix for a rotation about the x-axis.
Declaration
public static Matrix3x3 FromRotationX(float radians)
Parameters
Type | Name | Description |
---|---|---|
float | radians | Rotation angle in radians. |
Returns
Type | Description |
---|---|
Matrix3x3 | The rotation matrix |
FromRotationY(float)
Creates a rotation matrix for a rotation about the y-axis.
Declaration
public static Matrix3x3 FromRotationY(float radians)
Parameters
Type | Name | Description |
---|---|---|
float | radians | Rotation angle in radians. |
Returns
Type | Description |
---|---|
Matrix3x3 | The rotation matrix |
FromRotationZ(float)
Creates a rotation matrix for a rotation about the z-axis.
Declaration
public static Matrix3x3 FromRotationZ(float radians)
Parameters
Type | Name | Description |
---|---|---|
float | radians | Rotation angle in radians. |
Returns
Type | Description |
---|---|
Matrix3x3 | The rotation matrix |
FromScaling(Vector3)
Creates a scaling matrix.
Declaration
public static Matrix3x3 FromScaling(Vector3 scaling)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | scaling | Scaling vector |
Returns
Type | Description |
---|---|
Matrix3x3 | The scaling vector |
FromToMatrix(Vector3, Vector3)
Creates a rotation matrix that rotates a vector called "from" into another vector called "to". Based on an algorithm by Tomas Moller and John Hudges:
"Efficiently Building a Matrix to Rotate One Vector to Another" Journal of Graphics Tools, 4(4):1-4, 1999
Declaration
public static Matrix3x3 FromToMatrix(Vector3 from, Vector3 to)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | from | Starting vector |
Vector3 | to | Ending vector |
Returns
Type | Description |
---|---|
Matrix3x3 | Rotation matrix to rotate from the start to end. |
Inverse()
Inverts the matrix. If the matrix is not invertible all elements are set to NaN.
Declaration
public void Inverse()
ToString()
Returns a string that represents this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents this instance. |
Overrides
| Edit this page View SourceTransform(Vector3)
Performs matrix-vector multiplication identical to the way Assimp does it.
Declaration
public Vector3 Transform(Vector3 v)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | v | Vector to transform |
Returns
Type | Description |
---|---|
Vector3 | Transformed vector |
Transpose()
Transposes this matrix (rows become columns, vice versa).
Declaration
public void Transpose()
Operators
| Edit this page View Sourceimplicit operator Matrix4x4(Matrix3x3)
Implicit conversion from a 3x3 matrix to a 4x4 matrix.
Declaration
public static implicit operator Matrix4x4(Matrix3x3 mat)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x3 | mat | 3x3 matrix |
Returns
Type | Description |
---|---|
Matrix4x4 | 4x4 matrix |
implicit operator Matrix3x3(Matrix4x4)
Implicit conversion from a 4x4 matrix to a 3x3 matrix.
Declaration
public static implicit operator Matrix3x3(Matrix4x4 mat)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x4 | mat | 4x4 matrix |
Returns
Type | Description |
---|---|
Matrix3x3 | 3x3 matrix |
operator *(Matrix3x3, Matrix3x3)
Performs matrix multiplication.Multiplication order is B x A. That way, SRT concatenations are left to right.
Declaration
public static Matrix3x3 operator *(Matrix3x3 a, Matrix3x3 b)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x3 | a | First matrix |
Matrix3x3 | b | Second matrix |
Returns
Type | Description |
---|---|
Matrix3x3 | Multiplied matrix |