Table of Contents

Struct Matrix

Namespace
Stride.Core.Mathematics
Assembly
Stride.Core.Mathematics.dll

Represents a 4x4 mathematical matrix.

[DataContract("float4x4")]
[DataStyle(DataStyle.Compact)]
public struct Matrix : IEquatable<Matrix>, IFormattable
Implements

Constructors

Matrix(float)

Initializes a new instance of the Matrix struct.

public Matrix(float value)

Parameters

value float

The value that will be assigned to all components.

Matrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float)

Initializes a new instance of the Matrix struct.

public Matrix(float M11, float M12, float M13, float M14, float M21, float M22, float M23, float M24, float M31, float M32, float M33, float M34, float M41, float M42, float M43, float M44)

Parameters

M11 float

The value to assign at row 1 column 1 of the matrix.

M12 float

The value to assign at row 1 column 2 of the matrix.

M13 float

The value to assign at row 1 column 3 of the matrix.

M14 float

The value to assign at row 1 column 4 of the matrix.

M21 float

The value to assign at row 2 column 1 of the matrix.

M22 float

The value to assign at row 2 column 2 of the matrix.

M23 float

The value to assign at row 2 column 3 of the matrix.

M24 float

The value to assign at row 2 column 4 of the matrix.

M31 float

The value to assign at row 3 column 1 of the matrix.

M32 float

The value to assign at row 3 column 2 of the matrix.

M33 float

The value to assign at row 3 column 3 of the matrix.

M34 float

The value to assign at row 3 column 4 of the matrix.

M41 float

The value to assign at row 4 column 1 of the matrix.

M42 float

The value to assign at row 4 column 2 of the matrix.

M43 float

The value to assign at row 4 column 3 of the matrix.

M44 float

The value to assign at row 4 column 4 of the matrix.

Matrix(float[])

Initializes a new instance of the Matrix struct.

public Matrix(float[] values)

Parameters

values float[]

The values to assign to the components of the matrix. This must be an array with sixteen elements.

Exceptions

ArgumentNullException

Thrown when values is null.

ArgumentOutOfRangeException

Thrown when values contains more or less than sixteen elements.

Fields

Identity

The identity Matrix.

public static readonly Matrix Identity

Field Value

Matrix

LayoutIsRowMajor

Are matrix row or column major

public const bool LayoutIsRowMajor = false

Field Value

bool

Remarks

Dotnet's Matrix4x4 are row major.

M11

Value at row 1 column 1 of the matrix.

public float M11

Field Value

float

M12

Value at row 1 column 2 of the matrix.

public float M12

Field Value

float

M13

Value at row 1 column 3 of the matrix.

public float M13

Field Value

float

M14

Value at row 1 column 4 of the matrix.

public float M14

Field Value

float

M21

Value at row 2 column 1 of the matrix.

public float M21

Field Value

float

M22

Value at row 2 column 2 of the matrix.

public float M22

Field Value

float

M23

Value at row 2 column 3 of the matrix.

public float M23

Field Value

float

M24

Value at row 2 column 4 of the matrix.

public float M24

Field Value

float

M31

Value at row 3 column 1 of the matrix.

public float M31

Field Value

float

M32

Value at row 3 column 2 of the matrix.

public float M32

Field Value

float

M33

Value at row 3 column 3 of the matrix.

public float M33

Field Value

float

M34

Value at row 3 column 4 of the matrix.

public float M34

Field Value

float

M41

Value at row 4 column 1 of the matrix.

public float M41

Field Value

float

M42

Value at row 4 column 2 of the matrix.

public float M42

Field Value

float

M43

Value at row 4 column 3 of the matrix.

public float M43

Field Value

float

M44

Value at row 4 column 4 of the matrix.

public float M44

Field Value

float

SizeInBytes

The size of the Matrix type, in bytes.

public static readonly int SizeInBytes

Field Value

int

Zero

A Matrix with all of its components set to zero.

public static readonly Matrix Zero

Field Value

Matrix

Properties

Backward

Gets or sets the backward Vector3 of the matrix; that is M31, M32, and M33.

public Vector3 Backward { get; set; }

Property Value

Vector3

Column1

Gets or sets the first column in the matrix; that is M11, M21, M31, and M41.

public Vector4 Column1 { get; set; }

Property Value

Vector4

Column2

Gets or sets the second column in the matrix; that is M12, M22, M32, and M42.

public Vector4 Column2 { get; set; }

Property Value

Vector4

Column3

Gets or sets the third column in the matrix; that is M13, M23, M33, and M43.

public Vector4 Column3 { get; set; }

Property Value

Vector4

Column4

Gets or sets the fourth column in the matrix; that is M14, M24, M34, and M44.

public Vector4 Column4 { get; set; }

Property Value

Vector4

Down

Gets or sets the down Vector3 of the matrix; that is -M21, -M22, and -M23.

public Vector3 Down { get; set; }

Property Value

Vector3

Forward

Gets or sets the forward Vector3 of the matrix; that is -M31, -M32, and -M33.

public Vector3 Forward { get; set; }

Property Value

Vector3

IsIdentity

Gets a value indicating whether this instance is an identity matrix.

public bool IsIdentity { get; }

Property Value

bool

true if this instance is an identity matrix; otherwise, false.

this[int]

Gets or sets the component at the specified index.

public float this[int index] { get; set; }

Parameters

index int

The zero-based index of the component to access.

Property Value

float

The value of the matrix component, depending on the index.

Exceptions

ArgumentOutOfRangeException

Thrown when the index is out of the range [0, 15].

this[int, int]

Gets or sets the component at the specified index.

public float this[int row, int column] { get; set; }

Parameters

row int

The row of the matrix to access.

column int

The column of the matrix to access.

Property Value

float

The value of the matrix component, depending on the index.

Exceptions

ArgumentOutOfRangeException

Thrown when the row or columnis out of the range [0, 3].

Left

Gets or sets the left Vector3 of the matrix; that is -M11, -M12, and -M13.

public Vector3 Left { get; set; }

Property Value

Vector3

Right

Gets or sets the right Vector3 of the matrix; that is M11, M12, and M13.

public Vector3 Right { get; set; }

Property Value

Vector3

Row1

Gets or sets the first row in the matrix; that is M11, M12, M13, and M14.

public Vector4 Row1 { get; set; }

Property Value

Vector4

Row2

Gets or sets the second row in the matrix; that is M21, M22, M23, and M24.

public Vector4 Row2 { get; set; }

Property Value

Vector4

Row3

Gets or sets the third row in the matrix; that is M31, M32, M33, and M34.

public Vector4 Row3 { get; set; }

Property Value

Vector4

Row4

Gets or sets the fourth row in the matrix; that is M41, M42, M43, and M44.

public Vector4 Row4 { get; set; }

Property Value

Vector4

ScaleVector

Gets or sets the scale of the matrix; that is M11, M22, and M33.

public Vector3 ScaleVector { get; set; }

Property Value

Vector3

Remarks

This property does not do any computation and will return a correct scale vector only if the matrix is a scale matrix.

TranslationVector

Gets or sets the translation of the matrix; that is M41, M42, and M43.

public Vector3 TranslationVector { get; set; }

Property Value

Vector3

Up

Gets or sets the up Vector3 of the matrix; that is M21, M22, and M23.

public Vector3 Up { get; set; }

Property Value

Vector3

Methods

Add(Matrix, Matrix)

