Table of Contents

Struct Matrix3x3

Namespace
HelixToolkit.Maths
Assembly
HelixToolkit.Maths.dll

Represents a 3x3 Matrix ( contains only Scale and Rotation ).

public struct Matrix3x3 : IEquatable<Matrix3x3>, IFormattable
Implements
Inherited Members
Extension Methods

Constructors

Matrix3x3(float)

Initializes a new instance of the Matrix3x3 struct.

public Matrix3x3(float value)

Parameters

value float

The value that will be assigned to all components.

Matrix3x3(float, float, float, float, float, float, float, float, float)

Initializes a new instance of the Matrix3x3 struct.

public Matrix3x3(float M11, float M12, float M13, float M21, float M22, float M23, float M31, float M32, float M33)

Parameters

M11 float

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

M12 float

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

M13 float

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

M21 float

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

M22 float

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

M23 float

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

M31 float

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

M32 float

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

M33 float

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

Matrix3x3(float[])

Initializes a new instance of the Matrix3x3 struct.

public Matrix3x3(float[] values)

Parameters

values float[]

The values to assign to the components of the Matrix3x3. 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 Matrix3x3.

public static readonly Matrix3x3 Identity

Field Value

Matrix3x3

M11

Value at row 1 column 1 of the Matrix3x3.

public float M11

Field Value

float

M12

Value at row 1 column 2 of the Matrix3x3.

public float M12

Field Value

float

M13

Value at row 1 column 3 of the Matrix3x3.

public float M13

Field Value

float

M21

Value at row 2 column 1 of the Matrix3x3.

public float M21

Field Value

float

M22

Value at row 2 column 2 of the Matrix3x3.

public float M22

Field Value

float

M23

Value at row 2 column 3 of the Matrix3x3.

public float M23

Field Value

float

M31

Value at row 3 column 1 of the Matrix3x3.

public float M31

Field Value

float

M32

Value at row 3 column 2 of the Matrix3x3.

public float M32

Field Value

float

M33

Value at row 3 column 3 of the Matrix3x3.

public float M33

Field Value

float

SizeInBytes

The size of the Matrix3x3 type, in bytes.

public static readonly int SizeInBytes

Field Value

int

Zero

A Matrix3x3 with all of its components set to zero.

public static readonly Matrix3x3 Zero

Field Value

Matrix3x3

Properties

Column1

Gets or sets the first column in the Matrix3x3; that is M11, M21, M31

public Vector3 Column1 { readonly get; set; }

Property Value

Vector3

Column2

Gets or sets the second column in the Matrix3x3; that is M12, M22, M32

public Vector3 Column2 { readonly get; set; }

Property Value

Vector3

Column3

Gets or sets the third column in the Matrix3x3; that is M13, M23, M33

public Vector3 Column3 { readonly get; set; }

Property Value

Vector3

IsIdentity

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

public readonly bool IsIdentity { get; }

Property Value

bool

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

this[int]

Gets or sets the component at the specified index.

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

Parameters

index int

The zero-based index of the component to access.

Property Value

float

The value of the Matrix3x3 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] { readonly get; set; }

Parameters

row int

The row of the Matrix3x3 to access.

column int

The column of the Matrix3x3 to access.

Property Value

float

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

Exceptions

ArgumentOutOfRangeException

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

Row1

Gets or sets the first row in the Matrix3x3; that is M11, M12, M13

public Vector3 Row1 { readonly get; set; }

Property Value

Vector3

Row2

Gets or sets the second row in the Matrix3x3; that is M21, M22, M23

public Vector3 Row2 { readonly get; set; }

Property Value

Vector3

Row3

Gets or sets the third row in the Matrix3x3; that is M31, M32, M33

public Vector3 Row3 { readonly get; set; }

Property Value

Vector3

ScaleVector

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

public Vector3 ScaleVector { readonly get; set; }

Property Value

Vector3

Methods

Add(Matrix3x3, Matrix3x3)

Determines the sum of two matrices.

public static Matrix3x3 Add(Matrix3x3 left, Matrix3x3 right)

Parameters

left Matrix3x3

The first Matrix3x3 to add.

right Matrix3x3

The second Matrix3x3 to add.

Returns

Matrix3x3

The sum of the two matrices.

