Matrix4x4f
Summary
Represents a 4x4 single-precision floating-point matrix arranged in row-major layout, commonly utilised for 3D affine transformations.
Definition
Namespace: SDT4.Managed.Core.Math
Assembly: SDT4.Managed.Core.dll
struct Matrix4x4f
Implements:
IMatrixSpatial<Single, Vector4f, Matrix4x4f>, ISerializable, IEquatable<Matrix4x4f>
Fields
| Name | Type | Description |
|---|---|---|
public m00 |
Single | Value at row 0, column 0. |
public m01 |
Single | Value at row 0, column 1. |
public m02 |
Single | Value at row 0, column 2. |
public m03 |
Single | Value at row 0, column 3. |
public m10 |
Single | Value at row 1, column 0. |
public m11 |
Single | Value at row 1, column 1. |
public m12 |
Single | Value at row 1, column 2. |
public m13 |
Single | Value at row 1, column 3. |
public m20 |
Single | Value at row 2, column 0. |
public m21 |
Single | Value at row 2, column 1. |
public m22 |
Single | Value at row 2, column 2. |
public m23 |
Single | Value at row 2, column 3. |
public m30 |
Single | Value at row 3, column 0. |
public m31 |
Single | Value at row 3, column 1. |
public m32 |
Single | Value at row 3, column 2. |
public m33 |
Single | Value at row 3, column 3. |
Properties
| Name | Type | Description |
|---|---|---|
public static get; Zero |
Matrix4x4f | Gets a 4x4 matrix with all elements set to zero. |
public static get; Identity |
Matrix4x4f | Gets the 4x4 multiplicative identity matrix. |
public get; Item |
Single | Gets the element at the specified row and column indices. |
public get; Item |
Vector4f | Gets the row vector at the specified index. |
public get; IsOrthoNormal |
Boolean | Gets a value indicating whether all 4 basis vectors are mutually orthogonal and normalised to unit length. |
public get; IsOrthoNormal3x3 |
Boolean | Gets a value indicating whether the upper-left 3x3 rotational submatrix is orthonormal. |
Methods
public static Matrix4x4f FromColumns(Vector4f col0, Vector4f col1, Vector4f col2, Vector4f col3)
Summary: Constructs a 4x4 matrix from column vectors.
Parameters:
-
col0(Vector4f): The first column vector. -
col1(Vector4f): The second column vector. -
col2(Vector4f): The third column vector. -
col3(Vector4f): The fourth column vector.
Returns:
- Matrix4x4f: A matrix containing the column vectors.
public static Matrix4x4f FromRows(Vector4f row0, Vector4f row1, Vector4f row2, Vector4f row3)
Summary: Constructs a 4x4 matrix from row vectors.
Parameters:
-
row0(Vector4f): The first row vector. -
row1(Vector4f): The second row vector. -
row2(Vector4f): The third row vector. -
row3(Vector4f): The fourth row vector.
Returns:
- Matrix4x4f: A matrix containing the row vectors.
public Vector4f GetColumn(Int32 col)
Summary: Retrieves the column vector at the specified index.
Parameters:
col(Int32): The zero-based column index (0 to 3).
Returns:
- Vector4f: The column vector.
public Vector4f GetRow(Int32 row)
Summary: Retrieves the row vector at the specified index.
Parameters:
row(Int32): The zero-based row index (0 to 3).
Returns:
- Vector4f: The row vector.
public Void SetColumn(Int32 col, Vector4f vec)
Summary: Sets the column vector at the specified index.
Parameters:
-
col(Int32): The zero-based column index (0 to 3). -
vec(Vector4f): The vector to assign to the column.
public Void SetRow(Int32 row, Vector4f vec)
Summary: Sets the row vector at the specified index.
Parameters:
public Matrix3x3f ToMatrix3x3()
Summary: Extracts the upper-left 3x3 submatrix containing the rotational and scaling components.
Returns:
- Matrix3x3f: A 3x3 matrix.
public Single Determinant()
Summary: Calculates the scalar determinant of the 4x4 matrix.
Returns:
- Single: The determinant value.
public Matrix4x4f Transposed()
Summary: Returns a transposed copy of the matrix with rows and columns swapped.
Returns:
- Matrix4x4f: The transposed matrix.
public Matrix4x4f Inverse()
Summary: Calculates the multiplicative inverse of the matrix.
Returns:
- Matrix4x4f: The inverted matrix.
public EulerAngle ToEulerAngle(EulerOrder order)
Summary: Decomposes the upper-left 3x3 rotation portion of this matrix into Euler angles according to a specified rotation sequence.
Parameters:
order(EulerOrder): The rotational axis sequence to extract. Defaults to EulerAngle.DefaultOrder.
Returns:
- EulerAngle: The resulting EulerAngle.
public Quaternion ToQuaternion()
Summary: Converts the upper-left 3x3 rotation portion of this matrix into an equivalent rotation quaternion.
Returns:
- Quaternion: A normalised Quaternion.
public Boolean Equals(Matrix4x4f other)
Summary: Determines whether the specified Matrix4x4f is equal to the current instance.
Parameters:
other(Matrix4x4f): The matrix to compare with this instance.
Returns:
- Boolean:
if all corresponding elements are equal; otherwise, .
public virtual Boolean Equals(Object? obj)
Summary: Determines whether the specified object is a Matrix4x4f and is equal to the current instance.
Parameters:
obj(Object?): The object to compare with this instance.
Returns:
- Boolean:
if the object is a Matrix4x4f and matches all elements; otherwise, .
public virtual Int32 GetHashCode()
Summary: Returns the hash code for this matrix.
Returns:
- Int32: A 32-bit signed integer hash code.
public virtual String ToString()
Summary: Returns a culture-invariant string representation of the matrix.
Returns:
- String: A formatted string displaying the matrix rows.
public Void GetObjectData(SerializationInfo info, StreamingContext context)
Summary: Populates a SerializationInfo with the data needed to serialise the matrix.
Parameters:
-
info(SerializationInfo): The SerializationInfo to populate with data. -
context(StreamingContext): The destination for this serialisation.