Determines the sum of two matrices.

public static Matrix Add(Matrix left, Matrix right)

Parameters

left Matrix

The first matrix to add.

right Matrix

The second matrix to add.

Returns

Matrix

The sum of the two matrices.

Add(ref readonly Matrix, ref readonly Matrix, out Matrix)

Determines the sum of two matrices.

public static void Add(ref readonly Matrix left, ref readonly Matrix right, out Matrix result)

Parameters

left Matrix

The first matrix to add.

right Matrix

The second matrix to add.

result Matrix

When the method completes, contains the sum of the two matrices.

AffineTransformation(float, Quaternion, Vector3)

Creates a 3D affine transformation matrix.

public static Matrix AffineTransformation(float scaling, Quaternion rotation, Vector3 translation)

Parameters

scaling float

Scaling factor.

rotation Quaternion

The rotation of the transformation.

translation Vector3

The translation factor of the transformation.

Returns

Matrix

The created affine transformation matrix.

AffineTransformation(float, ref readonly Quaternion, ref readonly Vector3, out Matrix)

Creates a 3D affine transformation matrix.

public static void AffineTransformation(float scaling, ref readonly Quaternion rotation, ref readonly Vector3 translation, out Matrix result)

Parameters

scaling float

Scaling factor.

rotation Quaternion

The rotation of the transformation.

translation Vector3

The translation factor of the transformation.

result Matrix

When the method completes, contains the created affine transformation matrix.

AffineTransformation(float, Vector3, Quaternion, Vector3)

Creates a 3D affine transformation matrix.

public static Matrix AffineTransformation(float scaling, Vector3 rotationCenter, Quaternion rotation, Vector3 translation)

Parameters

scaling float

Scaling factor.

rotationCenter Vector3

The center of the rotation.

rotation Quaternion

The rotation of the transformation.

translation Vector3

The translation factor of the transformation.

Returns

Matrix

The created affine transformation matrix.

AffineTransformation(float, ref readonly Vector3, ref readonly Quaternion, ref readonly Vector3, out Matrix)

Creates a 3D affine transformation matrix.

public static void AffineTransformation(float scaling, ref readonly Vector3 rotationCenter, ref readonly Quaternion rotation, ref readonly Vector3 translation, out Matrix result)

Parameters

scaling float

Scaling factor.

rotationCenter Vector3

The center of the rotation.

rotation Quaternion

The rotation of the transformation.

translation Vector3

The translation factor of the transformation.

result Matrix

When the method completes, contains the created affine transformation matrix.

AffineTransformation2D(float, Vector2, float, Vector2)

Creates a 2D affine transformation matrix.

public static Matrix AffineTransformation2D(float scaling, Vector2 rotationCenter, float rotation, Vector2 translation)

Parameters

scaling float

Scaling factor.

rotationCenter Vector2

The center of the rotation.

rotation float

The rotation of the transformation.

translation Vector2

The translation factor of the transformation.

Returns

Matrix

The created affine transformation matrix.

AffineTransformation2D(float, ref readonly Vector2, float, ref readonly Vector2, out Matrix)

Creates a 2D affine transformation matrix.

public static void AffineTransformation2D(float scaling, ref readonly Vector2 rotationCenter, float rotation, ref readonly Vector2 translation, out Matrix result)

Parameters

scaling float

Scaling factor.

rotationCenter Vector2

The center of the rotation.

rotation float

The rotation of the transformation.

translation Vector2

The translation factor of the transformation.

result Matrix

When the method completes, contains the created affine transformation matrix.

AffineTransformation2D(float, float, Vector2)

Creates a 2D affine transformation matrix.

public static Matrix AffineTransformation2D(float scaling, float rotation, Vector2 translation)

Parameters

scaling float

Scaling factor.

rotation float

The rotation of the transformation.

translation Vector2

The translation factor of the transformation.

Returns

Matrix

The created affine transformation matrix.

AffineTransformation2D(float, float, ref readonly Vector2, out Matrix)

Creates a 2D affine transformation matrix.

public static void AffineTransformation2D(float scaling, float rotation, ref readonly Vector2 translation, out Matrix result)

Parameters

scaling float

Scaling factor.

rotation float

The rotation of the transformation.

translation Vector2

The translation factor of the transformation.

result Matrix

When the method completes, contains the created affine transformation matrix.

Billboard(Vector3, Vector3, Vector3, Vector3)

Creates a spherical billboard that rotates around a specified object position.

public static Matrix Billboard(Vector3 objectPosition, Vector3 cameraPosition, Vector3 cameraUpVector, Vector3 cameraForwardVector)

Parameters

objectPosition Vector3

The position of the object around which the billboard will rotate.

cameraPosition Vector3

The position of the camera.

cameraUpVector Vector3

The up vector of the camera.

cameraForwardVector Vector3

The forward vector of the camera.

Returns

Matrix

The created billboard matrix.

Billboard(ref readonly Vector3, ref readonly Vector3, ref readonly Vector3, ref readonly Vector3, out Matrix)

Creates a spherical billboard that rotates around a specified object position.

public static void Billboard(ref readonly Vector3 objectPosition, ref readonly Vector3 cameraPosition, ref readonly Vector3 cameraUpVector, ref readonly Vector3 cameraForwardVector, out Matrix result)

Parameters

objectPosition Vector3

The position of the object around which the billboard will rotate.

cameraPosition Vector3

The position of the camera.

cameraUpVector Vector3

The up vector of the camera.

cameraForwardVector Vector3

The forward vector of the camera.

result Matrix

When the method completes, contains the created billboard matrix.

CopyMatrixFrom(float*, int, int)

Copies a nxm matrix to this instance.

public void CopyMatrixFrom(float* src, int columns, int rows)

Parameters

src float*

The source matrix.

columns int

The number of columns.

rows int

The number of rows.

Decompose(out Vector3, out Matrix, out Vector3)

Decomposes a matrix into a scale, rotation, and translation.

public bool Decompose(out Vector3 scale, out Matrix rotation, out Vector3 translation)

Parameters

scale Vector3

When the method completes, contains the scaling component of the decomposed matrix.

rotation Matrix

When the method completes, contains the rotation component of the decomposed matrix.

translation Vector3

When the method completes, contains the translation component of the decomposed matrix.

Returns

bool

Remarks

This method is designed to decompose an SRT transformation matrix only.

Decompose(out Vector3, out Quaternion, out Vector3)

Decomposes a matrix into a scale, rotation, and translation.

public bool Decompose(out Vector3 scale, out Quaternion rotation, out Vector3 translation)

Parameters

scale Vector3

When the method completes, contains the scaling component of the decomposed matrix.

rotation Quaternion

When the method completes, contains the rotation component of the decomposed matrix.

translation Vector3

When the method completes, contains the translation component of the decomposed matrix.

Returns

bool

Remarks

This method is designed to decompose an SRT transformation matrix only.

Decompose(out Vector3, out Vector3)

Decomposes a matrix into a scale, rotation, and translation.

public bool Decompose(out Vector3 scale, out Vector3 translation)

Parameters

scale Vector3

When the method completes, contains the scaling component of the decomposed matrix.

translation Vector3

When the method completes, contains the translation component of the decomposed matrix.

Returns

bool

true if a rotation exist for this matrix, false otherwise.

Remarks

This method is designed to decompose an SRT transformation matrix only.

Decompose(out float, out float, out float)