Add(ref Matrix3x3, ref Matrix3x3, out Matrix3x3)

Determines the sum of two matrices.

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

Parameters

left Matrix3x3

The first Matrix3x3 to add.

right Matrix3x3

The second Matrix3x3 to add.

result Matrix3x3

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

BillboardLH(Vector3, Vector3, Vector3, Vector3)

Creates a left-handed spherical billboard that rotates around a specified object position.

public static Matrix3x3 BillboardLH(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

Matrix3x3

The created billboard Matrix3x3.

BillboardLH(ref Vector3, ref Vector3, ref Vector3, ref Vector3, out Matrix3x3)

Creates a left-handed spherical billboard that rotates around a specified object position.

public static void BillboardLH(ref Vector3 objectPosition, ref Vector3 cameraPosition, ref Vector3 cameraUpVector, ref Vector3 cameraForwardVector, out Matrix3x3 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 Matrix3x3

When the method completes, contains the created billboard Matrix3x3.

BillboardRH(Vector3, Vector3, Vector3, Vector3)

Creates a right-handed spherical billboard that rotates around a specified object position.

public static Matrix3x3 BillboardRH(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

Matrix3x3

The created billboard Matrix3x3.

BillboardRH(ref Vector3, ref Vector3, ref Vector3, ref Vector3, out Matrix3x3)

Creates a right-handed spherical billboard that rotates around a specified object position.

public static void BillboardRH(ref Vector3 objectPosition, ref Vector3 cameraPosition, ref Vector3 cameraUpVector, ref Vector3 cameraForwardVector, out Matrix3x3 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 Matrix3x3

When the method completes, contains the created billboard Matrix3x3.

Decompose(out Vector3, out Quaternion)

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

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

Parameters

scale Vector3

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

rotation Quaternion

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

Returns

bool

Remarks

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

DecomposeLQ(out Matrix3x3, out Matrix3x3)

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

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

Parameters

L Matrix3x3

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

Q Matrix3x3

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

DecomposeQR(out Matrix3x3, out Matrix3x3)

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

public readonly void DecomposeQR(out Matrix3x3 Q, out Matrix3x3 R)

Parameters

Q Matrix3x3

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

R Matrix3x3

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

DecomposeUniformScale(out float, out Quaternion)

Decomposes a uniform scale matrix into a scale, rotation, and translation. A uniform scale matrix has the same scale in every axis.

public readonly bool DecomposeUniformScale(out float scale, out Quaternion rotation)

Parameters

scale float

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.

Returns

bool

Remarks

This method is designed to decompose only an SRT transformation matrix that has the same scale in every axis.

Determinant()

Calculates the determinant of the Matrix3x3.

public readonly float Determinant()

Returns

float

The determinant of the Matrix3x3.

Divide(Matrix3x3, Matrix3x3)

Determines the quotient of two matrices.

public static Matrix3x3 Divide(Matrix3x3 left, Matrix3x3 right)

Parameters

left Matrix3x3

The first Matrix3x3 to divide.

right Matrix3x3

The second Matrix3x3 to divide.

Returns

Matrix3x3

The quotient of the two matrices.

Divide(Matrix3x3, float)

Scales a Matrix3x3 by the given value.

public static Matrix3x3 Divide(Matrix3x3 left, float right)

Parameters

left Matrix3x3

The Matrix3x3 to scale.

right float

The amount by which to scale.

Returns

Matrix3x3

The scaled Matrix3x3.

Divide(ref Matrix3x3, ref Matrix3x3, out Matrix3x3)

Determines the quotient of two matrices.

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

Parameters

left Matrix3x3

The first Matrix3x3 to divide.

right Matrix3x3

The second Matrix3x3 to divide.

result Matrix3x3

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

Divide(ref Matrix3x3, float, out Matrix3x3)

Scales a Matrix3x3 by the given value.

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

Parameters

left Matrix3x3

The Matrix3x3 to scale.

right float

The amount by which to scale.

result Matrix3x3

When the method completes, contains the scaled Matrix3x3.

Equals(Matrix3x3)

Determines whether the specified Matrix3x3 is equal to this instance.

public readonly bool Equals(Matrix3x3 other)

Parameters

other Matrix3x3

The Matrix3x3 to compare with this instance.

Returns

bool

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

Equals(ref Matrix3x3)

Determines whether the specified Matrix3x3 is equal to this instance.

public readonly bool Equals(ref Matrix3x3 other)

Parameters

other Matrix3x3

The Matrix3x3 to compare with this instance.

Returns

bool

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

Equals(ref Matrix3x3, ref Matrix3x3)

Determines whether the specified Matrix3x3 are equal.

public static bool Equals(ref Matrix3x3 a, ref Matrix3x3 b)

Parameters

a Matrix3x3
b Matrix3x3

Returns

bool

Equals(object?)

Determines whether the specified object is equal to this instance.

public override readonly 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)

Exchanges two columns in the Matrix3x3.

public void ExchangeColumns(int firstColumn, int secondColumn)

Parameters

firstColumn int

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

secondColumn int

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

ExchangeRows(int, int)

Exchanges two rows in the Matrix3x3.

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(Matrix3x3, int)

Performs the exponential operation on a Matrix3x3.

public static Matrix3x3 Exponent(Matrix3x3 value, int exponent)

Parameters

value Matrix3x3

The Matrix3x3 to perform the operation on.

exponent int

The exponent to raise the Matrix3x3 to.

Returns

Matrix3x3

The exponential Matrix3x3.

Exceptions

ArgumentOutOfRangeException

Thrown when the exponent is negative.

Exponent(ref Matrix3x3, int, out Matrix3x3)

Performs the exponential operation on a Matrix3x3.

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

Parameters

value Matrix3x3

The Matrix3x3 to perform the operation on.

exponent int

The exponent to raise the Matrix3x3 to.

result Matrix3x3

When the method completes, contains the exponential Matrix3x3.

Exceptions

ArgumentOutOfRangeException

Thrown when the exponent is negative.

GetHashCode()

Returns a hash code for this instance.

public override readonly 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 Matrix3x3.

public void Invert()

Invert(Matrix3x3)

Calculates the inverse of the specified Matrix3x3.

public static Matrix3x3 Invert(Matrix3x3 value)

Parameters

value Matrix3x3

The Matrix3x3 whose inverse is to be calculated.

Returns

Matrix3x3

The inverse of the specified Matrix3x3.

Invert(ref Matrix3x3, out Matrix3x3)

Calculates the inverse of the specified Matrix3x3.

public static void Invert(ref Matrix3x3 value, out Matrix3x3 result)

Parameters

value Matrix3x3

The Matrix3x3 whose inverse is to be calculated.

result Matrix3x3

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

Lerp(Matrix3x3, Matrix3x3, float)

Performs a linear interpolation between two matrices.

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

Parameters

start Matrix3x3

Start Matrix3x3.

end Matrix3x3

End Matrix3x3.

amount float

Value between 0 and 1 indicating the weight of end.

Returns

Matrix3x3

The linear interpolation of the two matrices.

Remarks

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

Lerp(ref Matrix3x3, ref Matrix3x3, float, out Matrix3x3)

Performs a linear interpolation between two matrices.

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

Parameters

start Matrix3x3

Start Matrix3x3.

end Matrix3x3

End Matrix3x3.

amount float

Value between 0 and 1 indicating the weight of end.

result Matrix3x3

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

Remarks

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 Matrix3x3.

public static Matrix3x3 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

Matrix3x3

The created look-at Matrix3x3.

LookAtLH(ref Vector3, ref Vector3, ref Vector3, out Matrix3x3)

Creates a left-handed, look-at Matrix3x3.

public static void LookAtLH(ref Vector3 eye, ref Vector3 target, ref Vector3 up, out Matrix3x3 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 Matrix3x3

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

LookAtRH(Vector3, Vector3, Vector3)

Creates a right-handed, look-at Matrix3x3.

public static Matrix3x3 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

Matrix3x3

The created look-at Matrix3x3.

LookAtRH(ref Vector3, ref Vector3, ref Vector3, out Matrix3x3)

Creates a right-handed, look-at Matrix3x3.

public static void LookAtRH(ref Vector3 eye, ref Vector3 target, ref Vector3 up, out Matrix3x3 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 Matrix3x3

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

LowerTriangularForm(Matrix3x3)

Brings the Matrix3x3 into lower triangular form using elementary row operations.

public static Matrix3x3 LowerTriangularForm(Matrix3x3 value)

Parameters

value Matrix3x3

The Matrix3x3 to put into lower triangular form.

Returns

Matrix3x3

The lower triangular Matrix3x3.

Remarks

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

LowerTriangularForm(ref Matrix3x3, out Matrix3x3)

Brings the Matrix3x3 into lower triangular form using elementary row operations.

public static void LowerTriangularForm(ref Matrix3x3 value, out Matrix3x3 result)

Parameters

value Matrix3x3

The Matrix3x3 to put into lower triangular form.

result Matrix3x3

When the method completes, contains the lower triangular Matrix3x3.

Remarks

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

Multiply(Matrix3x3, Matrix3x3)

Determines the product of two matrices.

public static Matrix3x3 Multiply(Matrix3x3 left, Matrix3x3 right)

Parameters

left Matrix3x3

The first Matrix3x3 to multiply.

right Matrix3x3

The second Matrix3x3 to multiply.

Returns

Matrix3x3

The product of the two matrices.

Multiply(Matrix3x3, float)

Scales a Matrix3x3 by the given value.

public static Matrix3x3 Multiply(Matrix3x3 left, float right)

Parameters

left Matrix3x3

The Matrix3x3 to scale.

right float

The amount by which to scale.

Returns

Matrix3x3

The scaled Matrix3x3.

Multiply(ref Matrix3x3, ref Matrix3x3, out Matrix3x3)

Determines the product of two matrices.

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

Parameters

left Matrix3x3

The first Matrix3x3 to multiply.

right Matrix3x3

The second Matrix3x3 to multiply.

result Matrix3x3

The product of the two matrices.

Multiply(ref Matrix3x3, float, out Matrix3x3)

Scales a Matrix3x3 by the given value.

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

Parameters

left Matrix3x3

The Matrix3x3 to scale.

right float

The amount by which to scale.

result Matrix3x3

When the method completes, contains the scaled Matrix3x3.

Negate(Matrix3x3)

Negates a Matrix3x3.

public static Matrix3x3 Negate(Matrix3x3 value)

Parameters

value Matrix3x3

The Matrix3x3 to be negated.

Returns

Matrix3x3

The negated Matrix3x3.

Negate(ref Matrix3x3, out Matrix3x3)

Negates a Matrix3x3.

public static void Negate(ref Matrix3x3 value, out Matrix3x3 result)

Parameters

value Matrix3x3

The Matrix3x3 to be negated.

result Matrix3x3

When the method completes, contains the negated Matrix3x3.

Orthogonalize()

Orthogonalizes the specified Matrix3x3.

public void Orthogonalize()

Remarks

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

Because this method uses the modified Gram-Schmidt process, the resulting Matrix3x3 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 Matrix3x3 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(Matrix3x3)

Orthogonalizes the specified Matrix3x3.

public static Matrix3x3 Orthogonalize(Matrix3x3 value)

Parameters

value Matrix3x3

The Matrix3x3 to orthogonalize.

Returns

Matrix3x3

The orthogonalized Matrix3x3.

Remarks

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

Because this method uses the modified Gram-Schmidt process, the resulting Matrix3x3 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 Matrix3x3 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 Matrix3x3, out Matrix3x3)

Orthogonalizes the specified Matrix3x3.

public static void Orthogonalize(ref Matrix3x3 value, out Matrix3x3 result)

Parameters

value Matrix3x3

The Matrix3x3 to orthogonalize.

result Matrix3x3

When the method completes, contains the orthogonalized Matrix3x3.

Remarks

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

Because this method uses the modified Gram-Schmidt process, the resulting Matrix3x3 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 Matrix3x3 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 Matrix3x3.

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 Matrix3x3 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 Matrix3x3 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(Matrix3x3)

Orthonormalizes the specified Matrix3x3.

public static Matrix3x3 Orthonormalize(Matrix3x3 value)

Parameters

value Matrix3x3

The Matrix3x3 to orthonormalize.

Returns

Matrix3x3

The orthonormalized Matrix3x3.

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 Matrix3x3 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 Matrix3x3 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 Matrix3x3, out Matrix3x3)

Orthonormalizes the specified Matrix3x3.

public static void Orthonormalize(ref Matrix3x3 value, out Matrix3x3 result)

Parameters

value Matrix3x3

The Matrix3x3 to orthonormalize.

result Matrix3x3

When the method completes, contains the orthonormalized Matrix3x3.

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 Matrix3x3 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 Matrix3x3 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.

RotationAxis(Vector3, float)

Creates a Matrix3x3 that rotates around an arbitrary axis.

public static Matrix3x3 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

Matrix3x3

The created rotation Matrix3x3.

RotationAxis(ref Vector3, float, out Matrix3x3)

Creates a Matrix3x3 that rotates around an arbitrary axis.

public static void RotationAxis(ref Vector3 axis, float angle, out Matrix3x3 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 Matrix3x3

When the method completes, contains the created rotation Matrix3x3.

RotationQuaternion(Quaternion)

Creates a rotation Matrix3x3 from a quaternion.

public static Matrix3x3 RotationQuaternion(Quaternion rotation)

Parameters

rotation Quaternion

The quaternion to use to build the Matrix3x3.

Returns

Matrix3x3

The created rotation Matrix3x3.

RotationQuaternion(ref Quaternion, out Matrix3x3)

Creates a rotation Matrix3x3 from a quaternion.

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

Parameters

rotation Quaternion

The quaternion to use to build the Matrix3x3.

result Matrix3x3

The created rotation Matrix3x3.

RotationX(float)

Creates a Matrix3x3 that rotates around the x-axis.

public static Matrix3x3 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

Matrix3x3

The created rotation Matrix3x3.

RotationX(float, out Matrix3x3)

Creates a Matrix3x3 that rotates around the x-axis.

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

Parameters

angle float

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

result Matrix3x3

When the method completes, contains the created rotation Matrix3x3.

RotationY(float)

Creates a Matrix3x3 that rotates around the y-axis.

public static Matrix3x3 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

Matrix3x3

The created rotation Matrix3x3.

RotationY(float, out Matrix3x3)

Creates a Matrix3x3 that rotates around the y-axis.

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

Parameters

angle float

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

result Matrix3x3

When the method completes, contains the created rotation Matrix3x3.

RotationYawPitchRoll(float, float, float)

Creates a rotation Matrix3x3 with a specified yaw, pitch, and roll.

public static Matrix3x3 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

Matrix3x3

The created rotation Matrix3x3.

RotationYawPitchRoll(float, float, float, out Matrix3x3)

Creates a rotation Matrix3x3 with a specified yaw, pitch, and roll.

public static void RotationYawPitchRoll(float yaw, float pitch, float roll, out Matrix3x3 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 Matrix3x3

When the method completes, contains the created rotation Matrix3x3.

RotationZ(float)

Creates a Matrix3x3 that rotates around the z-axis.

public static Matrix3x3 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

Matrix3x3

The created rotation Matrix3x3.

RotationZ(float, out Matrix3x3)

Creates a Matrix3x3 that rotates around the z-axis.

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

Parameters

angle float

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

result Matrix3x3

When the method completes, contains the created rotation Matrix3x3.

RowEchelonForm(Matrix3x3)

Brings the Matrix3x3 into row echelon form using elementary row operations;

public static Matrix3x3 RowEchelonForm(Matrix3x3 value)

Parameters

value Matrix3x3

The Matrix3x3 to put into row echelon form.

Returns

Matrix3x3

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

RowEchelonForm(ref Matrix3x3, out Matrix3x3)

Brings the Matrix3x3 into row echelon form using elementary row operations;

public static void RowEchelonForm(ref Matrix3x3 value, out Matrix3x3 result)

Parameters

value Matrix3x3

The Matrix3x3 to put into row echelon form.

result Matrix3x3

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

Scaling(Vector3)

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

public static Matrix3x3 Scaling(Vector3 scale)

Parameters

scale Vector3

Scaling factor for all three axes.

Returns

Matrix3x3

The created scaling Matrix3x3.

Scaling(ref Vector3, out Matrix3x3)

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

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

Parameters

scale Vector3

Scaling factor for all three axes.

result Matrix3x3

When the method completes, contains the created scaling Matrix3x3.

Scaling(float)

Creates a Matrix3x3 that uniformly scales along all three axis.

public static Matrix3x3 Scaling(float scale)

Parameters

scale float

The uniform scale that is applied along all axis.

Returns

Matrix3x3

The created scaling Matrix3x3.

Scaling(float, out Matrix3x3)

Creates a Matrix3x3 that uniformly scales along all three axis.

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

Parameters

scale float

The uniform scale that is applied along all axis.

result Matrix3x3

When the method completes, contains the created scaling Matrix3x3.

Scaling(float, float, float)

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

public static Matrix3x3 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

Matrix3x3

The created scaling Matrix3x3.

Scaling(float, float, float, out Matrix3x3)

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

public static void Scaling(float x, float y, float z, out Matrix3x3 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 Matrix3x3

When the method completes, contains the created scaling Matrix3x3.

SmoothStep(Matrix3x3, Matrix3x3, float)

Performs a cubic interpolation between two matrices.

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

Parameters

start Matrix3x3

Start Matrix3x3.

end Matrix3x3

End Matrix3x3.

amount float

Value between 0 and 1 indicating the weight of end.

Returns

Matrix3x3

The cubic interpolation of the two matrices.

SmoothStep(ref Matrix3x3, ref Matrix3x3, float, out Matrix3x3)

Performs a cubic interpolation between two matrices.

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

Parameters

start Matrix3x3

Start Matrix3x3.

end Matrix3x3

End Matrix3x3.

amount float

Value between 0 and 1 indicating the weight of end.

result Matrix3x3

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

Subtract(Matrix3x3, Matrix3x3)

Determines the difference between two matrices.

public static Matrix3x3 Subtract(Matrix3x3 left, Matrix3x3 right)

Parameters

left Matrix3x3

The first Matrix3x3 to subtract.

right Matrix3x3

The second Matrix3x3 to subtract.

Returns

Matrix3x3

The difference between the two matrices.

Subtract(ref Matrix3x3, ref Matrix3x3, out Matrix3x3)

Determines the difference between two matrices.

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

Parameters

left Matrix3x3

The first Matrix3x3 to subtract.

right Matrix3x3

The second Matrix3x3 to subtract.

result Matrix3x3

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

ToArray()

Creates an array containing the elements of the Matrix3x3.

public readonly float[] ToArray()

Returns

float[]

A 9-element array containing the components of the Matrix3x3.

ToMatrix()

public readonly Matrix4x4 ToMatrix()

Returns

Matrix4x4

ToString()

Returns a string that represents this instance.

public override readonly string ToString()

Returns

string

A string that represents this instance.

ToString(IFormatProvider)

Returns a string that represents this instance.

public readonly 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 readonly 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 readonly string ToString(string? format, IFormatProvider? formatProvider)

Parameters

format string

The format.

formatProvider IFormatProvider

The format provider.

Returns

string

A string that represents this instance.

Transpose()

Transposes the Matrix3x3.

public void Transpose()

Transpose(Matrix3x3)

Calculates the transpose of the specified Matrix3x3.

public static Matrix3x3 Transpose(Matrix3x3 value)

Parameters

value Matrix3x3

The Matrix3x3 whose transpose is to be calculated.

Returns

Matrix3x3

The transpose of the specified Matrix3x3.

Transpose(ref Matrix3x3, out Matrix3x3)

Calculates the transpose of the specified Matrix3x3.

public static void Transpose(ref Matrix3x3 value, out Matrix3x3 result)

Parameters

value Matrix3x3

The Matrix3x3 whose transpose is to be calculated.

result Matrix3x3

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

TransposeByRef(ref Matrix3x3, ref Matrix3x3)

Calculates the transpose of the specified Matrix3x3.

public static void TransposeByRef(ref Matrix3x3 value, ref Matrix3x3 result)

Parameters

value Matrix3x3

The Matrix3x3 whose transpose is to be calculated.

result Matrix3x3

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

UpperTriangularForm(Matrix3x3)

Brings the Matrix3x3 into upper triangular form using elementary row operations.

public static Matrix3x3 UpperTriangularForm(Matrix3x3 value)

Parameters

value Matrix3x3

The Matrix3x3 to put into upper triangular form.

Returns

Matrix3x3

The upper triangular Matrix3x3.

Remarks

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

UpperTriangularForm(ref Matrix3x3, out Matrix3x3)

Brings the Matrix3x3 into upper triangular form using elementary row operations.

public static void UpperTriangularForm(ref Matrix3x3 value, out Matrix3x3 result)

Parameters

value Matrix3x3

The Matrix3x3 to put into upper triangular form.

result Matrix3x3

When the method completes, contains the upper triangular Matrix3x3.

Remarks

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

Operators

operator +(Matrix3x3, Matrix3x3)

Adds two matrices.

public static Matrix3x3 operator +(Matrix3x3 left, Matrix3x3 right)

Parameters

left Matrix3x3

The first Matrix3x3 to add.

right Matrix3x3

The second Matrix3x3 to add.

Returns

Matrix3x3

The sum of the two matrices.

operator /(Matrix3x3, Matrix3x3)

Divides two matrices.

public static Matrix3x3 operator /(Matrix3x3 left, Matrix3x3 right)

Parameters

left Matrix3x3

The first Matrix3x3 to divide.

right Matrix3x3

The second Matrix3x3 to divide.

Returns

Matrix3x3

The quotient of the two matrices.

operator /(Matrix3x3, float)

Scales a Matrix3x3 by a given value.

public static Matrix3x3 operator /(Matrix3x3 left, float right)

Parameters

left Matrix3x3

The Matrix3x3 to scale.

right float

The amount by which to scale.

Returns

Matrix3x3

The scaled Matrix3x3.

operator ==(Matrix3x3, Matrix3x3)

Tests for equality between two objects.

public static bool operator ==(Matrix3x3 left, Matrix3x3 right)

Parameters

left Matrix3x3

The first value to compare.

right Matrix3x3

The second value to compare.

Returns

bool

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

explicit operator Matrix4x4(Matrix3x3)

Convert the 3x3 Matrix to a 4x4 Matrix.

public static explicit operator Matrix4x4(Matrix3x3 Value)

Parameters

Value Matrix3x3

Returns

Matrix4x4

A 4x4 Matrix with zero translation and M44=1

explicit operator Matrix3x3(Matrix4x4)

Convert the 4x4 Matrix to a 3x3 Matrix.

public static explicit operator Matrix3x3(Matrix4x4 Value)

Parameters

Value Matrix4x4

Returns

Matrix3x3

A 3x3 Matrix

operator !=(Matrix3x3, Matrix3x3)

Tests for inequality between two objects.

public static bool operator !=(Matrix3x3 left, Matrix3x3 right)

Parameters

left Matrix3x3

The first value to compare.

right Matrix3x3

The second value to compare.

Returns

bool

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

operator *(Matrix3x3, Matrix3x3)

Multiplies two matrices.

public static Matrix3x3 operator *(Matrix3x3 left, Matrix3x3 right)

Parameters

left Matrix3x3

The first Matrix3x3 to multiply.

right Matrix3x3

The second Matrix3x3 to multiply.

Returns

Matrix3x3

The product of the two matrices.

operator *(Matrix3x3, float)

Scales a Matrix3x3 by a given value.

public static Matrix3x3 operator *(Matrix3x3 left, float right)

Parameters

left Matrix3x3

The Matrix3x3 to scale.

right float

The amount by which to scale.

Returns

Matrix3x3

The scaled Matrix3x3.

operator *(float, Matrix3x3)

Scales a Matrix3x3 by a given value.

public static Matrix3x3 operator *(float left, Matrix3x3 right)

Parameters

left float

The amount by which to scale.

right Matrix3x3

The Matrix3x3 to scale.

Returns

Matrix3x3

The scaled Matrix3x3.

operator -(Matrix3x3, Matrix3x3)

Subtracts two matrices.

public static Matrix3x3 operator -(Matrix3x3 left, Matrix3x3 right)

Parameters

left Matrix3x3

The first Matrix3x3 to subtract.

right Matrix3x3

The second Matrix3x3 to subtract.

Returns

Matrix3x3

The difference between the two matrices.

operator -(Matrix3x3)

Negates a Matrix3x3.

public static Matrix3x3 operator -(Matrix3x3 value)

Parameters

value Matrix3x3

The Matrix3x3 to negate.

Returns

Matrix3x3

The negated Matrix3x3.

operator +(Matrix3x3)

Assert a Matrix3x3 (return it unchanged).

public static Matrix3x3 operator +(Matrix3x3 value)

Parameters

value Matrix3x3

The Matrix3x3 to assert (unchanged).

Returns

Matrix3x3

The asserted (unchanged) Matrix3x3.