Struct Matrix4

Matrix4 structure

4x4 matrix implementation.

public struct Matrix4

Constructors

NameDescription
Matrix4(double[])Initializes a new instance of the Matrix4 struct.
Matrix4(FMatrix4)Construct Matrix4 from an FMatrix4 instance
Matrix4(Vector4, Vector4, Vector4, Vector4)Constructs matrix from 4 rows.
Matrix4(double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double)Initializes a new instance of the Matrix4 struct.

Properties

NameDescription
static Identity { get; }Gets the identity matrix.
Determinant { get; }Gets the determinant of the matrix.

Methods

NameDescription
static Rotate(Quaternion)Create a rotation matrix from a quaternion
static Rotate(double, Vector3)Create a rotation matrix by rotation angle and axis
static RotateFromEuler(Vector3)Create a rotation matrix from Euler angle
static RotateFromEuler(double, double, double)Create a rotation matrix from Euler angle
static Scale(double)Creates a matrix that scales along the x-axis, the y-axis and the z-axis.
static Scale(Vector3)Creates a matrix that scales along the x-axis, the y-axis and the z-axis.
static Scale(double, double, double)Creates a matrix that scales along the x-axis, the y-axis and the z-axis.
static Translate(Vector3)Creates a matrix that translates along the x-axis, the y-axis and the z-axis
static Translate(double, double, double)Creates a matrix that translates along the x-axis, the y-axis and the z-axis
Concatenate(Matrix4)Concatenates the two matrices
Decompose(out Vector3, out Vector3, out Quaternion)
Inverse()Inverses this instance.
Normalize()Normalizes this instance.
SetTRS(Vector3, Vector3, Vector3)Initializes the matrix with translation/rotation/scale
ToArray()Converts matrix to array.
override ToString()Returns a String that represents the current Matrix4.
Transpose()Transposes this instance.
operator *Multiply the two matrices (4 operators)

Fields

NameDescription
m00The m00.
m01The m01.
m02The m02.
m03The m03.
m10The m10.
m11The m11.
m12The m12.
m13The m13.
m20The m20.
m21The m21.
m22The m22.
m23The m23.
m30The m30.
m31The m31.
m32The m32.
m33The m33.

Examples

Matrix4 mat = Matrix4.RotateFromEuler(90, 0, 0);
Matrix4 mat2 = Matrix4.Translate(0, 10, -50);
Matrix4 transform = mat2 * mat;
Vector4 pos = new Vector4(10, 9, 0, 1);
Vector4 transformed = transform * pos;

See Also