Decomposes a rotation matrix with the specified yaw, pitch, roll value (angles in radians).

public void Decompose(out float yaw, out float pitch, out float roll)

Parameters

yaw float

The yaw component in radians.

pitch float

The pitch component in radians.

roll float

The roll component in radians.

Remarks

This rotation matrix can be represented by intrinsic rotations in the order yaw, pitch, then roll.
Therefore, the extrinsic rotations to achieve this matrix is the reversed order of operations, i.e. Matrix.RotationZ(roll) * Matrix.RotationX(pitch) * Matrix.RotationY(yaw)

DecomposeLQ(out Matrix, out Matrix)

Decomposes a matrix into a lower triangular matrix L and an orthonormalized matrix Q.

public void DecomposeLQ(out Matrix L, out Matrix Q)

Parameters

L Matrix

When the method completes, contains the lower triangular matrix of the decomposition.

Q Matrix

When the method completes, contains the orthonormalized matrix of the decomposition.

DecomposeQR(out Matrix, out Matrix)

Decomposes a matrix into an orthonormalized matrix Q and a right triangular matrix R.

public void DecomposeQR(out Matrix Q, out Matrix R)

Parameters

Q Matrix

When the method completes, contains the orthonormalized matrix of the decomposition.

R Matrix

When the method completes, contains the right triangular matrix of the decomposition.

DecomposeXYZ(out Vector3)

Decomposes a rotation matrix with the specified X, Y and Z euler angles in radians. Matrix.RotationX(rotation.X) * Matrix.RotationY(rotation.Y) * Matrix.RotationZ(rotation.Z) should represent the same rotation.

public void DecomposeXYZ(out Vector3 rotation)

Parameters

rotation Vector3

The vector containing the 3 rotations angles to be applied in order.

Determinant()

Calculates the determinant of the matrix.

public float Determinant()

Returns

float

The determinant of the matrix.

Divide(Matrix, Matrix)

Determines the quotient of two matrices.

public static Matrix Divide(Matrix left, Matrix right)

Parameters

left Matrix

The first matrix to divide.

right Matrix

The second matrix to divide.

Returns

Matrix

The quotient of the two matrices.

Divide(Matrix, float)

Scales a matrix by the given value.

public static Matrix Divide(Matrix left, float right)

Parameters

left Matrix

The matrix to scale.

right float

The amount by which to scale.

Returns

Matrix

The scaled matrix.

Divide(ref readonly Matrix, ref readonly Matrix, out Matrix)

Determines the quotient of two matrices.

public static void Divide(ref readonly Matrix left, ref readonly Matrix right, out Matrix result)

Parameters

left Matrix

The first matrix to divide.

right Matrix

The second matrix to divide.

result Matrix

When the method completes, contains the quotient of the two matrices.

Divide(ref readonly Matrix, float, out Matrix)

Scales a matrix by the given value.

public static void Divide(ref readonly Matrix left, float right, out Matrix result)

Parameters

left Matrix

The matrix to scale.

right float

The amount by which to scale.

result Matrix

When the method completes, contains the scaled matrix.

Equals(Matrix)

Determines whether the specified Matrix is equal to this instance.

public readonly bool Equals(Matrix other)

Parameters

other Matrix

The Matrix to compare with this instance.

Returns

bool

true if the specified Matrix is equal to this instance; otherwise, false.

Equals(object)

Determines whether the specified object is equal to this instance.

public override bool Equals(object value)

Parameters

value object

The object to compare with this instance.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

ExchangeColumns(int, int)

Exchange columns.

public void ExchangeColumns(int firstColumn, int secondColumn)

Parameters

firstColumn int

The first column to exchange.

secondColumn int

The second column to exchange.

ExchangeRows(int, int)

Exchanges two rows in the matrix.

public void ExchangeRows(int firstRow, int secondRow)

Parameters

firstRow int

The first row to exchange. This is an index of the row starting at zero.

secondRow int

The second row to exchange. This is an index of the row starting at zero.

Exponent(Matrix, int)

Performs the exponential operation on a matrix.

public static Matrix Exponent(Matrix value, int exponent)

Parameters

value Matrix

The matrix to perform the operation on.

exponent int

The exponent to raise the matrix to.

Returns

Matrix

The exponential matrix.

Exceptions

ArgumentOutOfRangeException

Thrown when the exponent is negative.

Exponent(ref readonly Matrix, int, out Matrix)

Performs the exponential operation on a matrix.

public static void Exponent(ref readonly Matrix value, int exponent, out Matrix result)

Parameters

value Matrix

The matrix to perform the operation on.

exponent int

The exponent to raise the matrix to.

result Matrix

When the method completes, contains the exponential matrix.

Exceptions

ArgumentOutOfRangeException

Thrown when the exponent is negative.

GetHashCode()

Returns a hash code for this instance.

public override int GetHashCode()

Returns

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

Invert()

Inverts the matrix. If the matrix cannot be inverted (eg. Determinant was zero), then the matrix will be set equivalent to Zero.

public void Invert()

Invert(Matrix)

Calculates the inverse of the specified matrix. If the matrix cannot be inverted (eg. Determinant was zero), then the returning matrix will be Zero.

public static Matrix Invert(Matrix value)

Parameters

value Matrix

The matrix whose inverse is to be calculated.

Returns

Matrix

The inverse of the specified matrix.

Invert(ref readonly Matrix, out Matrix)

Calculates the inverse of the specified matrix. If the matrix cannot be inverted (eg. Determinant was zero), then result will be Zero.

public static void Invert(ref readonly Matrix value, out Matrix result)

Parameters

value Matrix

The matrix whose inverse is to be calculated.

result Matrix

When the method completes, contains the inverse of the specified matrix.

Lerp(Matrix, Matrix, float)

Performs a linear interpolation between two matrices.

public static Matrix Lerp(Matrix start, Matrix end, float amount)

Parameters

start Matrix

Start matrix.

end Matrix

End matrix.

amount float

Value between 0 and 1 indicating the weight of end.

Returns

Matrix

The linear interpolation of the two matrices.

Remarks

This method performs the linear interpolation based on the following formula.

start + (end - start) * amount

Passing amount a value of 0 will cause start to be returned; a value of 1 will cause end to be returned.

Lerp(ref readonly Matrix, ref readonly Matrix, float, out Matrix)

Performs a linear interpolation between two matrices.

public static void Lerp(ref readonly Matrix start, ref readonly Matrix end, float amount, out Matrix result)

Parameters

start Matrix

Start matrix.

end Matrix

End matrix.

amount float

Value between 0 and 1 indicating the weight of end.

result Matrix

When the method completes, contains the linear interpolation of the two matrices.

Remarks

This method performs the linear interpolation based on the following formula.

start + (end - start) * amount

Passing amount a value of 0 will cause start to be returned; a value of 1 will cause end to be returned.

LookAtLH(Vector3, Vector3, Vector3)

Creates a left-handed, look-at matrix.

public static Matrix LookAtLH(Vector3 eye, Vector3 target, Vector3 up)

Parameters

eye Vector3

The position of the viewer's eye.

target Vector3

The camera look-at target.

up Vector3

The camera's up vector.

Returns

Matrix

The created look-at matrix.

LookAtLH(ref readonly Vector3, ref readonly Vector3, ref readonly Vector3, out Matrix)

Creates a left-handed, look-at matrix.

