Matrix Struct
Namespace: Stride.Core.MathematicsAssembly: Stride.Core.Mathematics.dll
Represents a 4x4 mathematical matrix.
[DataContract("float4x4")]
[DataStyle(DataStyle.Compact)]
public struct Matrix : IEquatable<Matrix>, IFormattable
Name | Description | |
---|---|---|
Constructors | ||
Matrix(Single) | Initializes a new instance of the Matrix struct. |
|
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. |
|
Matrix(Single[]) | Initializes a new instance of the Matrix struct. |
|
Fields | ||
Identity | The identity Matrix. |
|
M11 | Value at row 1 column 1 of the matrix. |
|
M12 | Value at row 1 column 2 of the matrix. |
|
M13 | Value at row 1 column 3 of the matrix. |
|
M14 | Value at row 1 column 4 of the matrix. |
|
M21 | Value at row 2 column 1 of the matrix. |
|
M22 | Value at row 2 column 2 of the matrix. |
|
M23 | Value at row 2 column 3 of the matrix. |
|
M24 | Value at row 2 column 4 of the matrix. |
|
M31 | Value at row 3 column 1 of the matrix. |
|
M32 | Value at row 3 column 2 of the matrix. |
|
M33 | Value at row 3 column 3 of the matrix. |
|
M34 | Value at row 3 column 4 of the matrix. |
|
M41 | Value at row 4 column 1 of the matrix. |
|
M42 | Value at row 4 column 2 of the matrix. |
|
M43 | Value at row 4 column 3 of the matrix. |
|
M44 | Value at row 4 column 4 of the matrix. |
|
SizeInBytes | The size of the Matrix type, in bytes. |
|
Zero | A Matrix with all of its components set to zero. |
|
Properties | ||
Backward | Gets or sets the backward Vector3 of the matrix; that is M31, M32, and M33. |
|
Column1 | Gets or sets the first column in the matrix; that is M11, M21, M31, and M41. |
|
Column2 | Gets or sets the second column in the matrix; that is M12, M22, M32, and M42. |
|
Column3 | Gets or sets the third column in the matrix; that is M13, M23, M33, and M43. |
|
Column4 | Gets or sets the fourth column in the matrix; that is M14, M24, M34, and M44. |
|
Down | Gets or sets the down Vector3 of the matrix; that is -M21, -M22, and -M23. |
|
Forward | Gets or sets the forward Vector3 of the matrix; that is -M31, -M32, and -M33. |
|
IsIdentity | Gets a value indicating whether this instance is an identity matrix. |
|
Item[Int32] | Gets or sets the component at the specified index. |
|
Item[Int32, Int32] | Gets or sets the component at the specified index. |
|
Left | Gets or sets the left Vector3 of the matrix; that is -M11, -M12, and -M13. |
|
Right | Gets or sets the right Vector3 of the matrix; that is M11, M12, and M13. |
|
Row1 | Gets or sets the first row in the matrix; that is M11, M12, M13, and M14. |
|
Row2 | Gets or sets the second row in the matrix; that is M21, M22, M23, and M24. |
|
Row3 | Gets or sets the third row in the matrix; that is M31, M32, M33, and M34. |
|
Row4 | Gets or sets the fourth row in the matrix; that is M41, M42, M43, and M44. |
|
ScaleVector | Gets or sets the scale of the matrix; that is M11, M22, and M33. |
|
TranslationVector | Gets or sets the translation of the matrix; that is M41, M42, and M43. |
|
Up | Gets or sets the up Vector3 of the matrix; that is M21, M22, and M23. |
|
Methods | ||
Add(Matrix, Matrix) | Determines the sum of two matrices. |
|
Add(ref Matrix, ref Matrix, out Matrix) | Determines the sum of two matrices. |
|
AffineTransformation(Single, Quaternion, Vector3) | Creates a 3D affine transformation matrix. |
|
AffineTransformation(Single, ref Quaternion, ref Vector3, out Matrix) | Creates a 3D affine transformation matrix. |
|
AffineTransformation(Single, Vector3, Quaternion, Vector3) | Creates a 3D affine transformation matrix. |
|
AffineTransformation(Single, ref Vector3, ref Quaternion, ref Vector3, out Matrix) | Creates a 3D affine transformation matrix. |
|
AffineTransformation2D(Single, Vector2, Single, Vector2) | Creates a 2D affine transformation matrix. |
|
AffineTransformation2D(Single, ref Vector2, Single, ref Vector2, out Matrix) | Creates a 2D affine transformation matrix. |
|
AffineTransformation2D(Single, Single, Vector2) | Creates a 2D affine transformation matrix. |
|
AffineTransformation2D(Single, Single, ref Vector2, out Matrix) | Creates a 2D affine transformation matrix. |
|
Billboard(Vector3, Vector3, Vector3, Vector3) | Creates a spherical billboard that rotates around a specified object position. |
|
Billboard(ref Vector3, ref Vector3, ref Vector3, ref Vector3, out Matrix) | Creates a spherical billboard that rotates around a specified object position. |
|
CopyMatrixFrom(Single*, Int32, Int32) | Copies a nxm matrix to this instance. |
|
Decompose(out Vector3, out Matrix, out Vector3) | Decomposes a matrix into a scale, rotation, and translation. |
|
Decompose(out Vector3, out Quaternion, out Vector3) | Decomposes a matrix into a scale, rotation, and translation. |
|
Decompose(out Vector3, out Vector3) | Decomposes a matrix into a scale, rotation, and translation. |
|
Decompose(out Single, out Single, out Single) | Decomposes a rotation matrix with the specified yaw, pitch, roll |
|
DecomposeLQ(out Matrix, out Matrix) | Decomposes a matrix into a lower triangular matrix L and an orthonormalized matrix Q. |
|
DecomposeQR(out Matrix, out Matrix) | Decomposes a matrix into an orthonormalized matrix Q and a right traingular matrix R. |
|
DecomposeXYZ(out Vector3) | Decomposes a rotation matrix with the specified X, Y and Z euler angles. Matrix.RotationX(rotation.X) * Matrix.RotationY(rotation.Y) * Matrix.RotationZ(rotation.Z) should represent the same rotation. |
|
Determinant() | Calculates the determinant of the matrix. |
|
Divide(Matrix, Matrix) | Determines the quotient of two matrices. |
|
Divide(Matrix, Single) | Scales a matrix by the given value. |
|
Divide(ref Matrix, ref Matrix, out Matrix) | Determines the quotient of two matrices. |
|
Divide(ref Matrix, Single, out Matrix) | Scales a matrix by the given value. |
|
Equals(Matrix) | Determines whether the specified Matrix is equal to this instance. |
|
Equals(Object) | Determines whether the specified System.Object is equal to this instance. |
|
ExchangeColumns(Int32, Int32) | Exchange columns. |
|
ExchangeRows(Int32, Int32) | Exchanges two rows in the matrix. |
|
Exponent(Matrix, Int32) | Performs the exponential operation on a matrix. |
|
Exponent(ref Matrix, Int32, out Matrix) | Performs the exponential operation on a matrix. |
|
GetHashCode() | Returns a hash code for this instance. |
|
Invert() | Inverts the matrix. |
|
Invert(Matrix) | Calculates the inverse of the specified matrix. |
|
Invert(ref Matrix, out Matrix) | Calculates the inverse of the specified matrix. |
|
Lerp(Matrix, Matrix, Single) | Performs a linear interpolation between two matrices. |
|
Lerp(ref Matrix, ref Matrix, Single, out Matrix) | Performs a linear interpolation between two matrices. |
|
LookAtLH(Vector3, Vector3, Vector3) | Creates a left-handed, look-at matrix. |
|
LookAtLH(ref Vector3, ref Vector3, ref Vector3, out Matrix) | Creates a left-handed, look-at matrix. |
|
LookAtRH(Vector3, Vector3, Vector3) | Creates a right-handed, look-at matrix. |
|
LookAtRH(ref Vector3, ref Vector3, ref Vector3, out Matrix) | Creates a right-handed, look-at matrix. |
|
LowerTriangularForm(Matrix) | Brings the matrix into lower triangular form using elementry row operations. |
|
LowerTriangularForm(ref Matrix, out Matrix) | Brings the matrix into lower triangular form using elementry row operations. |
|
Multiply(Matrix, Matrix) | Determines the product of two matrices. |
|
Multiply(Matrix, Single) | Scales a matrix by the given value. |
|
Multiply(ref Matrix, ref Matrix, out Matrix) | Determines the product of two matrices.
Variables passed as |
|
Multiply(ref Matrix, Single, out Matrix) | Scales a matrix by the given value. |
|
MultiplyRef(ref Matrix, ref Matrix, ref Matrix) | Determines the product of two matrices.
Variables passed as |
|
MultiplyTo(ref Matrix, ref Matrix, out Matrix) | Determines the product of two matrices.
Variables passed as |
|
Negate(Matrix) | Negates a matrix. |
|
Negate(ref Matrix, out Matrix) | Negates a matrix. |
|
Orthogonalize() | Orthogonalizes the specified matrix. |
|
Orthogonalize(Matrix) | Orthogonalizes the specified matrix. |
|
Orthogonalize(ref Matrix, out Matrix) | Orthogonalizes the specified matrix. |
|
OrthoLH(Single, Single, Single, Single) | Creates a left-handed, orthographic projection matrix. |
|
OrthoLH(Single, Single, Single, Single, out Matrix) | Creates a left-handed, orthographic projection matrix. |
|
Orthonormalize() | Orthonormalizes the specified matrix. |
|
Orthonormalize(Matrix) | Orthonormalizes the specified matrix. |
|
Orthonormalize(ref Matrix, out Matrix) | Orthonormalizes the specified matrix. |
|
OrthoOffCenterLH(Single, Single, Single, Single, Single, Single) | Creates a left-handed, customized orthographic projection matrix. |
|
OrthoOffCenterLH(Single, Single, Single, Single, Single, Single, out Matrix) | Creates a left-handed, customized orthographic projection matrix. |
|
OrthoOffCenterRH(Single, Single, Single, Single, Single, Single) | Creates a right-handed, customized orthographic projection matrix. |
|
OrthoOffCenterRH(Single, Single, Single, Single, Single, Single, out Matrix) | Creates a right-handed, customized orthographic projection matrix. |
|
OrthoRH(Single, Single, Single, Single) | Creates a right-handed, orthographic projection matrix. |
|
OrthoRH(Single, Single, Single, Single, out Matrix) | Creates a right-handed, orthographic projection matrix. |
|
PerspectiveFovLH(Single, Single, Single, Single) | Creates a left-handed, perspective projection matrix based on a field of view. |
|
PerspectiveFovLH(Single, Single, Single, Single, out Matrix) | Creates a left-handed, perspective projection matrix based on a field of view. |
|
PerspectiveFovRH(Single, Single, Single, Single) | Creates a right-handed, perspective projection matrix based on a field of view. |
|
PerspectiveFovRH(Single, Single, Single, Single, out Matrix) | Creates a right-handed, perspective projection matrix based on a field of view. |
|
PerspectiveLH(Single, Single, Single, Single) | Creates a left-handed, perspective projection matrix. |
|
PerspectiveLH(Single, Single, Single, Single, out Matrix) | Creates a left-handed, perspective projection matrix. |
|
PerspectiveOffCenterLH(Single, Single, Single, Single, Single, Single) | Creates a left-handed, customized perspective projection matrix. |
|
PerspectiveOffCenterLH(Single, Single, Single, Single, Single, Single, out Matrix) | Creates a left-handed, customized perspective projection matrix. |
|
PerspectiveOffCenterRH(Single, Single, Single, Single, Single, Single) | Creates a right-handed, customized perspective projection matrix. |
|
PerspectiveOffCenterRH(Single, Single, Single, Single, Single, Single, out Matrix) | Creates a right-handed, customized perspective projection matrix. |
|
PerspectiveRH(Single, Single, Single, Single) | Creates a right-handed, perspective projection matrix. |
|
PerspectiveRH(Single, Single, Single, Single, out Matrix) | Creates a right-handed, perspective projection matrix. |
|
ReducedRowEchelonForm(ref Matrix, ref Vector4, out Matrix, out Vector4) | Brings the matrix into reduced row echelon form using elementry row operations. |
|
Reflection(Plane) | Builds a matrix that can be used to reflect vectors about a plane. |
|
Reflection(ref Plane, out Matrix) | Builds a matrix that can be used to reflect vectors about a plane. |
|
RotationAxis(Vector3, Single) | Creates a matrix that rotates around an arbitary axis. |
|
RotationAxis(ref Vector3, Single, out Matrix) | Creates a matrix that rotates around an arbitary axis. |
|
RotationQuaternion(Quaternion) | Creates a rotation matrix from a quaternion. |
|
RotationQuaternion(ref Quaternion, out Matrix) | Creates a rotation matrix from a quaternion. |
|
RotationX(Single) | Creates a matrix that rotates around the x-axis. |
|
RotationX(Single, out Matrix) | Creates a matrix that rotates around the x-axis. |
|
RotationY(Single) | Creates a matrix that rotates around the y-axis. |
|
RotationY(Single, out Matrix) | Creates a matrix that rotates around the y-axis. |
|
RotationYawPitchRoll(Single, Single, Single) | Creates a rotation matrix with a specified yaw, pitch, and roll. |
|
RotationYawPitchRoll(Single, Single, Single, out Matrix) | Creates a rotation matrix with a specified yaw, pitch, and roll. |
|
RotationZ(Single) | Creates a matrix that rotates around the z-axis. |
|
RotationZ(Single, out Matrix) | Creates a matrix that rotates around the z-axis. |
|
RowEchelonForm(Matrix) | Brings the matrix into row echelon form using elementry row operations; |
|
RowEchelonForm(ref Matrix, out Matrix) | Brings the matrix into row echelon form using elementry row operations; |
|
Scaling(Vector3) | Creates a matrix that scales along the x-axis, y-axis, and y-axis. |
|
Scaling(ref Vector3, out Matrix) | Creates a matrix that scales along the x-axis, y-axis, and y-axis. |
|
Scaling(Single) | Creates a matrix that uniformally scales along all three axis. |
|
Scaling(Single, out Matrix) | Creates a matrix that uniformally scales along all three axis. |
|
Scaling(Single, Single, Single) | Creates a matrix that scales along the x-axis, y-axis, and y-axis. |
|
Scaling(Single, Single, Single, out Matrix) | Creates a matrix that scales along the x-axis, y-axis, and y-axis. |
|
Shadow(Vector4, Plane) | Creates a matrix that flattens geometry into a shadow. |
|
Shadow(ref Vector4, ref Plane, out Matrix) | Creates a matrix that flattens geometry into a shadow. |
|
SmoothStep(Matrix, Matrix, Single) | Performs a cubic interpolation between two matrices. |
|
SmoothStep(ref Matrix, ref Matrix, Single, out Matrix) | Performs a cubic interpolation between two matrices. |
|
Subtract(Matrix, Matrix) | Determines the difference between two matrices. |
|
Subtract(ref Matrix, ref Matrix, out Matrix) | Determines the difference between two matrices. |
|
ToArray() | Creates an array containing the elements of the matrix. |
|
ToString() | Returns a System.String that represents this instance. |
|
ToString(IFormatProvider) | Returns a System.String that represents this instance. |
|
ToString(String) | Returns a System.String that represents this instance. |
|
ToString(String, IFormatProvider) | Returns a System.String that represents this instance. |
|
Transformation(Vector3, Quaternion, Vector3, Vector3, Quaternion, Vector3) | Creates a transformation matrix. |
|
Transformation(ref Vector3, ref Quaternion, ref Vector3, out Matrix) | Creates a matrix that contains both the X, Y and Z rotation, as well as scaling and translation. Note: This function is NOT thead safe. |
|
Transformation(ref Vector3, ref Quaternion, ref Vector3, ref Vector3, ref Quaternion, ref Vector3, out Matrix) | Creates a transformation matrix. |
|
Transformation2D(Vector2, Single, Vector2, Vector2, Single, Vector2) | Creates a 2D transformation matrix. |
|
Transformation2D(ref Vector2, Single, ref Vector2, ref Vector2, Single, ref Vector2, out Matrix) | Creates a 2D transformation matrix. |
|
Translation(Vector3) | Creates a translation matrix using the specified offsets. |
|
Translation(ref Vector3, out Matrix) | Creates a translation matrix using the specified offsets. |
|
Translation(Single, Single, Single) | Creates a translation matrix using the specified offsets. |
|
Translation(Single, Single, Single, out Matrix) | Creates a translation matrix using the specified offsets. |
|
Transpose() | Transposes the matrix. |
|
Transpose(Matrix) | Calculates the transpose of the specified matrix. |
|
Transpose(ref Matrix, out Matrix) | Calculates the transpose of the specified matrix. |
|
TransposeMatrixFrom(Single*, Int32, Int32) | Transposes a nmx matrix to this instance. |
|
UpperTriangularForm(Matrix) | Brings the matrix into upper triangular form using elementry row operations. |
|
UpperTriangularForm(ref Matrix, out Matrix) | Brings the matrix into upper triangular form using elementry row operations. |
|
Operators | ||
Addition(Matrix, Matrix) | Adds two matrices. |
|
Division(Matrix, Matrix) | Divides two matrices. |
|
Division(Matrix, Single) | Scales a matrix by a given value. |
|
Equality(Matrix, Matrix) | Tests for equality between two objects. |
|
Inequality(Matrix, Matrix) | Tests for inequality between two objects. |
|
Multiply(Matrix, Matrix) | Multiplies two matrices. |
|
Multiply(Matrix, Single) | Scales a matrix by a given value. |
|
Multiply(Single, Matrix) | Scales a matrix by a given value. |
|
Subtraction(Matrix, Matrix) | Subtracts two matrices. |
|
UnaryNegation(Matrix) | Negates a matrix. |
|
UnaryPlus(Matrix) | Assert a matrix (return it unchanged). |
Constructors
Matrix(Single)
Initializes a new instance of the Matrix struct.
public Matrix(float value)
Parameters
Type | Name | Description |
---|---|---|
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.
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
Type | Name | Description |
---|---|---|
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.
public Matrix(float[] values)
Parameters
Type | Name | Description |
---|---|---|
System.Single[] | values | The values to assign to the components of the matrix. This must be an array with sixteen elements. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
System.ArgumentOutOfRangeException | Thrown when |
Fields
Identity
The identity Matrix.
public static readonly Matrix Identity
Field Value
Type | Description |
---|---|
Matrix |
M11
Value at row 1 column 1 of the matrix.
public float M11
Field Value
Type | Description |
---|---|
System.Single |
M12
Value at row 1 column 2 of the matrix.
public float M12
Field Value
Type | Description |
---|---|
System.Single |
M13
Value at row 1 column 3 of the matrix.
public float M13
Field Value
Type | Description |
---|---|
System.Single |
M14
Value at row 1 column 4 of the matrix.
public float M14
Field Value
Type | Description |
---|---|
System.Single |
M21
Value at row 2 column 1 of the matrix.
public float M21
Field Value
Type | Description |
---|---|
System.Single |
M22
Value at row 2 column 2 of the matrix.
public float M22
Field Value
Type | Description |
---|---|
System.Single |
M23
Value at row 2 column 3 of the matrix.
public float M23
Field Value
Type | Description |
---|---|
System.Single |
M24
Value at row 2 column 4 of the matrix.
public float M24
Field Value
Type | Description |
---|---|
System.Single |
M31
Value at row 3 column 1 of the matrix.
public float M31
Field Value
Type | Description |
---|---|
System.Single |
M32
Value at row 3 column 2 of the matrix.
public float M32
Field Value
Type | Description |
---|---|
System.Single |
M33
Value at row 3 column 3 of the matrix.
public float M33
Field Value
Type | Description |
---|---|
System.Single |
M34
Value at row 3 column 4 of the matrix.
public float M34
Field Value
Type | Description |
---|---|
System.Single |
M41
Value at row 4 column 1 of the matrix.
public float M41
Field Value
Type | Description |
---|---|
System.Single |
M42
Value at row 4 column 2 of the matrix.
public float M42
Field Value
Type | Description |
---|---|
System.Single |
M43
Value at row 4 column 3 of the matrix.
public float M43
Field Value
Type | Description |
---|---|
System.Single |
M44
Value at row 4 column 4 of the matrix.
public float M44
Field Value
Type | Description |
---|---|
System.Single |
SizeInBytes
The size of the Matrix type, in bytes.
public static readonly int SizeInBytes
Field Value
Type | Description |
---|---|
System.Int32 |
Zero
A Matrix with all of its components set to zero.
public static readonly Matrix Zero
Field Value
Type | Description |
---|---|
Matrix |
Properties
Backward
Gets or sets the backward Vector3 of the matrix; that is M31, M32, and M33.
public Vector3 Backward { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Column1
Gets or sets the first column in the matrix; that is M11, M21, M31, and M41.
public Vector4 Column1 { get; set; }
Property Value
Type | Description |
---|---|
Vector4 |
Column2
Gets or sets the second column in the matrix; that is M12, M22, M32, and M42.
public Vector4 Column2 { get; set; }
Property Value
Type | Description |
---|---|
Vector4 |
Column3
Gets or sets the third column in the matrix; that is M13, M23, M33, and M43.
public Vector4 Column3 { get; set; }
Property Value
Type | Description |
---|---|
Vector4 |
Column4
Gets or sets the fourth column in the matrix; that is M14, M24, M34, and M44.
public Vector4 Column4 { get; set; }
Property Value
Type | Description |
---|---|
Vector4 |
Down
Gets or sets the down Vector3 of the matrix; that is -M21, -M22, and -M23.
public Vector3 Down { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Forward
Gets or sets the forward Vector3 of the matrix; that is -M31, -M32, and -M33.
public Vector3 Forward { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
IsIdentity
Gets a value indicating whether this instance is an identity matrix.
public readonly bool IsIdentity { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Item[Int32]
Gets or sets the component at the specified index.
public float this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the component to access. |
Property Value
Type | Description |
---|---|
System.Single | The value of the matrix component, depending on the index. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown when the |
Item[Int32, Int32]
Gets or sets the component at the specified index.
public float this[int row, int column] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | row | The row of the matrix to access. |
System.Int32 | column | The column of the matrix to access. |
Property Value
Type | Description |
---|---|
System.Single | The value of the matrix component, depending on the index. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown when the |
Left
Gets or sets the left Vector3 of the matrix; that is -M11, -M12, and -M13.
public Vector3 Left { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Right
Gets or sets the right Vector3 of the matrix; that is M11, M12, and M13.
public Vector3 Right { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Row1
Gets or sets the first row in the matrix; that is M11, M12, M13, and M14.
public Vector4 Row1 { get; set; }
Property Value
Type | Description |
---|---|
Vector4 |
Row2
Gets or sets the second row in the matrix; that is M21, M22, M23, and M24.
public Vector4 Row2 { get; set; }
Property Value
Type | Description |
---|---|
Vector4 |
Row3
Gets or sets the third row in the matrix; that is M31, M32, M33, and M34.
public Vector4 Row3 { get; set; }
Property Value
Type | Description |
---|---|
Vector4 |
Row4
Gets or sets the fourth row in the matrix; that is M41, M42, M43, and M44.
public Vector4 Row4 { get; set; }
Property Value
Type | Description |
---|---|
Vector4 |
ScaleVector
Gets or sets the scale of the matrix; that is M11, M22, and M33.
public Vector3 ScaleVector { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Remarks
This property does not do any computation and will return a correct scale vector only if the matrix is a scale matrix.
TranslationVector
Gets or sets the translation of the matrix; that is M41, M42, and M43.
public Vector3 TranslationVector { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Up
Gets or sets the up Vector3 of the matrix; that is M21, M22, and M23.
public Vector3 Up { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Methods
Add(Matrix, Matrix)
Determines the sum of two matrices.
public static Matrix Add(Matrix left, Matrix right)
Parameters
Type | Name | Description |
---|---|---|
Matrix | left | The first matrix to add. |
Matrix | right | The second matrix to add. |
Returns
Type | Description |
---|---|
Matrix | The sum of the two matrices. |
Add(ref Matrix, ref Matrix, out Matrix)
Determines the sum of two matrices.
public static void Add(ref Matrix left, ref Matrix right, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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, Quaternion, Vector3)
Creates a 3D affine transformation matrix.
public static Matrix AffineTransformation(float scaling, Quaternion rotation, Vector3 translation)
Parameters
Type | Name | Description |
---|---|---|
System.Single | scaling | Scaling factor. |
Quaternion | rotation | The rotation of the transformation. |
Vector3 | translation | The translation factor of the transformation. |
Returns
Type | Description |
---|---|
Matrix | The created affine transformation matrix. |
AffineTransformation(Single, ref Quaternion, ref Vector3, out Matrix)
Creates a 3D affine transformation matrix.
public static void AffineTransformation(float scaling, ref Quaternion rotation, ref Vector3 translation, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
System.Single | scaling | Scaling factor. |
Quaternion | rotation | The rotation of the transformation. |
Vector3 | translation | The translation factor of the transformation. |
Matrix | result | When the method completes, contains the created affine transformation matrix. |
AffineTransformation(Single, Vector3, Quaternion, Vector3)
Creates a 3D affine transformation matrix.
public static Matrix AffineTransformation(float scaling, Vector3 rotationCenter, Quaternion rotation, Vector3 translation)
Parameters
Type | Name | Description |
---|---|---|
System.Single | scaling | Scaling factor. |
Vector3 | rotationCenter | The center of the rotation. |
Quaternion | rotation | The rotation of the transformation. |
Vector3 | translation | The translation factor of the transformation. |
Returns
Type | Description |
---|---|
Matrix | The created affine transformation matrix. |
AffineTransformation(Single, ref Vector3, ref Quaternion, ref Vector3, out Matrix)
Creates a 3D affine transformation matrix.
public static void AffineTransformation(float scaling, ref Vector3 rotationCenter, ref Quaternion rotation, ref Vector3 translation, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
System.Single | scaling | Scaling factor. |
Vector3 | rotationCenter | The center of the rotation. |
Quaternion | rotation | The rotation of the transformation. |
Vector3 | translation | The translation factor of the transformation. |
Matrix | result | When the method completes, contains the created affine transformation matrix. |
AffineTransformation2D(Single, Vector2, Single, Vector2)
Creates a 2D affine transformation matrix.
public static Matrix AffineTransformation2D(float scaling, Vector2 rotationCenter, float rotation, Vector2 translation)
Parameters
Type | Name | Description |
---|---|---|
System.Single | scaling | Scaling factor. |
Vector2 | rotationCenter | The center of the rotation. |
System.Single | rotation | The rotation of the transformation. |
Vector2 | translation | The translation factor of the transformation. |
Returns
Type | Description |
---|---|
Matrix | The created affine transformation matrix. |
AffineTransformation2D(Single, ref Vector2, Single, ref Vector2, out Matrix)
Creates a 2D affine transformation matrix.
public static void AffineTransformation2D(float scaling, ref Vector2 rotationCenter, float rotation, ref Vector2 translation, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
System.Single | scaling | Scaling factor. |
Vector2 | rotationCenter | The center of the rotation. |
System.Single | rotation | The rotation of the transformation. |
Vector2 | translation | The translation factor of the transformation. |
Matrix | result | When the method completes, contains the created affine transformation matrix. |
AffineTransformation2D(Single, Single, Vector2)
Creates a 2D affine transformation matrix.
public static Matrix AffineTransformation2D(float scaling, float rotation, Vector2 translation)
Parameters
Type | Name | Description |
---|---|---|
System.Single | scaling | Scaling factor. |
System.Single | rotation | The rotation of the transformation. |
Vector2 | translation | The translation factor of the transformation. |
Returns
Type | Description |
---|---|
Matrix | The created affine transformation matrix. |
AffineTransformation2D(Single, Single, ref Vector2, out Matrix)
Creates a 2D affine transformation matrix.
public static void AffineTransformation2D(float scaling, float rotation, ref Vector2 translation, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
System.Single | scaling | Scaling factor. |
System.Single | rotation | The rotation of the transformation. |
Vector2 | translation | The translation factor of the transformation. |
Matrix | result | When the method completes, contains the created affine transformation matrix. |
Billboard(Vector3, Vector3, Vector3, Vector3)
Creates a spherical billboard that rotates around a specified object position.
public static Matrix Billboard(Vector3 objectPosition, Vector3 cameraPosition, Vector3 cameraUpVector, Vector3 cameraForwardVector)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | objectPosition | The position of the object around which the billboard will rotate. |
Vector3 | cameraPosition | The position of the camera. |
Vector3 | cameraUpVector | The up vector of the camera. |
Vector3 | cameraForwardVector | The forward vector of the camera. |
Returns
Type | Description |
---|---|
Matrix | The created billboard matrix. |
Billboard(ref Vector3, ref Vector3, ref Vector3, ref Vector3, out Matrix)
Creates a spherical billboard that rotates around a specified object position.
public static void Billboard(ref Vector3 objectPosition, ref Vector3 cameraPosition, ref Vector3 cameraUpVector, ref Vector3 cameraForwardVector, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | objectPosition | The position of the object around which the billboard will rotate. |
Vector3 | cameraPosition | The position of the camera. |
Vector3 | cameraUpVector | The up vector of the camera. |
Vector3 | cameraForwardVector | The forward vector of the camera. |
Matrix | result | When the method completes, contains the created billboard matrix. |
CopyMatrixFrom(Single*, Int32, Int32)
Copies a nxm matrix to this instance.
public void CopyMatrixFrom(float *src, int columns, int rows)
Parameters
Type | Name | Description |
---|---|---|
System.Single* | src | The source matrix. |
System.Int32 | columns | The number of columns. |
System.Int32 | rows | The number of rows. |
Decompose(out Vector3, out Matrix, out Vector3)
Decomposes a matrix into a scale, rotation, and translation.
public bool Decompose(out Vector3 scale, out Matrix rotation, out Vector3 translation)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | 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. |
Vector3 | translation | When the method completes, contains the translation component of the decomposed matrix. |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
This method is designed to decompose an SRT transformation matrix only.
Decompose(out Vector3, out Quaternion, out Vector3)
Decomposes a matrix into a scale, rotation, and translation.
public bool Decompose(out Vector3 scale, out Quaternion rotation, out Vector3 translation)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | 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. |
Vector3 | translation | When the method completes, contains the translation component of the decomposed matrix. |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
This method is designed to decompose an SRT transformation matrix only.
Decompose(out Vector3, out Vector3)
Decomposes a matrix into a scale, rotation, and translation.
public bool Decompose(out Vector3 scale, out Vector3 translation)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | scale | When the method completes, contains the scaling component of the decomposed matrix. |
Vector3 | translation | When the method completes, contains the translation component of the decomposed matrix. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
This method is designed to decompose an SRT transformation matrix only.
Decompose(out Single, out Single, out Single)
Decomposes a rotation matrix with the specified yaw, pitch, roll
public void Decompose(out float yaw, out float pitch, out float roll)
Parameters
Type | Name | Description |
---|---|---|
System.Single | yaw | The yaw. |
System.Single | pitch | The pitch. |
System.Single | roll | The roll. |
DecomposeLQ(out Matrix, out Matrix)
Decomposes a matrix into a lower triangular matrix L and an orthonormalized matrix Q.
public void DecomposeLQ(out Matrix L, out Matrix Q)
Parameters
Type | Name | Description |
---|---|---|
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 traingular matrix R.
public void DecomposeQR(out Matrix Q, out Matrix R)
Parameters
Type | Name | Description |
---|---|---|
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. |
DecomposeXYZ(out Vector3)
Decomposes a rotation matrix with the specified X, Y and Z euler angles. Matrix.RotationX(rotation.X) * Matrix.RotationY(rotation.Y) * Matrix.RotationZ(rotation.Z) should represent the same rotation.
public void DecomposeXYZ(out Vector3 rotation)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | rotation | The vector containing the 3 rotations angles to be applied in order. |
Determinant()
Calculates the determinant of the matrix.
public float Determinant()
Returns
Type | Description |
---|---|
System.Single | The determinant of the matrix. |
Divide(Matrix, Matrix)
Determines the quotient of two matrices.
public static Matrix Divide(Matrix left, Matrix right)
Parameters
Type | Name | Description |
---|---|---|
Matrix | left | The first matrix to divide. |
Matrix | right | The second matrix to divide. |
Returns
Type | Description |
---|---|
Matrix | The quotient of the two matrices. |
Divide(Matrix, Single)
Scales a matrix by the given value.
public static Matrix Divide(Matrix left, float right)
Parameters
Type | Name | Description |
---|---|---|
Matrix | left | The matrix to scale. |
System.Single | right | The amount by which to scale. |
Returns
Type | Description |
---|---|
Matrix | The scaled matrix. |
Divide(ref Matrix, ref Matrix, out Matrix)
Determines the quotient of two matrices.
public static void Divide(ref Matrix left, ref Matrix right, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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.
public static void Divide(ref Matrix left, float right, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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.
public bool Equals(Matrix other)
Parameters
Type | Name | Description |
---|---|---|
Matrix | other | The Matrix to compare with this instance. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Equals(Object)
Determines whether the specified System.Object is equal to this instance.
public override bool Equals(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The System.Object to compare with this instance. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Overrides
ExchangeColumns(Int32, Int32)
Exchange columns.
public void ExchangeColumns(int firstColumn, int secondColumn)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | firstColumn | The first column to exchange. |
System.Int32 | secondColumn | The second column to exchange. |
ExchangeRows(Int32, Int32)
Exchanges two rows in the matrix.
public void ExchangeRows(int firstRow, int secondRow)
Parameters
Type | Name | Description |
---|---|---|
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.
public static Matrix Exponent(Matrix value, int exponent)
Parameters
Type | Name | Description |
---|---|---|
Matrix | value | The matrix to perform the operation on. |
System.Int32 | exponent | The exponent to raise the matrix to. |
Returns
Type | Description |
---|---|
Matrix | The exponential matrix. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown when the |
Exponent(ref Matrix, Int32, out Matrix)
Performs the exponential operation on a matrix.
public static void Exponent(ref Matrix value, int exponent, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown when the |
GetHashCode()
Returns a hash code for this instance.
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
Invert()
Inverts the matrix.
public void Invert()
Invert(Matrix)
Calculates the inverse of the specified matrix.
public static Matrix Invert(Matrix value)
Parameters
Type | Name | Description |
---|---|---|
Matrix | value | The matrix whose inverse is to be calculated. |
Returns
Type | Description |
---|---|
Matrix | The inverse of the specified matrix. |
Invert(ref Matrix, out Matrix)
Calculates the inverse of the specified matrix.
public static void Invert(ref Matrix value, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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.
public static Matrix Lerp(Matrix start, Matrix end, float amount)
Parameters
Type | Name | Description |
---|---|---|
Matrix | start | Start matrix. |
Matrix | end | End matrix. |
System.Single | amount | Value between 0 and 1 indicating the weight of |
Returns
Type | Description |
---|---|
Matrix | The linear interpolation of the two matrices. |
Remarks
This method performs the linear interpolation based on the following formula.
start + (end - start) * amount
Passing amount
a value of 0 will cause start
to be returned; a value of 1 will cause end
to be returned.
Lerp(ref Matrix, ref Matrix, Single, out Matrix)
Performs a linear interpolation between two matrices.
public static void Lerp(ref Matrix start, ref Matrix end, float amount, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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
This method performs the linear interpolation based on the following formula.
start + (end - start) * amount
Passing amount
a value of 0 will cause start
to be returned; a value of 1 will cause end
to be returned.
LookAtLH(Vector3, Vector3, Vector3)
Creates a left-handed, look-at matrix.
public static Matrix LookAtLH(Vector3 eye, Vector3 target, Vector3 up)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | eye | The position of the viewer's eye. |
Vector3 | target | The camera look-at target. |
Vector3 | up | The camera's up vector. |
Returns
Type | Description |
---|---|
Matrix | The created look-at matrix. |
LookAtLH(ref Vector3, ref Vector3, ref Vector3, out Matrix)
Creates a left-handed, look-at matrix.
public static void LookAtLH(ref Vector3 eye, ref Vector3 target, ref Vector3 up, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | eye | The position of the viewer's eye. |
Vector3 | target | The camera look-at target. |
Vector3 | up | The camera's up vector. |
Matrix | result | When the method completes, contains the created look-at matrix. |
LookAtRH(Vector3, Vector3, Vector3)
Creates a right-handed, look-at matrix.
public static Matrix LookAtRH(Vector3 eye, Vector3 target, Vector3 up)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | eye | The position of the viewer's eye. |
Vector3 | target | The camera look-at target. |
Vector3 | up | The camera's up vector. |
Returns
Type | Description |
---|---|
Matrix | The created look-at matrix. |
LookAtRH(ref Vector3, ref Vector3, ref Vector3, out Matrix)
Creates a right-handed, look-at matrix.
public static void LookAtRH(ref Vector3 eye, ref Vector3 target, ref Vector3 up, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | eye | The position of the viewer's eye. |
Vector3 | target | The camera look-at target. |
Vector3 | 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 elementry row operations.
public static Matrix LowerTriangularForm(Matrix value)
Parameters
Type | Name | Description |
---|---|---|
Matrix | value | The matrix to put into lower triangular form. |
Returns
Type | Description |
---|---|
Matrix | The lower triangular matrix. |
Remarks
If the matrix is not invertable (i.e. its determinant is zero) than the result of this method may produce Single.Nan and Single.Inf values. When the matrix represents a system of linear equations, than this often means that either no solution exists or an infinite number of solutions exist.
LowerTriangularForm(ref Matrix, out Matrix)
Brings the matrix into lower triangular form using elementry row operations.
public static void LowerTriangularForm(ref Matrix value, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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 invertable (i.e. its determinant is zero) than the result of this method may produce Single.Nan and Single.Inf values. When the matrix represents a system of linear equations, than this often means that either no solution exists or an infinite number of solutions exist.
Multiply(Matrix, Matrix)
Determines the product of two matrices.
public static Matrix Multiply(Matrix left, Matrix right)
Parameters
Type | Name | Description |
---|---|---|
Matrix | left | The first matrix to multiply. |
Matrix | right | The second matrix to multiply. |
Returns
Type | Description |
---|---|
Matrix | The product of the two matrices. |
Multiply(Matrix, Single)
Scales a matrix by the given value.
public static Matrix Multiply(Matrix left, float right)
Parameters
Type | Name | Description |
---|---|---|
Matrix | left | The matrix to scale. |
System.Single | right | The amount by which to scale. |
Returns
Type | Description |
---|---|
Matrix | The scaled matrix. |
Multiply(ref Matrix, ref Matrix, out Matrix)
Determines the product of two matrices.
Variables passed as left
or right
must not be used as the out parameter
result
, because result
is calculated in-place.
public static void Multiply(ref Matrix left, ref Matrix right, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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.
public static void Multiply(ref Matrix left, float right, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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. |
MultiplyRef(ref Matrix, ref Matrix, ref Matrix)
Determines the product of two matrices.
Variables passed as left
or right
must not be used as the out parameter
result
, because result
is calculated in-place.
public static void MultiplyRef(ref Matrix left, ref Matrix right, ref Matrix result)
Parameters
Type | Name | Description |
---|---|---|
Matrix | left | The first matrix to multiply. |
Matrix | right | The second matrix to multiply. |
Matrix | result | The product of the two matrices. |
MultiplyTo(ref Matrix, ref Matrix, out Matrix)
Determines the product of two matrices.
Variables passed as left
or right
must not be used as the out parameter
result
, because result
is calculated in-place.
public static void MultiplyTo(ref Matrix left, ref Matrix right, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
Matrix | left | The first matrix to multiply. |
Matrix | right | The second matrix to multiply. |
Matrix | result | The product of the two matrices. |
Negate(Matrix)
Negates a matrix.
public static Matrix Negate(Matrix value)
Parameters
Type | Name | Description |
---|---|---|
Matrix | value | The matrix to be negated. |
Returns
Type | Description |
---|---|
Matrix | The negated matrix. |
Negate(ref Matrix, out Matrix)
Negates a matrix.
public static void Negate(ref Matrix value, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
Matrix | value | The matrix to be negated. |
Matrix | result | When the method completes, contains the negated matrix. |
Orthogonalize()
Orthogonalizes the specified matrix.
public void Orthogonalize()
Remarks
Orthogonalization is the process of making all rows orthogonal to each other. This means that any given row in the matrix will be orthogonal to any other given row in the matrix.
Because this method uses the modified Gram-Schmidt process, the resulting matrix tends to be numerically unstable. The numeric stability decreases according to the rows so that the first row is the most stable and the last row is the least stable.
This operation is performed on the rows of the matrix rather than the columns. If you wish for this operation to be performed on the columns, first transpose the input and than transpose the output.
Orthogonalize(Matrix)
Orthogonalizes the specified matrix.
public static Matrix Orthogonalize(Matrix value)
Parameters
Type | Name | Description |
---|---|---|
Matrix | value | The matrix to orthogonalize. |
Returns
Type | Description |
---|---|
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.
public static void Orthogonalize(ref Matrix value, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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.
OrthoLH(Single, Single, Single, Single)
Creates a left-handed, orthographic projection matrix.
public static Matrix OrthoLH(float width, float height, float znear, float zfar)
Parameters
Type | Name | Description |
---|---|---|
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
Type | Description |
---|---|
Matrix | The created projection matrix. |
OrthoLH(Single, Single, Single, Single, out Matrix)
Creates a left-handed, orthographic projection matrix.
public static void OrthoLH(float width, float height, float znear, float zfar, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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. |
Orthonormalize()
Orthonormalizes the specified matrix.
public void Orthonormalize()
Remarks
Orthonormalization is the process of making all rows and columns orthogonal to each other and making all rows and columns of unit length. This means that any given row will be orthogonal to any other given row and any given column will be orthogonal to any other given column. Any given row will not be orthogonal to any given column. Every row and every column will be of unit length.
Because this method uses the modified Gram-Schmidt process, the resulting matrix tends to be numerically unstable. The numeric stability decreases according to the rows so that the first row is the most stable and the last row is the least stable.
This operation is performed on the rows of the matrix rather than the columns. If you wish for this operation to be performed on the columns, first transpose the input and than transpose the output.
Orthonormalize(Matrix)
Orthonormalizes the specified matrix.
public static Matrix Orthonormalize(Matrix value)
Parameters
Type | Name | Description |
---|---|---|
Matrix | value | The matrix to orthonormalize. |
Returns
Type | Description |
---|---|
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.
public static void Orthonormalize(ref Matrix value, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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.
OrthoOffCenterLH(Single, Single, Single, Single, Single, Single)
Creates a left-handed, customized orthographic projection matrix.
public static Matrix OrthoOffCenterLH(float left, float right, float bottom, float top, float znear, float zfar)
Parameters
Type | Name | Description |
---|---|---|
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
Type | Description |
---|---|
Matrix | The created projection matrix. |
OrthoOffCenterLH(Single, Single, Single, Single, Single, Single, out Matrix)
Creates a left-handed, customized orthographic projection matrix.
public static void OrthoOffCenterLH(float left, float right, float bottom, float top, float znear, float zfar, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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. |
OrthoOffCenterRH(Single, Single, Single, Single, Single, Single)
Creates a right-handed, customized orthographic projection matrix.
public static Matrix OrthoOffCenterRH(float left, float right, float bottom, float top, float znear, float zfar)
Parameters
Type | Name | Description |
---|---|---|
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
Type | Description |
---|---|
Matrix | The created projection matrix. |
OrthoOffCenterRH(Single, Single, Single, Single, Single, Single, out Matrix)
Creates a right-handed, customized orthographic projection matrix.
public static void OrthoOffCenterRH(float left, float right, float bottom, float top, float znear, float zfar, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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. |
OrthoRH(Single, Single, Single, Single)
Creates a right-handed, orthographic projection matrix.
public static Matrix OrthoRH(float width, float height, float znear, float zfar)
Parameters
Type | Name | Description |
---|---|---|
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
Type | Description |
---|---|
Matrix | The created projection matrix. |
OrthoRH(Single, Single, Single, Single, out Matrix)
Creates a right-handed, orthographic projection matrix.
public static void OrthoRH(float width, float height, float znear, float zfar, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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. |
PerspectiveFovLH(Single, Single, Single, Single)
Creates a left-handed, perspective projection matrix based on a field of view.
public static Matrix PerspectiveFovLH(float fov, float aspect, float znear, float zfar)
Parameters
Type | Name | Description |
---|---|---|
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
Type | Description |
---|---|
Matrix | The created projection matrix. |
PerspectiveFovLH(Single, Single, Single, Single, out Matrix)
Creates a left-handed, perspective projection matrix based on a field of view.
public static void PerspectiveFovLH(float fov, float aspect, float znear, float zfar, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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. |
PerspectiveFovRH(Single, Single, Single, Single)
Creates a right-handed, perspective projection matrix based on a field of view.
public static Matrix PerspectiveFovRH(float fov, float aspect, float znear, float zfar)
Parameters
Type | Name | Description |
---|---|---|
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
Type | Description |
---|---|
Matrix | The created projection matrix. |
PerspectiveFovRH(Single, Single, Single, Single, out Matrix)
Creates a right-handed, perspective projection matrix based on a field of view.
public static void PerspectiveFovRH(float fov, float aspect, float znear, float zfar, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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. |
PerspectiveLH(Single, Single, Single, Single)
Creates a left-handed, perspective projection matrix.
public static Matrix PerspectiveLH(float width, float height, float znear, float zfar)
Parameters
Type | Name | Description |
---|---|---|
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
Type | Description |
---|---|
Matrix | The created projection matrix. |
PerspectiveLH(Single, Single, Single, Single, out Matrix)
Creates a left-handed, perspective projection matrix.
public static void PerspectiveLH(float width, float height, float znear, float zfar, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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. |
PerspectiveOffCenterLH(Single, Single, Single, Single, Single, Single)
Creates a left-handed, customized perspective projection matrix.
public static Matrix PerspectiveOffCenterLH(float left, float right, float bottom, float top, float znear, float zfar)
Parameters
Type | Name | Description |
---|---|---|
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
Type | Description |
---|---|
Matrix | The created projection matrix. |
PerspectiveOffCenterLH(Single, Single, Single, Single, Single, Single, out Matrix)
Creates a left-handed, customized perspective projection matrix.
public static void PerspectiveOffCenterLH(float left, float right, float bottom, float top, float znear, float zfar, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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. |
PerspectiveOffCenterRH(Single, Single, Single, Single, Single, Single)
Creates a right-handed, customized perspective projection matrix.
public static Matrix PerspectiveOffCenterRH(float left, float right, float bottom, float top, float znear, float zfar)
Parameters
Type | Name | Description |
---|---|---|
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
Type | Description |
---|---|
Matrix | The created projection matrix. |
PerspectiveOffCenterRH(Single, Single, Single, Single, Single, Single, out Matrix)
Creates a right-handed, customized perspective projection matrix.
public static void PerspectiveOffCenterRH(float left, float right, float bottom, float top, float znear, float zfar, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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. |
PerspectiveRH(Single, Single, Single, Single)
Creates a right-handed, perspective projection matrix.
public static Matrix PerspectiveRH(float width, float height, float znear, float zfar)
Parameters
Type | Name | Description |
---|---|---|
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
Type | Description |
---|---|
Matrix | The created projection matrix. |
PerspectiveRH(Single, Single, Single, Single, out Matrix)
Creates a right-handed, perspective projection matrix.
public static void PerspectiveRH(float width, float height, float znear, float zfar, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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. |
ReducedRowEchelonForm(ref Matrix, ref Vector4, out Matrix, out Vector4)
Brings the matrix into reduced row echelon form using elementry row operations.
public static void ReducedRowEchelonForm(ref Matrix value, ref Vector4 augment, out Matrix result, out Vector4 augmentResult)
Parameters
Type | Name | Description |
---|---|---|
Matrix | value | The matrix to put into reduced row echelon form. |
Vector4 | augment | The fifth column of the matrix. |
Matrix | result | When the method completes, contains the resultant matrix after the operation. |
Vector4 | augmentResult | When the method completes, contains the resultant fifth column of the matrix. |
Remarks
The fifth column is often called the agumented part of the matrix. This is because the fifth column is really just an extension of the matrix so that there is a place to put all of the non-zero components after the operation is complete.
Often times the resultant matrix will the identity matrix or a matrix similar to the identity matrix. Sometimes, however, that is not possible and numbers other than zero and one may appear.
This method can be used to solve systems of linear equations. Upon completion of this method,
the augmentResult
will contain the solution for the system. It is up to the user
to analyze both the input and the result to determine if a solution really exists.
Reflection(Plane)
Builds a matrix that can be used to reflect vectors about a plane.
public static Matrix Reflection(Plane plane)
Parameters
Type | Name | Description |
---|---|---|
Plane | plane | The plane for which the reflection occurs. This parameter is assumed to be normalized. |
Returns
Type | Description |
---|---|
Matrix | The reflection matrix. |
Reflection(ref Plane, out Matrix)
Builds a matrix that can be used to reflect vectors about a plane.
public static void Reflection(ref Plane plane, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
Plane | plane | The plane for which the reflection occurs. This parameter is assumed to be normalized. |
Matrix | result | When the method completes, contains the reflection matrix. |
RotationAxis(Vector3, Single)
Creates a matrix that rotates around an arbitary axis.
public static Matrix RotationAxis(Vector3 axis, float angle)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | 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
Type | Description |
---|---|
Matrix | The created rotation matrix. |
RotationAxis(ref Vector3, Single, out Matrix)
Creates a matrix that rotates around an arbitary axis.
public static void RotationAxis(ref Vector3 axis, float angle, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | 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.
public static Matrix RotationQuaternion(Quaternion rotation)
Parameters
Type | Name | Description |
---|---|---|
Quaternion | rotation | The quaternion to use to build the matrix. |
Returns
Type | Description |
---|---|
Matrix | The created rotation matrix. |
RotationQuaternion(ref Quaternion, out Matrix)
Creates a rotation matrix from a quaternion.
public static void RotationQuaternion(ref Quaternion rotation, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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.
public static Matrix RotationX(float angle)
Parameters
Type | Name | Description |
---|---|---|
System.Single | angle | Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin. |
Returns
Type | Description |
---|---|
Matrix | The created rotation matrix. |
RotationX(Single, out Matrix)
Creates a matrix that rotates around the x-axis.
public static void RotationX(float angle, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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.
public static Matrix RotationY(float angle)
Parameters
Type | Name | Description |
---|---|---|
System.Single | angle | Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin. |
Returns
Type | Description |
---|---|
Matrix | The created rotation matrix. |
RotationY(Single, out Matrix)
Creates a matrix that rotates around the y-axis.
public static void RotationY(float angle, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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.
public static Matrix RotationYawPitchRoll(float yaw, float pitch, float roll)
Parameters
Type | Name | Description |
---|---|---|
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
Type | Description |
---|---|
Matrix | The created rotation matrix. |
RotationYawPitchRoll(Single, Single, Single, out Matrix)
Creates a rotation matrix with a specified yaw, pitch, and roll.
public static void RotationYawPitchRoll(float yaw, float pitch, float roll, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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.
public static Matrix RotationZ(float angle)
Parameters
Type | Name | Description |
---|---|---|
System.Single | angle | Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin. |
Returns
Type | Description |
---|---|
Matrix | The created rotation matrix. |
RotationZ(Single, out Matrix)
Creates a matrix that rotates around the z-axis.
public static void RotationZ(float angle, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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 elementry row operations;
public static Matrix RowEchelonForm(Matrix value)
Parameters
Type | Name | Description |
---|---|---|
Matrix | value | The matrix to put into row echelon form. |
Returns
Type | Description |
---|---|
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 elementry row operations;
public static void RowEchelonForm(ref Matrix value, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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(Vector3)
Creates a matrix that scales along the x-axis, y-axis, and y-axis.
public static Matrix Scaling(Vector3 scale)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | scale | Scaling factor for all three axes. |
Returns
Type | Description |
---|---|
Matrix | The created scaling matrix. |
Scaling(ref Vector3, out Matrix)
Creates a matrix that scales along the x-axis, y-axis, and y-axis.
public static void Scaling(ref Vector3 scale, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | scale | Scaling factor for all three axes. |
Matrix | result | When the method completes, contains the created scaling matrix. |
Scaling(Single)
Creates a matrix that uniformally scales along all three axis.
public static Matrix Scaling(float scale)
Parameters
Type | Name | Description |
---|---|---|
System.Single | scale | The uniform scale that is applied along all axis. |
Returns
Type | Description |
---|---|
Matrix | The created scaling matrix. |
Scaling(Single, out Matrix)
Creates a matrix that uniformally scales along all three axis.
public static void Scaling(float scale, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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.
public static Matrix Scaling(float x, float y, float z)
Parameters
Type | Name | Description |
---|---|---|
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
Type | Description |
---|---|
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.
public static void Scaling(float x, float y, float z, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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. |
Shadow(Vector4, Plane)
Creates a matrix that flattens geometry into a shadow.
public static Matrix Shadow(Vector4 light, Plane plane)
Parameters
Type | Name | Description |
---|---|---|
Vector4 | light | The light direction. If the W component is 0, the light is directional light; if the W component is 1, the light is a point light. |
Plane | plane | The plane onto which to project the geometry as a shadow. This parameter is assumed to be normalized. |
Returns
Type | Description |
---|---|
Matrix | The shadow matrix. |
Shadow(ref Vector4, ref Plane, out Matrix)
Creates a matrix that flattens geometry into a shadow.
public static void Shadow(ref Vector4 light, ref Plane plane, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
Vector4 | light | The light direction. If the W component is 0, the light is directional light; if the W component is 1, the light is a point light. |
Plane | plane | The plane onto which to project the geometry as a shadow. This parameter is assumed to be normalized. |
Matrix | result | When the method completes, contains the shadow matrix. |
SmoothStep(Matrix, Matrix, Single)
Performs a cubic interpolation between two matrices.
public static Matrix SmoothStep(Matrix start, Matrix end, float amount)
Parameters
Type | Name | Description |
---|---|---|
Matrix | start | Start matrix. |
Matrix | end | End matrix. |
System.Single | amount | Value between 0 and 1 indicating the weight of |
Returns
Type | Description |
---|---|
Matrix | The cubic interpolation of the two matrices. |
SmoothStep(ref Matrix, ref Matrix, Single, out Matrix)
Performs a cubic interpolation between two matrices.
public static void SmoothStep(ref Matrix start, ref Matrix end, float amount, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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.
public static Matrix Subtract(Matrix left, Matrix right)
Parameters
Type | Name | Description |
---|---|---|
Matrix | left | The first matrix to subtract. |
Matrix | right | The second matrix to subtract. |
Returns
Type | Description |
---|---|
Matrix | The difference between the two matrices. |
Subtract(ref Matrix, ref Matrix, out Matrix)
Determines the difference between two matrices.
public static void Subtract(ref Matrix left, ref Matrix right, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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.
public float[] ToArray()
Returns
Type | Description |
---|---|
System.Single[] | A sixteen-element array containing the components of the matrix. |
ToString()
Returns a System.String that represents this instance.
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
Overrides
ToString(IFormatProvider)
Returns a System.String that represents this instance.
public string ToString(IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
System.IFormatProvider | formatProvider | The format provider. |
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
ToString(String)
Returns a System.String that represents this instance.
public string ToString(string format)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | The format. |
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
ToString(String, IFormatProvider)
Returns a System.String that represents this instance.
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | The format. |
System.IFormatProvider | formatProvider | The format provider. |
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
Transformation(Vector3, Quaternion, Vector3, Vector3, Quaternion, Vector3)
Creates a transformation matrix.
public static Matrix Transformation(Vector3 scalingCenter, Quaternion scalingRotation, Vector3 scaling, Vector3 rotationCenter, Quaternion rotation, Vector3 translation)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | scalingCenter | Center point of the scaling operation. |
Quaternion | scalingRotation | Scaling rotation amount. |
Vector3 | scaling | Scaling factor. |
Vector3 | rotationCenter | The center of the rotation. |
Quaternion | rotation | The rotation of the transformation. |
Vector3 | translation | The translation factor of the transformation. |
Returns
Type | Description |
---|---|
Matrix | The created transformation matrix. |
Transformation(ref Vector3, ref Quaternion, ref Vector3, out Matrix)
Creates a matrix that contains both the X, Y and Z rotation, as well as scaling and translation. Note: This function is NOT thead safe.
public static void Transformation(ref Vector3 scaling, ref Quaternion rotation, ref Vector3 translation, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | scaling | The scaling. |
Quaternion | rotation | Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin. |
Vector3 | translation | The translation. |
Matrix | result | When the method completes, contains the created rotation matrix. |
Transformation(ref Vector3, ref Quaternion, ref Vector3, ref Vector3, ref Quaternion, ref Vector3, out Matrix)
Creates a transformation matrix.
public static void Transformation(ref Vector3 scalingCenter, ref Quaternion scalingRotation, ref Vector3 scaling, ref Vector3 rotationCenter, ref Quaternion rotation, ref Vector3 translation, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | scalingCenter | Center point of the scaling operation. |
Quaternion | scalingRotation | Scaling rotation amount. |
Vector3 | scaling | Scaling factor. |
Vector3 | rotationCenter | The center of the rotation. |
Quaternion | rotation | The rotation of the transformation. |
Vector3 | translation | The translation factor of the transformation. |
Matrix | result | When the method completes, contains the created transformation matrix. |
Transformation2D(Vector2, Single, Vector2, Vector2, Single, Vector2)
Creates a 2D transformation matrix.
public static Matrix Transformation2D(Vector2 scalingCenter, float scalingRotation, Vector2 scaling, Vector2 rotationCenter, float rotation, Vector2 translation)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | scalingCenter | Center point of the scaling operation. |
System.Single | scalingRotation | Scaling rotation amount. |
Vector2 | scaling | Scaling factor. |
Vector2 | rotationCenter | The center of the rotation. |
System.Single | rotation | The rotation of the transformation. |
Vector2 | translation | The translation factor of the transformation. |
Returns
Type | Description |
---|---|
Matrix | The created transformation matrix. |
Transformation2D(ref Vector2, Single, ref Vector2, ref Vector2, Single, ref Vector2, out Matrix)
Creates a 2D transformation matrix.
public static void Transformation2D(ref Vector2 scalingCenter, float scalingRotation, ref Vector2 scaling, ref Vector2 rotationCenter, float rotation, ref Vector2 translation, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | scalingCenter | Center point of the scaling operation. |
System.Single | scalingRotation | Scaling rotation amount. |
Vector2 | scaling | Scaling factor. |
Vector2 | rotationCenter | The center of the rotation. |
System.Single | rotation | The rotation of the transformation. |
Vector2 | translation | The translation factor of the transformation. |
Matrix | result | When the method completes, contains the created transformation matrix. |
Translation(Vector3)
Creates a translation matrix using the specified offsets.
public static Matrix Translation(Vector3 value)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | value | The offset for all three coordinate planes. |
Returns
Type | Description |
---|---|
Matrix | The created translation matrix. |
Translation(ref Vector3, out Matrix)
Creates a translation matrix using the specified offsets.
public static void Translation(ref Vector3 value, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | 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.
public static Matrix Translation(float x, float y, float z)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x | X-coordinate offset. |
System.Single | y | Y-coordinate offset. |
System.Single | z | Z-coordinate offset. |
Returns
Type | Description |
---|---|
Matrix | The created translation matrix. |
Translation(Single, Single, Single, out Matrix)
Creates a translation matrix using the specified offsets.
public static void Translation(float x, float y, float z, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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.
public void Transpose()
Transpose(Matrix)
Calculates the transpose of the specified matrix.
public static Matrix Transpose(Matrix value)
Parameters
Type | Name | Description |
---|---|---|
Matrix | value | The matrix whose transpose is to be calculated. |
Returns
Type | Description |
---|---|
Matrix | The transpose of the specified matrix. |
Transpose(ref Matrix, out Matrix)
Calculates the transpose of the specified matrix.
public static void Transpose(ref Matrix value, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
Matrix | value | The matrix whose transpose is to be calculated. |
Matrix | result | When the method completes, contains the transpose of the specified matrix. |
TransposeMatrixFrom(Single*, Int32, Int32)
Transposes a nmx matrix to this instance.
public void TransposeMatrixFrom(float *src, int columns, int rows)
Parameters
Type | Name | Description |
---|---|---|
System.Single* | src | The SRC. |
System.Int32 | columns | The columns. |
System.Int32 | rows | The rows. |
UpperTriangularForm(Matrix)
Brings the matrix into upper triangular form using elementry row operations.
public static Matrix UpperTriangularForm(Matrix value)
Parameters
Type | Name | Description |
---|---|---|
Matrix | value | The matrix to put into upper triangular form. |
Returns
Type | Description |
---|---|
Matrix | The upper triangular matrix. |
Remarks
If the matrix is not invertable (i.e. its determinant is zero) than the result of this method may produce Single.Nan and Single.Inf values. When the matrix represents a system of linear equations, than this often means that either no solution exists or an infinite number of solutions exist.
UpperTriangularForm(ref Matrix, out Matrix)
Brings the matrix into upper triangular form using elementry row operations.
public static void UpperTriangularForm(ref Matrix value, out Matrix result)
Parameters
Type | Name | Description |
---|---|---|
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 invertable (i.e. its determinant is zero) than the result of this method may produce Single.Nan and Single.Inf values. When the matrix represents a system of linear equations, than this often means that either no solution exists or an infinite number of solutions exist.
Operators
Addition(Matrix, Matrix)
Adds two matrices.
public static Matrix operator +(Matrix left, Matrix right)
Parameters
Type | Name | Description |
---|---|---|
Matrix | left | The first matrix to add. |
Matrix | right | The second matrix to add. |
Returns
Type | Description |
---|---|
Matrix | The sum of the two matrices. |
Division(Matrix, Matrix)
Divides two matrices.
public static Matrix operator /(Matrix left, Matrix right)
Parameters
Type | Name | Description |
---|---|---|
Matrix | left | The first matrix to divide. |
Matrix | right | The second matrix to divide. |
Returns
Type | Description |
---|---|
Matrix | The quotient of the two matrices. |
Division(Matrix, Single)
Scales a matrix by a given value.
public static Matrix operator /(Matrix left, float right)
Parameters
Type | Name | Description |
---|---|---|
Matrix | left | The matrix to scale. |
System.Single | right | The amount by which to scale. |
Returns
Type | Description |
---|---|
Matrix | The scaled matrix. |
Equality(Matrix, Matrix)
Tests for equality between two objects.
public static bool operator ==(Matrix left, Matrix right)
Parameters
Type | Name | Description |
---|---|---|
Matrix | left | The first value to compare. |
Matrix | right | The second value to compare. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Inequality(Matrix, Matrix)
Tests for inequality between two objects.
public static bool operator !=(Matrix left, Matrix right)
Parameters
Type | Name | Description |
---|---|---|
Matrix | left | The first value to compare. |
Matrix | right | The second value to compare. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Multiply(Matrix, Matrix)
Multiplies two matrices.
public static Matrix operator *(Matrix left, Matrix right)
Parameters
Type | Name | Description |
---|---|---|
Matrix | left | The first matrix to multiply. |
Matrix | right | The second matrix to multiply. |
Returns
Type | Description |
---|---|
Matrix | The product of the two matrices. |
Multiply(Matrix, Single)
Scales a matrix by a given value.
public static Matrix operator *(Matrix left, float right)
Parameters
Type | Name | Description |
---|---|---|
Matrix | left | The matrix to scale. |
System.Single | right | The amount by which to scale. |
Returns
Type | Description |
---|---|
Matrix | The scaled matrix. |
Multiply(Single, Matrix)
Scales a matrix by a given value.
public static Matrix operator *(float left, Matrix right)
Parameters
Type | Name | Description |
---|---|---|
System.Single | left | The amount by which to scale. |
Matrix | right | The matrix to scale. |
Returns
Type | Description |
---|---|
Matrix | The scaled matrix. |
Subtraction(Matrix, Matrix)
Subtracts two matrices.
public static Matrix operator -(Matrix left, Matrix right)
Parameters
Type | Name | Description |
---|---|---|
Matrix | left | The first matrix to subtract. |
Matrix | right | The second matrix to subtract. |
Returns
Type | Description |
---|---|
Matrix | The difference between the two matrices. |
UnaryNegation(Matrix)
Negates a matrix.
public static Matrix operator -(Matrix value)
Parameters
Type | Name | Description |
---|---|---|
Matrix | value | The matrix to negate. |
Returns
Type | Description |
---|---|
Matrix | The negated matrix. |
UnaryPlus(Matrix)
Assert a matrix (return it unchanged).
public static Matrix operator +(Matrix value)
Parameters
Type | Name | Description |
---|---|---|
Matrix | value | The matrix to assert (unchange). |
Returns
Type | Description |
---|---|
Matrix | The asserted (unchanged) matrix. |