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