public static void LookAtLH(ref readonly Vector3 eye, ref readonly Vector3 target, ref readonly Vector3 up, out Matrix result)

Parameters

eye Vector3

The position of the viewer's eye.

target Vector3

The camera look-at target.

up Vector3

The camera's up vector.

result Matrix

When the method completes, contains the created look-at matrix.

LookAtRH(Vector3, Vector3, Vector3)

Creates a right-handed, look-at matrix.

public static Matrix LookAtRH(Vector3 eye, Vector3 target, Vector3 up)

Parameters

eye Vector3

The position of the viewer's eye.

target Vector3

The camera look-at target.

up Vector3

The camera's up vector.

Returns

Matrix

The created look-at matrix.

LookAtRH(ref readonly Vector3, ref readonly Vector3, ref readonly Vector3, out Matrix)

Creates a right-handed, look-at matrix.

public static void LookAtRH(ref readonly Vector3 eye, ref readonly Vector3 target, ref readonly Vector3 up, out Matrix result)

Parameters

eye Vector3

The position of the viewer's eye.

target Vector3

The camera look-at target.

up Vector3

The camera's up vector.

result Matrix

When the method completes, contains the created look-at matrix.

LowerTriangularForm(Matrix)

Brings the matrix into lower triangular form using elementry row operations.

public static Matrix LowerTriangularForm(Matrix value)

Parameters

value Matrix

The matrix to put into lower triangular form.

Returns

Matrix

The lower triangular matrix.

Remarks

If the matrix is not invertable (i.e. its determinant is zero) than the result of this method may produce Single.Nan and Single.Inf values. When the matrix represents a system of linear equations, than this often means that either no solution exists or an infinite number of solutions exist.

LowerTriangularForm(ref readonly Matrix, out Matrix)

Brings the matrix into lower triangular form using elementry row operations.

public static void LowerTriangularForm(ref readonly Matrix value, out Matrix result)

Parameters

value Matrix

The matrix to put into lower triangular form.

result Matrix

When the method completes, contains the lower triangular matrix.

Remarks

If the matrix is not invertable (i.e. its determinant is zero) than the result of this method may produce Single.Nan and Single.Inf values. When the matrix represents a system of linear equations, than this often means that either no solution exists or an infinite number of solutions exist.

Multiply(Matrix, float)

Scales a matrix by the given value.

public static Matrix Multiply(Matrix left, float right)

Parameters

left Matrix

The matrix to scale.

right float

The amount by which to scale.

Returns

Matrix

The scaled matrix.

Multiply(in Matrix, in Matrix)

Determines the product of two matrices, equivalent to the '*' operator.

public static Matrix Multiply(in Matrix left, in Matrix right)

Parameters

left Matrix

The first matrix to multiply.

right Matrix

The second matrix to multiply.

Returns

Matrix

The product of the two matrices.

Multiply(ref readonly Matrix, ref readonly Matrix, out Matrix)

Determines the product of two matrices. Variables passed as left or right must not be used as the out parameter result, because result is calculated in-place.

public static void Multiply(ref readonly Matrix left, ref readonly Matrix right, out Matrix result)

Parameters

left Matrix

The first matrix to multiply.

right Matrix

The second matrix to multiply.

result Matrix

The product of the two matrices.

Multiply(ref readonly Matrix, float, out Matrix)

Scales a matrix by the given value.

public static void Multiply(ref readonly Matrix left, float right, out Matrix result)

Parameters

left Matrix

The matrix to scale.

right float

The amount by which to scale.

result Matrix

When the method completes, contains the scaled matrix.

MultiplyIn(in Matrix, in Matrix, out Matrix)

Determines the product of two matrices. Variables passed as left or right must not be used as the out parameter result, because result is calculated in-place.

public static void MultiplyIn(in Matrix left, in Matrix right, out Matrix result)

Parameters

left Matrix

The first matrix to multiply.

right Matrix

The second matrix to multiply.

result Matrix

The product of the two matrices.

Negate(Matrix)

Negates a matrix.

public static Matrix Negate(Matrix value)

Parameters

value Matrix

The matrix to be negated.

Returns

Matrix

The negated matrix.

Negate(ref readonly Matrix, out Matrix)

Negates a matrix.

public static void Negate(ref readonly Matrix value, out Matrix result)

Parameters

value Matrix

The matrix to be negated.

result Matrix

When the method completes, contains the negated matrix.

OrthoLH(float, float, float, float)

Creates a left-handed, orthographic projection matrix.

public static Matrix OrthoLH(float width, float height, float znear, float zfar)

Parameters

width float

Width of the viewing volume.

height float

Height of the viewing volume.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

Returns

Matrix

The created projection matrix.

OrthoLH(float, float, float, float, out Matrix)

Creates a left-handed, orthographic projection matrix.

public static void OrthoLH(float width, float height, float znear, float zfar, out Matrix result)

Parameters

width float

Width of the viewing volume.

height float

Height of the viewing volume.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

result Matrix

When the method completes, contains the created projection matrix.

OrthoOffCenterLH(float, float, float, float, float, float)

Creates a left-handed, customized orthographic projection matrix.

public static Matrix OrthoOffCenterLH(float left, float right, float bottom, float top, float znear, float zfar)

Parameters

left float

Minimum x-value of the viewing volume.

right float

Maximum x-value of the viewing volume.

bottom float

Minimum y-value of the viewing volume.

top float

Maximum y-value of the viewing volume.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

Returns

Matrix

The created projection matrix.

OrthoOffCenterLH(float, float, float, float, float, float, out Matrix)

Creates a left-handed, customized orthographic projection matrix.

public static void OrthoOffCenterLH(float left, float right, float bottom, float top, float znear, float zfar, out Matrix result)

Parameters

left float

Minimum x-value of the viewing volume.

right float

Maximum x-value of the viewing volume.

bottom float

Minimum y-value of the viewing volume.

top float

Maximum y-value of the viewing volume.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

result Matrix

When the method completes, contains the created projection matrix.

OrthoOffCenterRH(float, float, float, float, float, float)

Creates a right-handed, customized orthographic projection matrix.

public static Matrix OrthoOffCenterRH(float left, float right, float bottom, float top, float znear, float zfar)

Parameters

left float

Minimum x-value of the viewing volume.

right float

Maximum x-value of the viewing volume.

bottom float

Minimum y-value of the viewing volume.

top float

Maximum y-value of the viewing volume.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

Returns

Matrix

The created projection matrix.

OrthoOffCenterRH(float, float, float, float, float, float, out Matrix)

Creates a right-handed, customized orthographic projection matrix.

public static void OrthoOffCenterRH(float left, float right, float bottom, float top, float znear, float zfar, out Matrix result)

Parameters

left float

Minimum x-value of the viewing volume.

right float

Maximum x-value of the viewing volume.

bottom float

Minimum y-value of the viewing volume.

top float

Maximum y-value of the viewing volume.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

result Matrix

When the method completes, contains the created projection matrix.

OrthoRH(float, float, float, float)

Creates a right-handed, orthographic projection matrix.

public static Matrix OrthoRH(float width, float height, float znear, float zfar)

Parameters

width float

Width of the viewing volume.

height float

Height of the viewing volume.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

Returns

Matrix

The created projection matrix.

OrthoRH(float, float, float, float, out Matrix)

Creates a right-handed, orthographic projection matrix.

public static void OrthoRH(float width, float height, float znear, float zfar, out Matrix result)

