Class Matrix
Represents a 4x4 mathematical matrix.
Inheritance
Implements
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public sealed class Matrix : ValueType, IEquatable<Matrix>, IFormattable
Constructors
Matrix(Matrix3x3)
Initializes a new instance of the Matrix struct.
Declaration
public Matrix(Matrix3x3 m)
Parameters
Matrix3x3
m
The rotation/scale matrix. |
Matrix(Single)
Initializes a new instance of the Matrix struct.
Declaration
public Matrix(float value)
Parameters
System.Single
value
The value that will be assigned to all components. |
Matrix(Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single)
Initializes a new instance of the Matrix struct.
Declaration
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
System.Single
m11
The value to assign at row 1 column 1 of the matrix. |
System.Single
m12
The value to assign at row 1 column 2 of the matrix. |
System.Single
m13
The value to assign at row 1 column 3 of the matrix. |
System.Single
m14
The value to assign at row 1 column 4 of the matrix. |
System.Single
m21
The value to assign at row 2 column 1 of the matrix. |
System.Single
m22
The value to assign at row 2 column 2 of the matrix. |
System.Single
m23
The value to assign at row 2 column 3 of the matrix. |
System.Single
m24
The value to assign at row 2 column 4 of the matrix. |
System.Single
m31
The value to assign at row 3 column 1 of the matrix. |
System.Single
m32
The value to assign at row 3 column 2 of the matrix. |
System.Single
m33
The value to assign at row 3 column 3 of the matrix. |
System.Single
m34
The value to assign at row 3 column 4 of the matrix. |
System.Single
m41
The value to assign at row 4 column 1 of the matrix. |
System.Single
m42
The value to assign at row 4 column 2 of the matrix. |
System.Single
m43
The value to assign at row 4 column 3 of the matrix. |
System.Single
m44
The value to assign at row 4 column 4 of the matrix. |
Matrix(Single[])
Initializes a new instance of the Matrix struct.
Declaration
public Matrix(float[] values)
Parameters
System.Single[]
values
The values to assign to the components of the matrix. This must be an array with sixteen elements. |
Exceptions
System.ArgumentNullException
Thrown when |
System.ArgumentOutOfRangeException
Thrown when |
Fields
Identity
M11
Value at row 1 column 1 of the matrix.
Declaration
public float M11
Field Value
System.Single
|
M12
Value at row 1 column 2 of the matrix.
Declaration
public float M12
Field Value
System.Single
|
M13
Value at row 1 column 3 of the matrix.
Declaration
public float M13
Field Value
System.Single
|
M14
Value at row 1 column 4 of the matrix.
Declaration
public float M14
Field Value
System.Single
|
M21
Value at row 2 column 1 of the matrix.
Declaration
public float M21
Field Value
System.Single
|
M22
Value at row 2 column 2 of the matrix.
Declaration
public float M22
Field Value
System.Single
|
M23
Value at row 2 column 3 of the matrix.
Declaration
public float M23
Field Value
System.Single
|
M24
Value at row 2 column 4 of the matrix.
Declaration
public float M24
Field Value
System.Single
|
M31
Value at row 3 column 1 of the matrix.
Declaration
public float M31
Field Value
System.Single
|
M32
Value at row 3 column 2 of the matrix.
Declaration
public float M32
Field Value
System.Single
|
M33
Value at row 3 column 3 of the matrix.
Declaration
public float M33
Field Value
System.Single
|
M34
Value at row 3 column 4 of the matrix.
Declaration
public float M34
Field Value
System.Single
|
M41
Value at row 4 column 1 of the matrix.
Declaration
public float M41
Field Value
System.Single
|
M42
Value at row 4 column 2 of the matrix.
Declaration
public float M42
Field Value
System.Single
|
M43
Value at row 4 column 3 of the matrix.
Declaration
public float M43
Field Value
System.Single
|
M44
Value at row 4 column 4 of the matrix.
Declaration
public float M44
Field Value
System.Single
|
SizeInBytes
The size of the Matrix type, in bytes.
Declaration
public static readonly int SizeInBytes
Field Value
System.Int32
|
Zero
A Matrix with all of its components set to zero.
Declaration
public static readonly Matrix Zero
Field Value
Matrix
|
Properties
Backward
Gets or sets the backward Float3 of the matrix; that is M31, M32, and M33.
Declaration
public Float3 Backward { get; set; }
Property Value
Float3
|
Column1
Gets or sets the first column in the matrix; that is M11, M21, M31, and M41.
Declaration
public Float4 Column1 { get; set; }
Property Value
Float4
|
Column2
Gets or sets the second column in the matrix; that is M12, M22, M32, and M42.
Declaration
public Float4 Column2 { get; set; }
Property Value
Float4
|
Column3
Gets or sets the third column in the matrix; that is M13, M23, M33, and M43.
Declaration
public Float4 Column3 { get; set; }
Property Value
Float4
|
Column4
Gets or sets the fourth column in the matrix; that is M14, M24, M34, and M44.
Declaration
public Float4 Column4 { get; set; }
Property Value
Float4
|
Default
Down
Gets or sets the down Float3 of the matrix; that is -M21, -M22, and -M23.
Declaration
public Float3 Down { get; set; }
Property Value
Float3
|
Forward
Gets or sets the forward Float3 of the matrix; that is -M31, -M32, and -M33.
Declaration
public Float3 Forward { get; set; }
Property Value
Float3
|
IsIdentity
Gets a value indicating whether this instance is an identity matrix.
Declaration
public bool IsIdentity { get; }
Property Value
System.Boolean
|
Item[Int32]
Gets or sets the component at the specified index.
Declaration
public float this[int index] { get; set; }
Parameters
System.Int32
index
The zero-based index of the component to access. |
Property Value
System.Single
The value of the component at the specified index. |
Exceptions
System.ArgumentOutOfRangeException
Thrown when the |
Item[Int32, Int32]
Gets or sets the component at the specified index.
Declaration
public float this[int row, int column] { get; set; }
Parameters
System.Int32
row
The row of the matrix to access. |
System.Int32
column
The column of the matrix to access. |
Property Value
System.Single
The value of the matrix component, depending on the index. |
Exceptions
System.ArgumentOutOfRangeException
Thrown when the |
Left
Gets or sets the left Float3 of the matrix; that is -M11, -M12, and -M13.
Declaration
public Float3 Left { get; set; }
Property Value
Float3
|
Right
Gets or sets the right Float3 of the matrix; that is M11, M12, and M13.
Declaration
public Float3 Right { get; set; }
Property Value
Float3
|
Row1
Gets or sets the first row in the matrix; that is M11, M12, M13, and M14.
Declaration
public Float4 Row1 { get; set; }
Property Value
Float4
|
Row2
Gets or sets the second row in the matrix; that is M21, M22, M23, and M24.
Declaration
public Float4 Row2 { get; set; }
Property Value
Float4
|
Row3
Gets or sets the third row in the matrix; that is M31, M32, M33, and M34.
Declaration
public Float4 Row3 { get; set; }
Property Value
Float4
|
Row4
Gets or sets the fourth row in the matrix; that is M41, M42, M43, and M44.
Declaration
public Float4 Row4 { get; set; }
Property Value
Float4
|
ScaleVector
Gets or sets the scale of the matrix; that is M11, M22, and M33.
Declaration
public Float3 ScaleVector { get; set; }
Property Value
Float3
|
TranslationVector
Gets or sets the translation of the matrix; that is M41, M42, and M43.
Declaration
public Float3 TranslationVector { get; set; }
Property Value
Float3
|
Up
Gets or sets the up Float3 of the matrix; that is M21, M22, and M23.
Declaration
public Float3 Up { get; set; }
Property Value
Float3
|
Methods
Add(Matrix, Matrix)
Determines the sum of two matrices.
Declaration
public static Matrix Add(Matrix left, Matrix right)
Parameters
Matrix
left
The first matrix to add. |
Matrix
right
The second matrix to add. |
Returns
Matrix
The sum of the two matrices. |
Add(ref Matrix, ref Matrix, out Matrix)
Determines the sum of two matrices.
Declaration
public static void Add(ref Matrix left, ref Matrix right, out Matrix result)
Parameters
Matrix
left
The first matrix to add. |
Matrix
right
The second matrix to add. |
Matrix
result
When the method completes, contains the sum of the two matrices. |
AffineTransformation(Single, Float3, Quaternion, Float3)
Creates a 3D affine transformation matrix.
Declaration
public static Matrix AffineTransformation(float scaling, Float3 rotationCenter, Quaternion rotation, Float3 translation)
Parameters
System.Single
scaling
Scaling factor. |
Float3
rotationCenter
The center of the rotation. |
Quaternion
rotation
The rotation of the transformation. |
Float3
translation
The translation factor of the transformation. |
Returns
Matrix
The created affine transformation matrix. |
AffineTransformation(Single, ref Float3, ref Quaternion, ref Float3, out Matrix)
Creates a 3D affine transformation matrix.
Declaration
public static void AffineTransformation(float scaling, ref Float3 rotationCenter, ref Quaternion rotation, ref Float3 translation, out Matrix result)
Parameters
System.Single
scaling
Scaling factor. |
Float3
rotationCenter
The center of the rotation. |
Quaternion
rotation
The rotation of the transformation. |
Float3
translation
The translation factor of the transformation. |
Matrix
result
When the method completes, contains the created affine transformation matrix. |
AffineTransformation(Single, Quaternion, Float3)
Creates a 3D affine transformation matrix.
Declaration
public static Matrix AffineTransformation(float scaling, Quaternion rotation, Float3 translation)
Parameters
System.Single
scaling
Scaling factor. |
Quaternion
rotation
The rotation of the transformation. |
Float3
translation
The translation factor of the transformation. |
Returns
Matrix
The created affine transformation matrix. |
AffineTransformation(Single, ref Quaternion, ref Float3, out Matrix)
Creates a 3D affine transformation matrix.
Declaration
public static void AffineTransformation(float scaling, ref Quaternion rotation, ref Float3 translation, out Matrix result)
Parameters
System.Single
scaling
Scaling factor. |
Quaternion
rotation
The rotation of the transformation. |
Float3
translation
The translation factor of the transformation. |
Matrix
result
When the method completes, contains the created affine transformation matrix. |
AffineTransformation2D(Single, Float2, Single, Float2)
Creates a 2D affine transformation matrix.
Declaration
public static Matrix AffineTransformation2D(float scaling, Float2 rotationCenter, float rotation, Float2 translation)
Parameters
System.Single
scaling
Scaling factor. |
Float2
rotationCenter
The center of the rotation. |
System.Single
rotation
The rotation of the transformation. |
Float2
translation
The translation factor of the transformation. |
Returns
Matrix
The created affine transformation matrix. |
AffineTransformation2D(Single, ref Float2, Single, ref Float2, out Matrix)
Creates a 2D affine transformation matrix.
Declaration
public static void AffineTransformation2D(float scaling, ref Float2 rotationCenter, float rotation, ref Float2 translation, out Matrix result)
Parameters
System.Single
scaling
Scaling factor. |
Float2
rotationCenter
The center of the rotation. |
System.Single
rotation
The rotation of the transformation. |
Float2
translation
The translation factor of the transformation. |
Matrix
result
When the method completes, contains the created affine transformation matrix. |
AffineTransformation2D(Single, Single, Float2)
Creates a 2D affine transformation matrix.
Declaration
public static Matrix AffineTransformation2D(float scaling, float rotation, Float2 translation)
Parameters
System.Single
scaling
Scaling factor. |
System.Single
rotation
The rotation of the transformation. |
Float2
translation
The translation factor of the transformation. |
Returns
Matrix
The created affine transformation matrix. |
AffineTransformation2D(Single, Single, ref Float2, out Matrix)
Creates a 2D affine transformation matrix.
Declaration
public static void AffineTransformation2D(float scaling, float rotation, ref Float2 translation, out Matrix result)
Parameters
System.Single
scaling
Scaling factor. |
System.Single
rotation
The rotation of the transformation. |
Float2
translation
The translation factor of the transformation. |
Matrix
result
When the method completes, contains the created affine transformation matrix. |
Billboard(Float3, Float3, Float3, Float3)
Creates a left-handed spherical billboard that rotates around a specified object position.
Declaration
public static Matrix Billboard(Float3 objectPosition, Float3 cameraPosition, Float3 cameraUpFloat, Float3 cameraForwardFloat)
Parameters
Float3
objectPosition
The position of the object around which the billboard will rotate. |
Float3
cameraPosition
The position of the camera. |
Float3
cameraUpFloat
The up vector of the camera. |
Float3
cameraForwardFloat
The forward vector of the camera. |
Returns
Matrix
The created billboard matrix. |
Billboard(ref Float3, ref Float3, ref Float3, ref Float3, out Matrix)
Creates a left-handed spherical billboard that rotates around a specified object position.
Declaration
public static void Billboard(ref Float3 objectPosition, ref Float3 cameraPosition, ref Float3 cameraUpFloat, ref Float3 cameraForwardFloat, out Matrix result)
Parameters
Float3
objectPosition
The position of the object around which the billboard will rotate. |
Float3
cameraPosition
The position of the camera. |
Float3
cameraUpFloat
The up vector of the camera. |
Float3
cameraForwardFloat
The forward vector of the camera. |
Matrix
result
When the method completes, contains the created billboard matrix. |
CreateFromAxisAngle(Float3, Single)
Creates a new matrix that rotates around an arbitrary vector.
Declaration
public static Matrix CreateFromAxisAngle(Float3 axis, float angle)
Parameters
Float3
axis
The axis to rotate around. |
System.Single
angle
The angle to rotate around the vector. |
Returns
Matrix
The created rotation matrix. |
CreateFromAxisAngle(ref Float3, Single, out Matrix)
Creates a new matrix that rotates around an arbitrary vector.
Declaration
public static void CreateFromAxisAngle(ref Float3 axis, float angle, out Matrix result)
Parameters
Float3
axis
The axis to rotate around. |
System.Single
angle
The angle to rotate around the vector. |
Matrix
result
When the method completes, contains the created rotation matrix. |
CreateWorld(Float3, Float3, Float3)
Creates the world matrix from the specified parameters
Declaration
public static Matrix CreateWorld(Float3 position, Float3 forward, Float3 up)
Parameters
Float3
position
The position of the object. This value is used in translation operations. |
Float3
forward
The forward direction of the object. |
Float3
up
The upward direction of the object; usually [0, 1, 0]. |
Returns
Matrix
The created world matrix of given transformation world |
CreateWorld(ref Float3, ref Float3, ref Float3, out Matrix)
Creates the world matrix from the specified parameters
Declaration
public static void CreateWorld(ref Float3 position, ref Float3 forward, ref Float3 up, out Matrix result)
Parameters
Float3
position
The position of the object. This value is used in translation operations. |
Float3
forward
The forward direction of the object. |
Float3
up
The upward direction of the object; usually [0, 1, 0]. |
Matrix
result
|
Decompose(out Float3, out Matrix, out Float3)
Decomposes a matrix into a scale, rotation, and translation. [Deprecated on 20.02.2024, expires on 20.02.2026]
Declaration
public void Decompose(out Float3 scale, out Matrix rotation, out Float3 translation)
Parameters
Float3
scale
When the method completes, contains the scaling component of the decomposed matrix. |
Matrix
rotation
When the method completes, contains the rotation component of the decomposed matrix. |
Float3
translation
When the method completes, contains the translation component of the decomposed matrix. |
Remarks
This method is designed to decompose an SRT transformation matrix only.
Decompose(out Float3, out Matrix3x3, out Float3)
Decomposes a matrix into a scale, rotation, and translation.
Declaration
public void Decompose(out Float3 scale, out Matrix3x3 rotation, out Float3 translation)
Parameters
Float3
scale
When the method completes, contains the scaling component of the decomposed matrix. |
Matrix3x3
rotation
When the method completes, contains the rotation component of the decomposed matrix. |
Float3
translation
When the method completes, contains the translation component of the decomposed matrix. |
Remarks
This method is designed to decompose an SRT transformation matrix only.
Decompose(out Float3, out Quaternion, out Float3)
Decomposes a matrix into a scale, rotation, and translation.
Declaration
public void Decompose(out Float3 scale, out Quaternion rotation, out Float3 translation)
Parameters
Float3
scale
When the method completes, contains the scaling component of the decomposed matrix. |
Quaternion
rotation
When the method completes, contains the rotation component of the decomposed matrix. |
Float3
translation
When the method completes, contains the translation component of the decomposed matrix. |
Remarks
This method is designed to decompose an SRT transformation matrix only.
Decompose(out Transform)
Decomposes a matrix into a scale, rotation, and translation.
Declaration
public void Decompose(out Transform transform)
Parameters
Transform
transform
When the method completes, contains the transformation of the decomposed matrix. |
Remarks
This method is designed to decompose an SRT transformation matrix only.
DecomposeLQ(out Matrix, out Matrix)
Decomposes a matrix into a lower triangular matrix L and an orthonormalized matrix Q.
Declaration
public void DecomposeLQ(out Matrix L, out Matrix Q)
Parameters
Matrix
L
When the method completes, contains the lower triangular matrix of the decomposition. |
Matrix
Q
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.
Declaration
public void DecomposeQR(out Matrix Q, out Matrix R)
Parameters
Matrix
Q
When the method completes, contains the orthonormalized matrix of the decomposition. |
Matrix
R
When the method completes, contains the right triangular matrix of the decomposition. |
DecomposeUniformScale(out Single, out Quaternion, out Float3)
Decomposes a uniform scale matrix into a scale, rotation, and translation. A uniform scale matrix has the same scale in every axis.
Declaration
public void DecomposeUniformScale(out float scale, out Quaternion rotation, out Float3 translation)
Parameters
System.Single
scale
When the method completes, contains the scaling component of the decomposed matrix. |
Quaternion
rotation
When the method completes, contains the rotation component of the decomposed matrix. |
Float3
translation
When the method completes, contains the translation component of the decomposed matrix. |
Remarks
This method is designed to decompose an SRT transformation matrix only.
Determinant()
Calculates the determinant of the matrix.
Declaration
public float Determinant()
Returns
System.Single
The determinant of the matrix. |
Divide(Matrix, Matrix)
Determines the quotient of two matrices.
Declaration
public static Matrix Divide(Matrix left, Matrix right)
Parameters
Matrix
left
The first matrix to divide. |
Matrix
right
The second matrix to divide. |
Returns
Matrix
The quotient of the two matrices. |
Divide(Matrix, Single)
Scales a matrix by the given value.
Declaration
public static Matrix Divide(Matrix left, float right)
Parameters
Matrix
left
The matrix to scale. |
System.Single
right
The amount by which to scale. |
Returns
Matrix
The scaled matrix. |
Divide(ref Matrix, ref Matrix, out Matrix)
Determines the quotient of two matrices.
Declaration
public static void Divide(ref Matrix left, ref Matrix right, out Matrix result)
Parameters
Matrix
left
The first matrix to divide. |
Matrix
right
The second matrix to divide. |
Matrix
result
When the method completes, contains the quotient of the two matrices. |
Divide(ref Matrix, Single, out Matrix)
Scales a matrix by the given value.
Declaration
public static void Divide(ref Matrix left, float right, out Matrix result)
Parameters
Matrix
left
The matrix to scale. |
System.Single
right
The amount by which to scale. |
Matrix
result
When the method completes, contains the scaled matrix. |
Equals(Matrix)
Determines whether the specified Matrix is equal to this instance.
Declaration
public bool Equals(Matrix other)
Parameters
Matrix
other
The Matrix to compare with this instance. |
Returns
System.Boolean
|
Equals(ref Matrix)
Determines whether the specified Matrix is equal to this instance.
Declaration
public bool Equals(ref Matrix other)
Parameters
Matrix
other
The Matrix to compare with this instance. |
Returns
System.Boolean
|
Equals(Object)
Determines whether the specified System.Object is equal to this instance.
Declaration
public override bool Equals(object value)
Parameters
System.Object
value
The System.Object to compare with this instance. |
Returns
System.Boolean
|
ExchangeColumns(Int32, Int32)
Exchanges two columns in the matrix.
Declaration
public void ExchangeColumns(int firstColumn, int secondColumn)
Parameters
System.Int32
firstColumn
The first column to exchange. This is an index of the column starting at zero. |
System.Int32
secondColumn
The second column to exchange. This is an index of the column starting at zero. |
ExchangeRows(Int32, Int32)
Exchanges two rows in the matrix.
Declaration
public void ExchangeRows(int firstRow, int secondRow)
Parameters
System.Int32
firstRow
The first row to exchange. This is an index of the row starting at zero. |
System.Int32
secondRow
The second row to exchange. This is an index of the row starting at zero. |
Exponent(Matrix, Int32)
Performs the exponential operation on a matrix.
Declaration
public static Matrix Exponent(Matrix value, int exponent)
Parameters
Matrix
value
The matrix to perform the operation on. |
System.Int32
exponent
The exponent to raise the matrix to. |
Returns
Matrix
The exponential matrix. |
Exceptions
System.ArgumentOutOfRangeException
Thrown when the |
Exponent(ref Matrix, Int32, out Matrix)
Performs the exponential operation on a matrix.
Declaration
public static void Exponent(ref Matrix value, int exponent, out Matrix result)
Parameters
Matrix
value
The matrix to perform the operation on. |
System.Int32
exponent
The exponent to raise the matrix to. |
Matrix
result
When the method completes, contains the exponential matrix. |
Exceptions
System.ArgumentOutOfRangeException
Thrown when the |
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
System.Int32
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Invert()
Inverts the matrix.
Declaration
public void Invert()
Invert(Matrix)
Calculates the inverse of the specified matrix.
Declaration
public static Matrix Invert(Matrix value)
Parameters
Matrix
value
The matrix whose inverse is to be calculated. |
Returns
Matrix
The inverse of the specified matrix. |
Invert(ref Matrix, out Matrix)
Calculates the inverse of the specified matrix.
Declaration
public static void Invert(ref Matrix value, out Matrix result)
Parameters
Matrix
value
The matrix whose inverse is to be calculated. |
Matrix
result
When the method completes, contains the inverse of the specified matrix. |
Lerp(Matrix, Matrix, Single)
Performs a linear interpolation between two matrices.
Declaration
public static Matrix Lerp(Matrix start, Matrix end, float amount)
Parameters
Matrix
start
Start matrix. |
Matrix
end
End matrix. |
System.Single
amount
Value between 0 and 1 indicating the weight of |
Returns
Matrix
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 Matrix, ref Matrix, Single, out Matrix)
Performs a linear interpolation between two matrices.
Declaration
public static void Lerp(ref Matrix start, ref Matrix end, float amount, out Matrix result)
Parameters
Matrix
start
Start matrix. |
Matrix
end
End matrix. |
System.Single
amount
Value between 0 and 1 indicating the weight of |
Matrix
result
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.
LookAt(Float3, Float3, Float3)
Creates a left-handed, look-at matrix.
Declaration
public static Matrix LookAt(Float3 eye, Float3 target, Float3 up)
Parameters
Float3
eye
The position of the viewer's eye. |
Float3
target
The camera look-at target. |
Float3
up
The camera's up vector. |
Returns
Matrix
The created look-at matrix. |
LookAt(ref Float3, ref Float3, ref Float3, out Matrix)
Creates a left-handed, look-at matrix.
Declaration
public static void LookAt(ref Float3 eye, ref Float3 target, ref Float3 up, out Matrix result)
Parameters
Float3
eye
The position of the viewer's eye. |
Float3
target
The camera look-at target. |
Float3
up
The camera's up vector. |
Matrix
result
When the method completes, contains the created look-at matrix. |
LowerTriangularForm(Matrix)
Brings the matrix into lower triangular form using elementary row operations.
Declaration
public static Matrix LowerTriangularForm(Matrix value)
Parameters
Matrix
value
The matrix to put into lower triangular form. |
Returns
Matrix
The lower triangular matrix. |
Remarks
If the matrix 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 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 Matrix, out Matrix)
Brings the matrix into lower triangular form using elementary row operations.
Declaration
public static void LowerTriangularForm(ref Matrix value, out Matrix result)
Parameters
Matrix
value
The matrix to put into lower triangular form. |
Matrix
result
When the method completes, contains the lower triangular matrix. |
Remarks
If the matrix 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 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, Matrix)
Determines the product of two matrices.
Declaration
public static Matrix Multiply(Matrix left, Matrix right)
Parameters
Matrix
left
The first matrix to multiply. |
Matrix
right
The second matrix to multiply. |
Returns
Matrix
The product of the two matrices. |
Multiply(Matrix, Single)
Scales a matrix by the given value.
Declaration
public static Matrix Multiply(Matrix left, float right)
Parameters
Matrix
left
The matrix to scale. |
System.Single
right
The amount by which to scale. |
Returns
Matrix
The scaled matrix. |
Multiply(ref Matrix, ref Matrix, out Matrix)
Determines the product of two matrices.
Declaration
public static void Multiply(ref Matrix left, ref Matrix right, out Matrix result)
Parameters
Matrix
left
The first matrix to multiply. |
Matrix
right
The second matrix to multiply. |
Matrix
result
The product of the two matrices. |
Multiply(ref Matrix, Single, out Matrix)
Scales a matrix by the given value.
Declaration
public static void Multiply(ref Matrix left, float right, out Matrix result)
Parameters
Matrix
left
The matrix to scale. |
System.Single
right
The amount by which to scale. |
Matrix
result
When the method completes, contains the scaled matrix. |
Negate(Matrix)
Negates a matrix.
Declaration
public static Matrix Negate(Matrix value)
Parameters
Matrix
value
The matrix to be negated. |
Returns
Matrix
The negated matrix. |
Negate(ref Matrix, out Matrix)
Negates a matrix.
Declaration
public static void Negate(ref Matrix value, out Matrix result)
Parameters
Matrix
value
The matrix to be negated. |
Matrix
result
When the method completes, contains the negated matrix. |
Ortho(Single, Single, Single, Single)
Creates a left-handed, orthographic projection matrix.
Declaration
public static Matrix Ortho(float width, float height, float znear, float zfar)
Parameters
System.Single
width
Width of the viewing volume. |
System.Single
height
Height of the viewing volume. |
System.Single
znear
Minimum z-value of the viewing volume. |
System.Single
zfar
Maximum z-value of the viewing volume. |
Returns
Matrix
The created projection matrix. |
Ortho(Single, Single, Single, Single, out Matrix)
Creates a left-handed, orthographic projection matrix.
Declaration
public static void Ortho(float width, float height, float znear, float zfar, out Matrix result)
Parameters
System.Single
width
Width of the viewing volume. |
System.Single
height
Height of the viewing volume. |
System.Single
znear
Minimum z-value of the viewing volume. |
System.Single
zfar
Maximum z-value of the viewing volume. |
Matrix
result
When the method completes, contains the created projection matrix. |
Orthogonalize()
Orthogonalizes the specified matrix.
Declaration
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 than transpose the output.
Orthogonalize(Matrix)
Orthogonalizes the specified matrix.
Declaration
public static Matrix Orthogonalize(Matrix value)
Parameters
Matrix
value
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 Matrix, out Matrix)
Orthogonalizes the specified matrix.
Declaration
public static void Orthogonalize(ref Matrix value, out Matrix result)
Parameters
Matrix
value
The matrix to orthogonalize. |
Matrix
result
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.
Declaration
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 than transpose the output.
Orthonormalize(Matrix)
Orthonormalizes the specified matrix.
Declaration
public static Matrix Orthonormalize(Matrix value)
Parameters
Matrix
value
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 Matrix, out Matrix)
Orthonormalizes the specified matrix.
Declaration
public static void Orthonormalize(ref Matrix value, out Matrix result)
Parameters
Matrix
value
The matrix to orthonormalize. |
Matrix
result
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.
OrthoOffCenter(Single, Single, Single, Single, Single, Single)
Creates a left-handed, customized orthographic projection matrix.
Declaration
public static Matrix OrthoOffCenter(float left, float right, float bottom, float top, float znear, float zfar)
Parameters
System.Single
left
Minimum x-value of the viewing volume. |
System.Single
right
Maximum x-value of the viewing volume. |
System.Single
bottom
Minimum y-value of the viewing volume. |
System.Single
top
Maximum y-value of the viewing volume. |
System.Single
znear
Minimum z-value of the viewing volume. |
System.Single
zfar
Maximum z-value of the viewing volume. |
Returns
Matrix
The created projection matrix. |
OrthoOffCenter(Single, Single, Single, Single, Single, Single, out Matrix)
Creates a left-handed, customized orthographic projection matrix.
Declaration
public static void OrthoOffCenter(float left, float right, float bottom, float top, float znear, float zfar, out Matrix result)
Parameters
System.Single
left
Minimum x-value of the viewing volume. |
System.Single
right
Maximum x-value of the viewing volume. |
System.Single
bottom
Minimum y-value of the viewing volume. |
System.Single
top
Maximum y-value of the viewing volume. |
System.Single
znear
Minimum z-value of the viewing volume. |
System.Single
zfar
Maximum z-value of the viewing volume. |
Matrix
result
When the method completes, contains the created projection matrix. |
Perspective(Single, Single, Single, Single)
Creates a left-handed, perspective projection matrix.
Declaration
public static Matrix Perspective(float width, float height, float znear, float zfar)
Parameters
System.Single
width
Width of the viewing volume. |
System.Single
height
Height of the viewing volume. |
System.Single
znear
Minimum z-value of the viewing volume. |
System.Single
zfar
Maximum z-value of the viewing volume. |
Returns
Matrix
The created projection matrix. |
Perspective(Single, Single, Single, Single, out Matrix)
Creates a left-handed, perspective projection matrix.
Declaration
public static void Perspective(float width, float height, float znear, float zfar, out Matrix result)
Parameters
System.Single
width
Width of the viewing volume. |
System.Single
height
Height of the viewing volume. |
System.Single
znear
Minimum z-value of the viewing volume. |
System.Single
zfar
Maximum z-value of the viewing volume. |
Matrix
result
When the method completes, contains the created projection matrix. |
PerspectiveFov(Single, Single, Single, Single)
Creates a left-handed, perspective projection matrix based on a field of view.
Declaration
public static Matrix PerspectiveFov(float fov, float aspect, float znear, float zfar)
Parameters
System.Single
fov
Field of view in the y direction, in radians. |
System.Single
aspect
Aspect ratio, defined as view space width divided by height. |
System.Single
znear
Minimum z-value of the viewing volume. |
System.Single
zfar
Maximum z-value of the viewing volume. |
Returns
Matrix
The created projection matrix. |
PerspectiveFov(Single, Single, Single, Single, out Matrix)
Creates a left-handed, perspective projection matrix based on a field of view.
Declaration
public static void PerspectiveFov(float fov, float aspect, float znear, float zfar, out Matrix result)
Parameters
System.Single
fov
Field of view in the y direction, in radians. |
System.Single
aspect
Aspect ratio, defined as view space width divided by height. |
System.Single
znear
Minimum z-value of the viewing volume. |
System.Single
zfar
Maximum z-value of the viewing volume. |
Matrix
result
When the method completes, contains the created projection matrix. |
PerspectiveOffCenter(Single, Single, Single, Single, Single, Single)
Creates a left-handed, customized perspective projection matrix.
Declaration
public static Matrix PerspectiveOffCenter(float left, float right, float bottom, float top, float znear, float zfar)
Parameters
System.Single
left
Minimum x-value of the viewing volume. |
System.Single
right
Maximum x-value of the viewing volume. |
System.Single
bottom
Minimum y-value of the viewing volume. |
System.Single
top
Maximum y-value of the viewing volume. |
System.Single
znear
Minimum z-value of the viewing volume. |
System.Single
zfar
Maximum z-value of the viewing volume. |
Returns
Matrix
The created projection matrix. |
PerspectiveOffCenter(Single, Single, Single, Single, Single, Single, out Matrix)
Creates a left-handed, customized perspective projection matrix.
Declaration
public static void PerspectiveOffCenter(float left, float right, float bottom, float top, float znear, float zfar, out Matrix result)
Parameters
System.Single
left
Minimum x-value of the viewing volume. |
System.Single
right
Maximum x-value of the viewing volume. |
System.Single
bottom
Minimum y-value of the viewing volume. |
System.Single
top
Maximum y-value of the viewing volume. |
System.Single
znear
Minimum z-value of the viewing volume. |
System.Single
zfar
Maximum z-value of the viewing volume. |
Matrix
result
When the method completes, contains the created projection matrix. |
ReducedRowEchelonForm(ref Matrix, ref Float4, out Matrix, out Float4)
Brings the matrix into reduced row echelon form using elementary row operations.
Declaration
public static void ReducedRowEchelonForm(ref Matrix value, ref Float4 augment, out Matrix result, out Float4 augmentResult)
Parameters
Matrix
value
The matrix to put into reduced row echelon form. |
Float4
augment
The fifth column of the matrix. |
Matrix
result
When the method completes, contains the resultant matrix after the operation. |
Float4
augmentResult
When the method completes, contains the resultant fifth column of the matrix. |
Remarks
The fifth column is often called the augmented 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.
RotationAxis(Float3, Single)
Creates a matrix that rotates around an arbitrary axis.
Declaration
public static Matrix RotationAxis(Float3 axis, float angle)
Parameters
Float3
axis
The axis around which to rotate. This parameter is assumed to be normalized. |
System.Single
angle
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 Float3, Single, out Matrix)
Creates a matrix that rotates around an arbitrary axis.
Declaration
public static void RotationAxis(ref Float3 axis, float angle, out Matrix result)
Parameters
Float3
axis
The axis around which to rotate. This parameter is assumed to be normalized. |
System.Single
angle
Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin. |
Matrix
result
When the method completes, contains the created rotation matrix. |
RotationQuaternion(Quaternion)
Creates a rotation matrix from a quaternion.
Declaration
public static Matrix RotationQuaternion(Quaternion rotation)
Parameters
Quaternion
rotation
The quaternion to use to build the matrix. |
Returns
Matrix
The created rotation matrix. |
RotationQuaternion(ref Quaternion, out Matrix)
Creates a rotation matrix from a quaternion.
Declaration
public static void RotationQuaternion(ref Quaternion rotation, out Matrix result)
Parameters
Quaternion
rotation
The quaternion to use to build the matrix. |
Matrix
result
The created rotation matrix. |
RotationX(Single)
Creates a matrix that rotates around the x-axis.
Declaration
public static Matrix RotationX(float angle)
Parameters
System.Single
angle
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(Single, out Matrix)
Creates a matrix that rotates around the x-axis.
Declaration
public static void RotationX(float angle, out Matrix result)
Parameters
System.Single
angle
Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin. |
Matrix
result
When the method completes, contains the created rotation matrix. |
RotationY(Single)
Creates a matrix that rotates around the y-axis.
Declaration
public static Matrix RotationY(float angle)
Parameters
System.Single
angle
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(Single, out Matrix)
Creates a matrix that rotates around the y-axis.
Declaration
public static void RotationY(float angle, out Matrix result)
Parameters
System.Single
angle
Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin. |
Matrix
result
When the method completes, contains the created rotation matrix. |
RotationYawPitchRoll(Single, Single, Single)
Creates a rotation matrix with a specified yaw, pitch, and roll.
Declaration
public static Matrix RotationYawPitchRoll(float yaw, float pitch, float roll)
Parameters
System.Single
yaw
Yaw around the y-axis, in radians. |
System.Single
pitch
Pitch around the x-axis, in radians. |
System.Single
roll
Roll around the z-axis, in radians. |
Returns
Matrix
The created rotation matrix. |
RotationYawPitchRoll(Single, Single, Single, out Matrix)
Creates a rotation matrix with a specified yaw, pitch, and roll.
Declaration
public static void RotationYawPitchRoll(float yaw, float pitch, float roll, out Matrix result)
Parameters
System.Single
yaw
Yaw around the y-axis, in radians. |
System.Single
pitch
Pitch around the x-axis, in radians. |
System.Single
roll
Roll around the z-axis, in radians. |
Matrix
result
When the method completes, contains the created rotation matrix. |
RotationZ(Single)
Creates a matrix that rotates around the z-axis.
Declaration
public static Matrix RotationZ(float angle)
Parameters
System.Single
angle
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(Single, out Matrix)
Creates a matrix that rotates around the z-axis.
Declaration
public static void RotationZ(float angle, out Matrix result)
Parameters
System.Single
angle
Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin. |
Matrix
result
When the method completes, contains the created rotation matrix. |
RowEchelonForm(Matrix)
Brings the matrix into row echelon form using elementary row operations;
Declaration
public static Matrix RowEchelonForm(Matrix value)
Parameters
Matrix
value
The matrix to put into row echelon form. |
Returns
Matrix
When the method completes, contains the row echelon form of the matrix. |
RowEchelonForm(ref Matrix, out Matrix)
Brings the matrix into row echelon form using elementary row operations;
Declaration
public static void RowEchelonForm(ref Matrix value, out Matrix result)
Parameters
Matrix
value
The matrix to put into row echelon form. |
Matrix
result
When the method completes, contains the row echelon form of the matrix. |
Scaling(Float3)
Creates a matrix that scales along the x-axis, y-axis, and y-axis.
Declaration
public static Matrix Scaling(Float3 scale)
Parameters
Float3
scale
Scaling factor for all three axes. |
Returns
Matrix
The created scaling matrix. |
Scaling(ref Float3, out Matrix)
Creates a matrix that scales along the x-axis, y-axis, and y-axis.
Declaration
public static void Scaling(ref Float3 scale, out Matrix result)
Parameters
Float3
scale
Scaling factor for all three axes. |
Matrix
result
When the method completes, contains the created scaling matrix. |
Scaling(Single)
Creates a matrix that uniformly scales along all three axis.
Declaration
public static Matrix Scaling(float scale)
Parameters
System.Single
scale
The uniform scale that is applied along all axis. |
Returns
Matrix
The created scaling matrix. |
Scaling(Single, out Matrix)
Creates a matrix that uniformly scales along all three axis.
Declaration
public static void Scaling(float scale, out Matrix result)
Parameters
System.Single
scale
The uniform scale that is applied along all axis. |
Matrix
result
When the method completes, contains the created scaling matrix. |
Scaling(Single, Single, Single)
Creates a matrix that scales along the x-axis, y-axis, and y-axis.
Declaration
public static Matrix Scaling(float x, float y, float z)
Parameters
System.Single
x
Scaling factor that is applied along the x-axis. |
System.Single
y
Scaling factor that is applied along the y-axis. |
System.Single
z
Scaling factor that is applied along the z-axis. |
Returns
Matrix
The created scaling matrix. |
Scaling(Single, Single, Single, out Matrix)
Creates a matrix that scales along the x-axis, y-axis, and y-axis.
Declaration
public static void Scaling(float x, float y, float z, out Matrix result)
Parameters
System.Single
x
Scaling factor that is applied along the x-axis. |
System.Single
y
Scaling factor that is applied along the y-axis. |
System.Single
z
Scaling factor that is applied along the z-axis. |
Matrix
result
When the method completes, contains the created scaling matrix. |
Skew(Single, ref Float3, ref Float3, out Matrix)
Creates a skew/shear matrix by means of a translation vector, a rotation vector, and a rotation angle. shearing is performed in the direction of translation vector, where translation vector and rotation vector define the shearing plane. The effect is such that the skewed rotation vector has the specified angle with rotation itself.
Declaration
public static void Skew(float angle, ref Float3 rotationVec, ref Float3 transVec, out Matrix matrix)
Parameters
System.Single
angle
The rotation angle. |
Float3
rotationVec
The rotation vector |
Float3
transVec
The translation vector |
Matrix
matrix
Contains the created skew/shear matrix. |
SmoothStep(Matrix, Matrix, Single)
Performs a cubic interpolation between two matrices.
Declaration
public static Matrix SmoothStep(Matrix start, Matrix end, float amount)
Parameters
Matrix
start
Start matrix. |
Matrix
end
End matrix. |
System.Single
amount
Value between 0 and 1 indicating the weight of |
Returns
Matrix
The cubic interpolation of the two matrices. |
SmoothStep(ref Matrix, ref Matrix, Single, out Matrix)
Performs a cubic interpolation between two matrices.
Declaration
public static void SmoothStep(ref Matrix start, ref Matrix end, float amount, out Matrix result)
Parameters
Matrix
start
Start matrix. |
Matrix
end
End matrix. |
System.Single
amount
Value between 0 and 1 indicating the weight of |
Matrix
result
When the method completes, contains the cubic interpolation of the two matrices. |
Subtract(Matrix, Matrix)
Determines the difference between two matrices.
Declaration
public static Matrix Subtract(Matrix left, Matrix right)
Parameters
Matrix
left
The first matrix to subtract. |
Matrix
right
The second matrix to subtract. |
Returns
Matrix
The difference between the two matrices. |
Subtract(ref Matrix, ref Matrix, out Matrix)
Determines the difference between two matrices.
Declaration
public static void Subtract(ref Matrix left, ref Matrix right, out Matrix result)
Parameters
Matrix
left
The first matrix to subtract. |
Matrix
right
The second matrix to subtract. |
Matrix
result
When the method completes, contains the difference between the two matrices. |
ToArray()
Creates an array containing the elements of the matrix.
Declaration
public float[] ToArray()
Returns
System.Single[]
A sixteen-element array containing the components of the matrix. |
ToString()
Returns a System.String that represents this instance.
Declaration
public override string ToString()
Returns
System.String
A System.String that represents this instance. |
ToString(IFormatProvider)
Returns a System.String that represents this instance.
Declaration
public string ToString(IFormatProvider formatProvider)
Parameters
System.IFormatProvider
formatProvider
The format provider. |
Returns
System.String
A System.String that represents this instance. |
ToString(String)
Returns a System.String that represents this instance.
Declaration
public string ToString(string format)
Parameters
System.String
format
The format. |
Returns
System.String
A System.String that represents this instance. |
ToString(String, IFormatProvider)
Returns a System.String that represents this instance.
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
System.String
format
The format. |
System.IFormatProvider
formatProvider
The format provider. |
Returns
System.String
A System.String that represents this instance. |
Transformation(Float3, Quaternion, Float3)
Creates a matrix that contains both the X, Y and Z rotation, as well as scaling and translation.
Declaration
public static Matrix Transformation(Float3 scaling, Quaternion rotation, Float3 translation)
Parameters
Float3
scaling
The scaling. |
Quaternion
rotation
Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin. |
Float3
translation
The translation. |
Returns
Matrix
The created transformation matrix. |
Transformation(Float3, Quaternion, Float3, Float3, Quaternion, Float3)
Creates a transformation matrix.
Declaration
public static Matrix Transformation(Float3 scalingCenter, Quaternion scalingRotation, Float3 scaling, Float3 rotationCenter, Quaternion rotation, Float3 translation)
Parameters
Float3
scalingCenter
Center point of the scaling operation. |
Quaternion
scalingRotation
Scaling rotation amount. |
Float3
scaling
Scaling factor. |
Float3
rotationCenter
The center of the rotation. |
Quaternion
rotation
The rotation of the transformation. |
Float3
translation
The translation factor of the transformation. |
Returns
Matrix
The created transformation matrix. |
Transformation(ref Float3, ref Quaternion, ref Float3, ref Float3, ref Quaternion, ref Float3, out Matrix)
Creates a transformation matrix.
Declaration
public static void Transformation(ref Float3 scalingCenter, ref Quaternion scalingRotation, ref Float3 scaling, ref Float3 rotationCenter, ref Quaternion rotation, ref Float3 translation, out Matrix result)
Parameters
Float3
scalingCenter
Center point of the scaling operation. |
Quaternion
scalingRotation
Scaling rotation amount. |
Float3
scaling
Scaling factor. |
Float3
rotationCenter
The center of the rotation. |
Quaternion
rotation
The rotation of the transformation. |
Float3
translation
The translation factor of the transformation. |
Matrix
result
When the method completes, contains the created transformation matrix. |
Transformation(ref Float3, ref Quaternion, ref Float3, out Matrix)
Creates a matrix that contains both the X, Y and Z rotation, as well as scaling and translation.
Declaration
public static void Transformation(ref Float3 scaling, ref Quaternion rotation, ref Float3 translation, out Matrix result)
Parameters
Float3
scaling
The scaling. |
Quaternion
rotation
Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin. |
Float3
translation
The translation. |
Matrix
result
When the method completes, contains the created transformation matrix. |
Transformation2D(Float2, Single, Float2, Float2, Single, Float2)
Creates a 2D transformation matrix.
Declaration
public static Matrix Transformation2D(Float2 scalingCenter, float scalingRotation, Float2 scaling, Float2 rotationCenter, float rotation, Float2 translation)
Parameters
Float2
scalingCenter
Center point of the scaling operation. |
System.Single
scalingRotation
Scaling rotation amount. |
Float2
scaling
Scaling factor. |
Float2
rotationCenter
The center of the rotation. |
System.Single
rotation
The rotation of the transformation. |
Float2
translation
The translation factor of the transformation. |
Returns
Matrix
The created transformation matrix. |
Transformation2D(ref Float2, Single, ref Float2, ref Float2, Single, ref Float2, out Matrix)
Creates a 2D transformation matrix.
Declaration
public static void Transformation2D(ref Float2 scalingCenter, float scalingRotation, ref Float2 scaling, ref Float2 rotationCenter, float rotation, ref Float2 translation, out Matrix result)
Parameters
Float2
scalingCenter
Center point of the scaling operation. |
System.Single
scalingRotation
Scaling rotation amount. |
Float2
scaling
Scaling factor. |
Float2
rotationCenter
The center of the rotation. |
System.Single
rotation
The rotation of the transformation. |
Float2
translation
The translation factor of the transformation. |
Matrix
result
When the method completes, contains the created transformation matrix. |
Translation(Float3)
Creates a translation matrix using the specified offsets.
Declaration
public static Matrix Translation(Float3 value)
Parameters
Float3
value
The offset for all three coordinate planes. |
Returns
Matrix
The created translation matrix. |
Translation(ref Float3, out Matrix)
Creates a translation matrix using the specified offsets.
Declaration
public static void Translation(ref Float3 value, out Matrix result)
Parameters
Float3
value
The offset for all three coordinate planes. |
Matrix
result
When the method completes, contains the created translation matrix. |
Translation(Single, Single, Single)
Creates a translation matrix using the specified offsets.
Declaration
public static Matrix Translation(float x, float y, float z)
Parameters
System.Single
x
X-coordinate offset. |
System.Single
y
Y-coordinate offset. |
System.Single
z
Z-coordinate offset. |
Returns
Matrix
The created translation matrix. |
Translation(Single, Single, Single, out Matrix)
Creates a translation matrix using the specified offsets.
Declaration
public static void Translation(float x, float y, float z, out Matrix result)
Parameters
System.Single
x
X-coordinate offset. |
System.Single
y
Y-coordinate offset. |
System.Single
z
Z-coordinate offset. |
Matrix
result
When the method completes, contains the created translation matrix. |
Transpose()
Transposes the matrix.
Declaration
public void Transpose()
Transpose(Matrix)
Calculates the transpose of the specified matrix.
Declaration
public static Matrix Transpose(Matrix value)
Parameters
Matrix
value
The matrix whose transpose is to be calculated. |
Returns
Matrix
The transpose of the specified matrix. |
Transpose(ref Matrix, out Matrix)
Calculates the transpose of the specified matrix.
Declaration
public static void Transpose(ref Matrix value, out Matrix result)
Parameters
Matrix
value
The matrix whose transpose is to be calculated. |
Matrix
result
When the method completes, contains the transpose of the specified matrix. |
TransposeByRef(ref Matrix, ref Matrix)
Calculates the transpose of the specified matrix.
Declaration
public static void TransposeByRef(ref Matrix value, ref Matrix result)
Parameters
Matrix
value
The matrix whose transpose is to be calculated. |
Matrix
result
When the method completes, contains the transpose of the specified matrix. |
UpperTriangularForm(Matrix)
Brings the matrix into upper triangular form using elementary row operations.
Declaration
public static Matrix UpperTriangularForm(Matrix value)
Parameters
Matrix
value
The matrix to put into upper triangular form. |
Returns
Matrix
The upper triangular matrix. |
Remarks
If the matrix 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 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 Matrix, out Matrix)
Brings the matrix into upper triangular form using elementary row operations.
Declaration
public static void UpperTriangularForm(ref Matrix value, out Matrix result)
Parameters
Matrix
value
The matrix to put into upper triangular form. |
Matrix
result
When the method completes, contains the upper triangular matrix. |
Remarks
If the matrix 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 matrix represents a system of linear equations, than this often means that either no solution exists or an infinite number of solutions exist.
Operators
Addition(Matrix, Matrix)
Adds two matrices.
Declaration
public static Matrix operator +(Matrix left, Matrix right)
Parameters
Matrix
left
The first matrix to add. |
Matrix
right
The second matrix to add. |
Returns
Matrix
The sum of the two matrices. |
Division(Matrix, Matrix)
Divides two matrices.
Declaration
public static Matrix operator /(Matrix left, Matrix right)
Parameters
Matrix
left
The first matrix to divide. |
Matrix
right
The second matrix to divide. |
Returns
Matrix
The quotient of the two matrices. |
Division(Matrix, Single)
Scales a matrix by a given value.
Declaration
public static Matrix operator /(Matrix left, float right)
Parameters
Matrix
left
The matrix to scale. |
System.Single
right
The amount by which to scale. |
Returns
Matrix
The scaled matrix. |
Equality(Matrix, Matrix)
Tests for equality between two objects.
Declaration
public static bool operator ==(Matrix left, Matrix right)
Parameters
Matrix
left
The first value to compare. |
Matrix
right
The second value to compare. |
Returns
System.Boolean
|
Inequality(Matrix, Matrix)
Tests for inequality between two objects.
Declaration
public static bool operator !=(Matrix left, Matrix right)
Parameters
Matrix
left
The first value to compare. |
Matrix
right
The second value to compare. |
Returns
System.Boolean
|
Multiply(Matrix, Matrix)
Multiplies two matrices.
Declaration
public static Matrix operator *(Matrix left, Matrix right)
Parameters
Matrix
left
The first matrix to multiply. |
Matrix
right
The second matrix to multiply. |
Returns
Matrix
The product of the two matrices. |
Multiply(Matrix, Single)
Scales a matrix by a given value.
Declaration
public static Matrix operator *(Matrix left, float right)
Parameters
Matrix
left
The matrix to scale. |
System.Single
right
The amount by which to scale. |
Returns
Matrix
The scaled matrix. |
Multiply(Single, Matrix)
Scales a matrix by a given value.
Declaration
public static Matrix operator *(float left, Matrix right)
Parameters
System.Single
left
The amount by which to scale. |
Matrix
right
The matrix to scale. |
Returns
Matrix
The scaled matrix. |
Subtraction(Matrix, Matrix)
Subtracts two matrices.
Declaration
public static Matrix operator -(Matrix left, Matrix right)
Parameters
Matrix
left
The first matrix to subtract. |
Matrix
right
The second matrix to subtract. |
Returns
Matrix
The difference between the two matrices. |
UnaryNegation(Matrix)
Negates a matrix.
Declaration
public static Matrix operator -(Matrix value)
Parameters
Matrix
value
The matrix to negate. |
Returns
Matrix
The negated matrix. |
UnaryPlus(Matrix)
Assert a matrix (return it unchanged).
Declaration
public static Matrix operator +(Matrix value)
Parameters
Matrix
value
The matrix to assert (unchanged). |
Returns
Matrix
The asserted (unchanged) matrix. |