Parameters

width float

Width of the viewing volume.

height float

Height of the viewing volume.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

result Matrix

When the method completes, contains the created projection matrix.

Orthogonalize()

Orthogonalizes the specified matrix.

public void Orthogonalize()

Remarks

Orthogonalization is the process of making all rows orthogonal to each other. This means that any given row in the matrix will be orthogonal to any other given row in the matrix.

Because this method uses the modified Gram-Schmidt process, the resulting matrix tends to be numerically unstable. The numeric stability decreases according to the rows so that the first row is the most stable and the last row is the least stable.

This operation is performed on the rows of the matrix rather than the columns. If you wish for this operation to be performed on the columns, first transpose the input and then transpose the output.

Orthogonalize(Matrix)

Orthogonalizes the specified matrix.

public static Matrix Orthogonalize(Matrix value)

Parameters

value Matrix

The matrix to orthogonalize.

Returns

Matrix

The orthogonalized matrix.

Remarks

Orthogonalization is the process of making all rows orthogonal to each other. This means that any given row in the matrix will be orthogonal to any other given row in the matrix.

Because this method uses the modified Gram-Schmidt process, the resulting matrix tends to be numerically unstable. The numeric stability decreases according to the rows so that the first row is the most stable and the last row is the least stable.

This operation is performed on the rows of the matrix rather than the columns. If you wish for this operation to be performed on the columns, first transpose the input and than transpose the output.

Orthogonalize(ref readonly Matrix, out Matrix)

Orthogonalizes the specified matrix.

public static void Orthogonalize(ref readonly Matrix value, out Matrix result)

Parameters

value Matrix

The matrix to orthogonalize.

result Matrix

When the method completes, contains the orthogonalized matrix.

Remarks

Orthogonalization is the process of making all rows orthogonal to each other. This means that any given row in the matrix will be orthogonal to any other given row in the matrix.

Because this method uses the modified Gram-Schmidt process, the resulting matrix tends to be numerically unstable. The numeric stability decreases according to the rows so that the first row is the most stable and the last row is the least stable.

This operation is performed on the rows of the matrix rather than the columns. If you wish for this operation to be performed on the columns, first transpose the input and than transpose the output.

Orthonormalize()

Orthonormalizes the specified matrix.

public void Orthonormalize()

Remarks

Orthonormalization is the process of making all rows and columns orthogonal to each other and making all rows and columns of unit length. This means that any given row will be orthogonal to any other given row and any given column will be orthogonal to any other given column. Any given row will not be orthogonal to any given column. Every row and every column will be of unit length.

Because this method uses the modified Gram-Schmidt process, the resulting matrix tends to be numerically unstable. The numeric stability decreases according to the rows so that the first row is the most stable and the last row is the least stable.

This operation is performed on the rows of the matrix rather than the columns. If you wish for this operation to be performed on the columns, first transpose the input and then transpose the output.

Orthonormalize(Matrix)

Orthonormalizes the specified matrix.

public static Matrix Orthonormalize(Matrix value)

Parameters

value Matrix

The matrix to orthonormalize.

Returns

Matrix

The orthonormalized matrix.

Remarks

Orthonormalization is the process of making all rows and columns orthogonal to each other and making all rows and columns of unit length. This means that any given row will be orthogonal to any other given row and any given column will be orthogonal to any other given column. Any given row will not be orthogonal to any given column. Every row and every column will be of unit length.

Because this method uses the modified Gram-Schmidt process, the resulting matrix tends to be numerically unstable. The numeric stability decreases according to the rows so that the first row is the most stable and the last row is the least stable.

This operation is performed on the rows of the matrix rather than the columns. If you wish for this operation to be performed on the columns, first transpose the input and than transpose the output.

Orthonormalize(ref readonly Matrix, out Matrix)

Orthonormalizes the specified matrix.

public static void Orthonormalize(ref readonly Matrix value, out Matrix result)

Parameters

value Matrix

The matrix to orthonormalize.

result Matrix

When the method completes, contains the orthonormalized matrix.

Remarks

Orthonormalization is the process of making all rows and columns orthogonal to each other and making all rows and columns of unit length. This means that any given row will be orthogonal to any other given row and any given column will be orthogonal to any other given column. Any given row will not be orthogonal to any given column. Every row and every column will be of unit length.

Because this method uses the modified Gram-Schmidt process, the resulting matrix tends to be numerically unstable. The numeric stability decreases according to the rows so that the first row is the most stable and the last row is the least stable.

This operation is performed on the rows of the matrix rather than the columns. If you wish for this operation to be performed on the columns, first transpose the input and than transpose the output.

PerspectiveFovLH(float, float, float, float)

Creates a left-handed, perspective projection matrix based on a field of view.

public static Matrix PerspectiveFovLH(float fov, float aspect, float znear, float zfar)

Parameters

fov float

Field of view in the y direction, in radians.

aspect float

Aspect ratio, defined as view space width divided by height.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

Returns

Matrix

The created projection matrix.

PerspectiveFovLH(float, float, float, float, out Matrix)

Creates a left-handed, perspective projection matrix based on a field of view.

public static void PerspectiveFovLH(float fov, float aspect, float znear, float zfar, out Matrix result)

Parameters

fov float

Field of view in the y direction, in radians.

aspect float

Aspect ratio, defined as view space width divided by height.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

result Matrix

When the method completes, contains the created projection matrix.

PerspectiveFovRH(float, float, float, float)

Creates a right-handed, perspective projection matrix based on a field of view.

public static Matrix PerspectiveFovRH(float fov, float aspect, float znear, float zfar)

Parameters

fov float

Field of view in the y direction, in radians.

aspect float

Aspect ratio, defined as view space width divided by height.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

Returns

Matrix

The created projection matrix.

PerspectiveFovRH(float, float, float, float, out Matrix)

Creates a right-handed, perspective projection matrix based on a field of view.

public static void PerspectiveFovRH(float fov, float aspect, float znear, float zfar, out Matrix result)

Parameters

fov float

Field of view in the y direction, in radians.

aspect float

Aspect ratio, defined as view space width divided by height.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

result Matrix

When the method completes, contains the created projection matrix.

PerspectiveLH(float, float, float, float)

Creates a left-handed, perspective projection matrix.

public static Matrix PerspectiveLH(float width, float height, float znear, float zfar)

Parameters

width float

Width of the viewing volume.

height float

Height of the viewing volume.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

Returns

Matrix

The created projection matrix.

PerspectiveLH(float, float, float, float, out Matrix)

Creates a left-handed, perspective projection matrix.

public static void PerspectiveLH(float width, float height, float znear, float zfar, out Matrix result)

Parameters

width float

Width of the viewing volume.

height float

Height of the viewing volume.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

result Matrix

When the method completes, contains the created projection matrix.

PerspectiveOffCenterLH(float, float, float, float, float, float)

Creates a left-handed, customized perspective projection matrix.

public static Matrix PerspectiveOffCenterLH(float left, float right, float bottom, float top, float znear, float zfar)

Parameters

left float

Minimum x-value of the viewing volume.

right float

Maximum x-value of the viewing volume.

bottom float

Minimum y-value of the viewing volume.

top float

Maximum y-value of the viewing volume.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

Returns

Matrix

The created projection matrix.

PerspectiveOffCenterLH(float, float, float, float, float, float, out Matrix)

Creates a left-handed, customized perspective projection matrix.

public static void PerspectiveOffCenterLH(float left, float right, float bottom, float top, float znear, float zfar, out Matrix result)

Parameters

left float

Minimum x-value of the viewing volume.

right float

Maximum x-value of the viewing volume.

bottom float

Minimum y-value of the viewing volume.

top float

Maximum y-value of the viewing volume.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

result Matrix

When the method completes, contains the created projection matrix.

PerspectiveOffCenterRH(float, float, float, float, float, float)

Creates a right-handed, customized perspective projection matrix.

public static Matrix PerspectiveOffCenterRH(float left, float right, float bottom, float top, float znear, float zfar)

Parameters

left float

Minimum x-value of the viewing volume.

right float

Maximum x-value of the viewing volume.

bottom float

Minimum y-value of the viewing volume.

top float

Maximum y-value of the viewing volume.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

Returns

Matrix

The created projection matrix.

PerspectiveOffCenterRH(float, float, float, float, float, float, out Matrix)

Creates a right-handed, customized perspective projection matrix.

public static void PerspectiveOffCenterRH(float left, float right, float bottom, float top, float znear, float zfar, out Matrix result)

Parameters

left float

Minimum x-value of the viewing volume.

right float

Maximum x-value of the viewing volume.

bottom float

Minimum y-value of the viewing volume.

top float

Maximum y-value of the viewing volume.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

result Matrix

When the method completes, contains the created projection matrix.

PerspectiveRH(float, float, float, float)

Creates a right-handed, perspective projection matrix.

public static Matrix PerspectiveRH(float width, float height, float znear, float zfar)

Parameters

width float

Width of the viewing volume.

height float

Height of the viewing volume.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

Returns

Matrix

The created projection matrix.

PerspectiveRH(float, float, float, float, out Matrix)

Creates a right-handed, perspective projection matrix.

public static void PerspectiveRH(float width, float height, float znear, float zfar, out Matrix result)

Parameters

width float

Width of the viewing volume.

height float

Height of the viewing volume.

znear float

Minimum z-value of the viewing volume.

zfar float

Maximum z-value of the viewing volume.

result Matrix

When the method completes, contains the created projection matrix.

ReducedRowEchelonForm(ref readonly Matrix, ref readonly Vector4, out Matrix, out Vector4)

Brings the matrix into reduced row echelon form using elementry row operations.

public static void ReducedRowEchelonForm(ref readonly Matrix value, ref readonly Vector4 augment, out Matrix result, out Vector4 augmentResult)

Parameters

value Matrix

The matrix to put into reduced row echelon form.

augment Vector4

The fifth column of the matrix.

result Matrix

When the method completes, contains the resultant matrix after the operation.

augmentResult Vector4

When the method completes, contains the resultant fifth column of the matrix.

Remarks

The fifth column is often called the agumented part of the matrix. This is because the fifth column is really just an extension of the matrix so that there is a place to put all of the non-zero components after the operation is complete.

Often times the resultant matrix will the identity matrix or a matrix similar to the identity matrix. Sometimes, however, that is not possible and numbers other than zero and one may appear.

This method can be used to solve systems of linear equations. Upon completion of this method, the augmentResult will contain the solution for the system. It is up to the user to analyze both the input and the result to determine if a solution really exists.

Reflection(Plane)

Builds a matrix that can be used to reflect vectors about a plane.

public static Matrix Reflection(Plane plane)

Parameters

plane Plane

The plane for which the reflection occurs. This parameter is assumed to be normalized.

Returns

Matrix

The reflection matrix.

Reflection(ref readonly Plane, out Matrix)

Builds a matrix that can be used to reflect vectors about a plane.

public static void Reflection(ref readonly Plane plane, out Matrix result)

Parameters

plane Plane

The plane for which the reflection occurs. This parameter is assumed to be normalized.

result Matrix

When the method completes, contains the reflection matrix.

RotationAxis(Vector3, float)

Creates a matrix that rotates around an arbitary axis.

public static Matrix RotationAxis(Vector3 axis, float angle)

Parameters

axis Vector3

The axis around which to rotate. This parameter is assumed to be normalized.

angle float

Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.

Returns

Matrix

The created rotation matrix.

RotationAxis(ref readonly Vector3, float, out Matrix)

Creates a matrix that rotates around an arbitary axis.

public static void RotationAxis(ref readonly Vector3 axis, float angle, out Matrix result)

Parameters

axis Vector3

The axis around which to rotate. This parameter is assumed to be normalized.

angle float

Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.

result Matrix

When the method completes, contains the created rotation matrix.

RotationQuaternion(Quaternion)

Creates a rotation matrix from a quaternion.

public static Matrix RotationQuaternion(Quaternion rotation)

Parameters

rotation Quaternion

The quaternion to use to build the matrix.

Returns

Matrix

The created rotation matrix.

RotationQuaternion(ref readonly Quaternion, out Matrix)

Creates a rotation matrix from a quaternion.

public static void RotationQuaternion(ref readonly Quaternion rotation, out Matrix result)

Parameters

rotation Quaternion

The quaternion to use to build the matrix.

result Matrix

The created rotation matrix.

RotationX(float)

Creates a matrix that rotates around the x-axis.

public static Matrix RotationX(float angle)

Parameters

angle float

Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.

Returns

Matrix

The created rotation matrix.

RotationX(float, out Matrix)

Creates a matrix that rotates around the x-axis.

public static void RotationX(float angle, out Matrix result)

Parameters

angle float

Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.

result Matrix

When the method completes, contains the created rotation matrix.

RotationY(float)

Creates a matrix that rotates around the y-axis.

public static Matrix RotationY(float angle)

Parameters

angle float

Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.

Returns

Matrix

The created rotation matrix.

RotationY(float, out Matrix)

Creates a matrix that rotates around the y-axis.

public static void RotationY(float angle, out Matrix result)

Parameters

angle float

Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.

result Matrix

When the method completes, contains the created rotation matrix.

RotationYawPitchRoll(float, float, float)

Creates a rotation matrix with a specified yaw, pitch, and roll value (angles in radians).

public static Matrix RotationYawPitchRoll(float yaw, float pitch, float roll)

Parameters

yaw float

Yaw around the y-axis, in radians.

pitch float

Pitch around the x-axis, in radians.

roll float

Roll around the z-axis, in radians.

Returns

Matrix

The created rotation matrix.

RotationYawPitchRoll(float, float, float, out Matrix)

Creates a rotation matrix with a specified yaw, pitch, and roll value (angles in radians).

public static void RotationYawPitchRoll(float yaw, float pitch, float roll, out Matrix result)

Parameters

yaw float

Yaw around the y-axis, in radians.

pitch float

Pitch around the x-axis, in radians.

roll float

Roll around the z-axis, in radians.

result Matrix

When the method completes, contains the created rotation matrix.

RotationZ(float)

Creates a matrix that rotates around the z-axis.

public static Matrix RotationZ(float angle)

Parameters

angle float

Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.

Returns

Matrix

The created rotation matrix.

RotationZ(float, out Matrix)

Creates a matrix that rotates around the z-axis.

public static void RotationZ(float angle, out Matrix result)

Parameters

angle float

Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.

result Matrix

When the method completes, contains the created rotation matrix.

RowEchelonForm(Matrix)

Brings the matrix into row echelon form using elementry row operations;

public static Matrix RowEchelonForm(Matrix value)

Parameters

value Matrix

The matrix to put into row echelon form.

Returns

Matrix

When the method completes, contains the row echelon form of the matrix.

RowEchelonForm(ref readonly Matrix, out Matrix)

Brings the matrix into row echelon form using elementry row operations;

public static void RowEchelonForm(ref readonly Matrix value, out Matrix result)

Parameters

value Matrix

The matrix to put into row echelon form.

result Matrix

When the method completes, contains the row echelon form of the matrix.

Scaling(Vector3)

Creates a matrix that scales along the x-axis, y-axis, and y-axis.

public static Matrix Scaling(Vector3 scale)

Parameters

scale Vector3

Scaling factor for all three axes.

Returns

Matrix

The created scaling matrix.

Scaling(ref readonly Vector3, out Matrix)

Creates a matrix that scales along the x-axis, y-axis, and y-axis.

public static void Scaling(ref readonly Vector3 scale, out Matrix result)

Parameters

scale Vector3

Scaling factor for all three axes.

result Matrix

When the method completes, contains the created scaling matrix.

Scaling(float)

Creates a matrix that uniformally scales along all three axis.

public static Matrix Scaling(float scale)

Parameters

scale float

The uniform scale that is applied along all axis.

Returns

Matrix

The created scaling matrix.

Scaling(float, out Matrix)

Creates a matrix that uniformally scales along all three axis.

public static void Scaling(float scale, out Matrix result)

Parameters

scale float

The uniform scale that is applied along all axis.

result Matrix

When the method completes, contains the created scaling matrix.

Scaling(float, float, float)

Creates a matrix that scales along the x-axis, y-axis, and y-axis.

public static Matrix Scaling(float x, float y, float z)

Parameters

x float

Scaling factor that is applied along the x-axis.

y float

Scaling factor that is applied along the y-axis.

z float

Scaling factor that is applied along the z-axis.

Returns

Matrix

The created scaling matrix.

Scaling(float, float, float, out Matrix)

Creates a matrix that scales along the x-axis, y-axis, and y-axis.

public static void Scaling(float x, float y, float z, out Matrix result)

Parameters

x float

Scaling factor that is applied along the x-axis.

y float

Scaling factor that is applied along the y-axis.

z float

Scaling factor that is applied along the z-axis.

result Matrix

When the method completes, contains the created scaling matrix.

Shadow(Vector4, Plane)

Creates a matrix that flattens geometry into a shadow.

public static Matrix Shadow(Vector4 light, Plane plane)

Parameters

light Vector4

The light direction. If the W component is 0, the light is directional light; if the W component is 1, the light is a point light.

plane Plane

The plane onto which to project the geometry as a shadow. This parameter is assumed to be normalized.

Returns

Matrix

The shadow matrix.

Shadow(ref readonly Vector4, ref readonly Plane, out Matrix)

Creates a matrix that flattens geometry into a shadow.

public static void Shadow(ref readonly Vector4 light, ref readonly Plane plane, out Matrix result)

Parameters

light Vector4

The light direction. If the W component is 0, the light is directional light; if the W component is 1, the light is a point light.

plane Plane

The plane onto which to project the geometry as a shadow. This parameter is assumed to be normalized.

result Matrix

When the method completes, contains the shadow matrix.

SmoothStep(Matrix, Matrix, float)

Performs a cubic interpolation between two matrices.

public static Matrix SmoothStep(Matrix start, Matrix end, float amount)

Parameters

start Matrix

Start matrix.

end Matrix

End matrix.

amount float

Value between 0 and 1 indicating the weight of end.

Returns

Matrix

The cubic interpolation of the two matrices.

SmoothStep(ref readonly Matrix, ref readonly Matrix, float, out Matrix)

Performs a cubic interpolation between two matrices.

public static void SmoothStep(ref readonly Matrix start, ref readonly Matrix end, float amount, out Matrix result)

Parameters

start Matrix

Start matrix.

end Matrix

End matrix.

amount float

Value between 0 and 1 indicating the weight of end.

result Matrix

When the method completes, contains the cubic interpolation of the two matrices.

Subtract(Matrix, Matrix)

Determines the difference between two matrices.

public static Matrix Subtract(Matrix left, Matrix right)

Parameters

left Matrix

The first matrix to subtract.

right Matrix

The second matrix to subtract.

Returns

Matrix

The difference between the two matrices.

Subtract(ref readonly Matrix, ref readonly Matrix, out Matrix)

Determines the difference between two matrices.

public static void Subtract(ref readonly Matrix left, ref readonly Matrix right, out Matrix result)

Parameters

left Matrix

The first matrix to subtract.

right Matrix

The second matrix to subtract.

result Matrix

When the method completes, contains the difference between the two matrices.

ToArray()

Creates an array containing the elements of the matrix.

public float[] ToArray()

Returns

float[]

A sixteen-element array containing the components of the matrix.

ToString()

Returns a string that represents this instance.

public override string ToString()

Returns

string

A string that represents this instance.

ToString(IFormatProvider)

Returns a string that represents this instance.

public string ToString(IFormatProvider formatProvider)

Parameters

formatProvider IFormatProvider

The format provider.

Returns

string

A string that represents this instance.

ToString(string)

Returns a string that represents this instance.

public string ToString(string format)

Parameters

format string

The format.

Returns

string

A string that represents this instance.

ToString(string, IFormatProvider)

Returns a string that represents this instance.

public string ToString(string format, IFormatProvider formatProvider)

Parameters

format string

The format.

formatProvider IFormatProvider

The format provider.

Returns

string

A string that represents this instance.

Transformation(Vector3, Quaternion, Vector3, Vector3, Quaternion, Vector3)

Creates a transformation matrix.

public static Matrix Transformation(Vector3 scalingCenter, Quaternion scalingRotation, Vector3 scaling, Vector3 rotationCenter, Quaternion rotation, Vector3 translation)

Parameters

scalingCenter Vector3

Center point of the scaling operation.

scalingRotation Quaternion

Scaling rotation amount.

scaling Vector3

Scaling factor.

rotationCenter Vector3

The center of the rotation.

rotation Quaternion

The rotation of the transformation.

translation Vector3

The translation factor of the transformation.

Returns

Matrix

The created transformation matrix.

Transformation(ref readonly Vector3, ref readonly Quaternion, ref readonly Vector3, out Matrix)

Creates a matrix that contains both the X, Y and Z rotation, as well as scaling and translation. Note: This function is NOT thead safe.

public static void Transformation(ref readonly Vector3 scaling, ref readonly Quaternion rotation, ref readonly Vector3 translation, out Matrix result)

Parameters

scaling Vector3

The scaling.

rotation Quaternion

Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.

translation Vector3

The translation.

result Matrix

When the method completes, contains the created rotation matrix.

Transformation(ref readonly Vector3, ref readonly Quaternion, ref readonly Vector3, ref readonly Vector3, ref readonly Quaternion, ref readonly Vector3, out Matrix)

Creates a transformation matrix.

public static void Transformation(ref readonly Vector3 scalingCenter, ref readonly Quaternion scalingRotation, ref readonly Vector3 scaling, ref readonly Vector3 rotationCenter, ref readonly Quaternion rotation, ref readonly Vector3 translation, out Matrix result)

Parameters

scalingCenter Vector3

Center point of the scaling operation.

scalingRotation Quaternion

Scaling rotation amount.

scaling Vector3

Scaling factor.

rotationCenter Vector3

The center of the rotation.

rotation Quaternion

The rotation of the transformation.

translation Vector3

The translation factor of the transformation.

result Matrix

When the method completes, contains the created transformation matrix.

Transformation2D(Vector2, float, Vector2, Vector2, float, Vector2)

Creates a 2D transformation matrix.

public static Matrix Transformation2D(Vector2 scalingCenter, float scalingRotation, Vector2 scaling, Vector2 rotationCenter, float rotation, Vector2 translation)

Parameters

scalingCenter Vector2

Center point of the scaling operation.

scalingRotation float

Scaling rotation amount.

scaling Vector2

Scaling factor.

rotationCenter Vector2

The center of the rotation.

rotation float

The rotation of the transformation.

translation Vector2

The translation factor of the transformation.

Returns

Matrix

The created transformation matrix.

Transformation2D(ref readonly Vector2, float, ref readonly Vector2, ref readonly Vector2, float, ref readonly Vector2, out Matrix)

Creates a 2D transformation matrix.

public static void Transformation2D(ref readonly Vector2 scalingCenter, float scalingRotation, ref readonly Vector2 scaling, ref readonly Vector2 rotationCenter, float rotation, ref readonly Vector2 translation, out Matrix result)

Parameters

scalingCenter Vector2

Center point of the scaling operation.

scalingRotation float

Scaling rotation amount.

scaling Vector2

Scaling factor.

rotationCenter Vector2

The center of the rotation.

rotation float

The rotation of the transformation.

translation Vector2

The translation factor of the transformation.

result Matrix

When the method completes, contains the created transformation matrix.

Translation(Vector3)

Creates a translation matrix using the specified offsets.

public static Matrix Translation(Vector3 value)

Parameters

value Vector3

The offset for all three coordinate planes.

Returns

Matrix

The created translation matrix.

Translation(ref readonly Vector3, out Matrix)

Creates a translation matrix using the specified offsets.

public static void Translation(ref readonly Vector3 value, out Matrix result)

Parameters

value Vector3

The offset for all three coordinate planes.

result Matrix

When the method completes, contains the created translation matrix.

Translation(float, float, float)

Creates a translation matrix using the specified offsets.

public static Matrix Translation(float x, float y, float z)

Parameters

x float

X-coordinate offset.

y float

Y-coordinate offset.

z float

Z-coordinate offset.

Returns

Matrix

The created translation matrix.

Translation(float, float, float, out Matrix)

Creates a translation matrix using the specified offsets.

public static void Translation(float x, float y, float z, out Matrix result)

Parameters

x float

X-coordinate offset.

y float

Y-coordinate offset.

z float

Z-coordinate offset.

result Matrix

When the method completes, contains the created translation matrix.

Transpose()

Transposes the matrix.

public void Transpose()

Transpose(in Matrix)

Calculates the transpose of the specified matrix.

public static Matrix Transpose(in Matrix value)

Parameters

value Matrix

The matrix whose transpose is to be calculated.

Returns

Matrix

The transpose of the specified matrix.

Transpose(ref readonly Matrix, out Matrix)

Calculates the transpose of the specified matrix.

public static void Transpose(ref readonly Matrix value, out Matrix result)

Parameters

value Matrix

The matrix whose transpose is to be calculated.

result Matrix

When the method completes, contains the transpose of the specified matrix.

TransposeMatrixFrom(float*, int, int)

Transposes a nmx matrix to this instance.

public void TransposeMatrixFrom(float* src, int columns, int rows)

Parameters

src float*

The SRC.

columns int

The columns.

rows int

The rows.

UpperTriangularForm(Matrix)

Brings the matrix into upper triangular form using elementry row operations.

public static Matrix UpperTriangularForm(Matrix value)

Parameters

value Matrix

The matrix to put into upper triangular form.

Returns

Matrix

The upper triangular matrix.

Remarks

If the matrix is not invertable (i.e. its determinant is zero) than the result of this method may produce Single.Nan and Single.Inf values. When the matrix represents a system of linear equations, than this often means that either no solution exists or an infinite number of solutions exist.

UpperTriangularForm(ref readonly Matrix, out Matrix)

Brings the matrix into upper triangular form using elementry row operations.

public static void UpperTriangularForm(ref readonly Matrix value, out Matrix result)

Parameters

value Matrix

The matrix to put into upper triangular form.

result Matrix

When the method completes, contains the upper triangular matrix.

Remarks

If the matrix is not invertable (i.e. its determinant is zero) than the result of this method may produce Single.Nan and Single.Inf values. When the matrix represents a system of linear equations, than this often means that either no solution exists or an infinite number of solutions exist.

Operators

operator +(in Matrix, in Matrix)

Adds two matrices.

public static Matrix operator +(in Matrix left, in Matrix right)

Parameters

left Matrix

The first matrix to add.

right Matrix

The second matrix to add.

Returns

Matrix

The sum of the two matrices.

operator /(in Matrix, in Matrix)

Divides two matrices.

public static Matrix operator /(in Matrix left, in Matrix right)

Parameters

left Matrix

The first matrix to divide.

right Matrix

The second matrix to divide.

Returns

Matrix

The quotient of the two matrices.

operator /(in Matrix, in float)

Scales a matrix by a given value.

public static Matrix operator /(in Matrix left, in float right)

Parameters

left Matrix

The matrix to scale.

right float

The amount by which to scale.

Returns

Matrix

The scaled matrix.

operator ==(in Matrix, in Matrix)

Tests for equality between two objects.

public static bool operator ==(in Matrix left, in Matrix right)

Parameters

left Matrix

The first value to compare.

right Matrix

The second value to compare.

Returns

bool

true if left has the same value as right; otherwise, false.

operator !=(in Matrix, in Matrix)

Tests for inequality between two objects.

public static bool operator !=(in Matrix left, in Matrix right)

Parameters

left Matrix

The first value to compare.

right Matrix

The second value to compare.

Returns

bool

true if left has a different value than right; otherwise, false.

operator *(in Matrix, in Matrix)

Multiplies two matrices.

public static Matrix operator *(in Matrix left, in Matrix right)

Parameters

left Matrix

The first matrix to multiply.

right Matrix

The second matrix to multiply.

Returns

Matrix

The product of the two matrices.

operator *(in Matrix, float)

Scales a matrix by a given value.

public static Matrix operator *(in Matrix left, float right)

Parameters

left Matrix

The matrix to scale.

right float

The amount by which to scale.

Returns

Matrix

The scaled matrix.

operator *(float, in Matrix)

Scales a matrix by a given value.

public static Matrix operator *(float left, in Matrix right)

Parameters

left float

The amount by which to scale.

right Matrix

The matrix to scale.

Returns

Matrix

The scaled matrix.

operator -(in Matrix, in Matrix)

Subtracts two matrices.

public static Matrix operator -(in Matrix left, in Matrix right)

Parameters

left Matrix

The first matrix to subtract.

right Matrix

The second matrix to subtract.

Returns

Matrix

The difference between the two matrices.

operator -(in Matrix)

Negates a matrix.

public static Matrix operator -(in Matrix value)

Parameters

value Matrix

The matrix to negate.

Returns

Matrix

The negated matrix.

operator +(in Matrix)

Assert a matrix (return it unchanged).

public static Matrix operator +(in Matrix value)

Parameters

value Matrix

The matrix to assert (unchange).

Returns

Matrix

The asserted (unchanged) matrix.