Struct Matrix3x3
- Namespace
- HelixToolkit.Maths
- Assembly
- HelixToolkit.Maths.dll
Represents a 3x3 Matrix ( contains only Scale and Rotation ).
public struct Matrix3x3 : IEquatable<Matrix3x3>, IFormattable
- Implements
- Inherited Members
- Extension Methods
Constructors
Matrix3x3(float)
Initializes a new instance of the Matrix3x3 struct.
public Matrix3x3(float value)
Parameters
valuefloatThe value that will be assigned to all components.
Matrix3x3(float, float, float, float, float, float, float, float, float)
Initializes a new instance of the Matrix3x3 struct.
public Matrix3x3(float M11, float M12, float M13, float M21, float M22, float M23, float M31, float M32, float M33)
Parameters
M11floatThe value to assign at row 1 column 1 of the Matrix3x3.
M12floatThe value to assign at row 1 column 2 of the Matrix3x3.
M13floatThe value to assign at row 1 column 3 of the Matrix3x3.
M21floatThe value to assign at row 2 column 1 of the Matrix3x3.
M22floatThe value to assign at row 2 column 2 of the Matrix3x3.
M23floatThe value to assign at row 2 column 3 of the Matrix3x3.
M31floatThe value to assign at row 3 column 1 of the Matrix3x3.
M32floatThe value to assign at row 3 column 2 of the Matrix3x3.
M33floatThe value to assign at row 3 column 3 of the Matrix3x3.
Matrix3x3(float[])
Initializes a new instance of the Matrix3x3 struct.
public Matrix3x3(float[] values)
Parameters
valuesfloat[]The values to assign to the components of the Matrix3x3. This must be an array with sixteen elements.
Exceptions
- ArgumentNullException
Thrown when
valuesisnull.- ArgumentOutOfRangeException
Thrown when
valuescontains more or less than sixteen elements.
Fields
Identity
The identity Matrix3x3.
public static readonly Matrix3x3 Identity
Field Value
M11
Value at row 1 column 1 of the Matrix3x3.
public float M11
Field Value
M12
Value at row 1 column 2 of the Matrix3x3.
public float M12
Field Value
M13
Value at row 1 column 3 of the Matrix3x3.
public float M13
Field Value
M21
Value at row 2 column 1 of the Matrix3x3.
public float M21
Field Value
M22
Value at row 2 column 2 of the Matrix3x3.
public float M22
Field Value
M23
Value at row 2 column 3 of the Matrix3x3.
public float M23
Field Value
M31
Value at row 3 column 1 of the Matrix3x3.
public float M31
Field Value
M32
Value at row 3 column 2 of the Matrix3x3.
public float M32
Field Value
M33
Value at row 3 column 3 of the Matrix3x3.
public float M33
Field Value
SizeInBytes
The size of the Matrix3x3 type, in bytes.
public static readonly int SizeInBytes
Field Value
Zero
A Matrix3x3 with all of its components set to zero.
public static readonly Matrix3x3 Zero
Field Value
Properties
Column1
Gets or sets the first column in the Matrix3x3; that is M11, M21, M31
public Vector3 Column1 { readonly get; set; }
Property Value
Column2
Gets or sets the second column in the Matrix3x3; that is M12, M22, M32
public Vector3 Column2 { readonly get; set; }
Property Value
Column3
Gets or sets the third column in the Matrix3x3; that is M13, M23, M33
public Vector3 Column3 { readonly get; set; }
Property Value
IsIdentity
Gets a value indicating whether this instance is an identity Matrix3x3.
public readonly bool IsIdentity { get; }
Property Value
- bool
trueif this instance is an identity Matrix3x3; otherwise,false.
this[int]
Gets or sets the component at the specified index.
public float this[int index] { readonly get; set; }
Parameters
indexintThe zero-based index of the component to access.
Property Value
- float
The value of the Matrix3x3 component, depending on the index.
Exceptions
- ArgumentOutOfRangeException
Thrown when the
indexis out of the range [0, 15].
this[int, int]
Gets or sets the component at the specified index.
public float this[int row, int column] { readonly get; set; }
Parameters
Property Value
- float
The value of the Matrix3x3 component, depending on the index.
Exceptions
- ArgumentOutOfRangeException
Thrown when the
roworcolumnis out of the range [0, 3].
Row1
Gets or sets the first row in the Matrix3x3; that is M11, M12, M13
public Vector3 Row1 { readonly get; set; }
Property Value
Row2
Gets or sets the second row in the Matrix3x3; that is M21, M22, M23
public Vector3 Row2 { readonly get; set; }
Property Value
Row3
Gets or sets the third row in the Matrix3x3; that is M31, M32, M33
public Vector3 Row3 { readonly get; set; }
Property Value
ScaleVector
Gets or sets the scale of the Matrix3x3; that is M11, M22, and M33.
public Vector3 ScaleVector { readonly get; set; }
Property Value
Methods
Add(Matrix3x3, Matrix3x3)
Determines the sum of two matrices.
public static Matrix3x3 Add(Matrix3x3 left, Matrix3x3 right)
Parameters
Returns
- Matrix3x3
The sum of the two matrices.
Add(ref Matrix3x3, ref Matrix3x3, out Matrix3x3)
Determines the sum of two matrices.
public static void Add(ref Matrix3x3 left, ref Matrix3x3 right, out Matrix3x3 result)
Parameters
leftMatrix3x3The first Matrix3x3 to add.
rightMatrix3x3The second Matrix3x3 to add.
resultMatrix3x3When the method completes, contains the sum of the two matrices.
BillboardLH(Vector3, Vector3, Vector3, Vector3)
Creates a left-handed spherical billboard that rotates around a specified object position.
public static Matrix3x3 BillboardLH(Vector3 objectPosition, Vector3 cameraPosition, Vector3 cameraUpVector, Vector3 cameraForwardVector)
Parameters
objectPositionVector3The position of the object around which the billboard will rotate.
cameraPositionVector3The position of the camera.
cameraUpVectorVector3The up vector of the camera.
cameraForwardVectorVector3The forward vector of the camera.
Returns
- Matrix3x3
The created billboard Matrix3x3.
BillboardLH(ref Vector3, ref Vector3, ref Vector3, ref Vector3, out Matrix3x3)
Creates a left-handed spherical billboard that rotates around a specified object position.
public static void BillboardLH(ref Vector3 objectPosition, ref Vector3 cameraPosition, ref Vector3 cameraUpVector, ref Vector3 cameraForwardVector, out Matrix3x3 result)
Parameters
objectPositionVector3The position of the object around which the billboard will rotate.
cameraPositionVector3The position of the camera.
cameraUpVectorVector3The up vector of the camera.
cameraForwardVectorVector3The forward vector of the camera.
resultMatrix3x3When the method completes, contains the created billboard Matrix3x3.
BillboardRH(Vector3, Vector3, Vector3, Vector3)
Creates a right-handed spherical billboard that rotates around a specified object position.
public static Matrix3x3 BillboardRH(Vector3 objectPosition, Vector3 cameraPosition, Vector3 cameraUpVector, Vector3 cameraForwardVector)
Parameters
objectPositionVector3The position of the object around which the billboard will rotate.
cameraPositionVector3The position of the camera.
cameraUpVectorVector3The up vector of the camera.
cameraForwardVectorVector3The forward vector of the camera.
Returns
- Matrix3x3
The created billboard Matrix3x3.
BillboardRH(ref Vector3, ref Vector3, ref Vector3, ref Vector3, out Matrix3x3)
Creates a right-handed spherical billboard that rotates around a specified object position.
public static void BillboardRH(ref Vector3 objectPosition, ref Vector3 cameraPosition, ref Vector3 cameraUpVector, ref Vector3 cameraForwardVector, out Matrix3x3 result)
Parameters
objectPositionVector3The position of the object around which the billboard will rotate.
cameraPositionVector3The position of the camera.
cameraUpVectorVector3The up vector of the camera.
cameraForwardVectorVector3The forward vector of the camera.
resultMatrix3x3When the method completes, contains the created billboard Matrix3x3.
Decompose(out Vector3, out Quaternion)
Decomposes a Matrix3x3 into a scale, rotation, and translation.
public readonly bool Decompose(out Vector3 scale, out Quaternion rotation)
Parameters
scaleVector3When the method completes, contains the scaling component of the decomposed Matrix3x3.
rotationQuaternionWhen the method completes, contains the rotation component of the decomposed Matrix3x3.
Returns
Remarks
This method is designed to decompose an SRT transformation Matrix3x3 only.
DecomposeLQ(out Matrix3x3, out Matrix3x3)
Decomposes a Matrix3x3 into a lower triangular Matrix3x3 L and an orthonormalized Matrix3x3 Q.
public void DecomposeLQ(out Matrix3x3 L, out Matrix3x3 Q)
Parameters
LMatrix3x3When the method completes, contains the lower triangular Matrix3x3 of the decomposition.
QMatrix3x3When the method completes, contains the orthonormalized Matrix3x3 of the decomposition.
DecomposeQR(out Matrix3x3, out Matrix3x3)
Decomposes a Matrix3x3 into an orthonormalized Matrix3x3 Q and a right triangular Matrix3x3 R.
public readonly void DecomposeQR(out Matrix3x3 Q, out Matrix3x3 R)
Parameters
QMatrix3x3When the method completes, contains the orthonormalized Matrix3x3 of the decomposition.
RMatrix3x3When the method completes, contains the right triangular Matrix3x3 of the decomposition.
DecomposeUniformScale(out float, out Quaternion)
Decomposes a uniform scale matrix into a scale, rotation, and translation. A uniform scale matrix has the same scale in every axis.
public readonly bool DecomposeUniformScale(out float scale, out Quaternion rotation)
Parameters
scalefloatWhen the method completes, contains the scaling component of the decomposed matrix.
rotationQuaternionWhen the method completes, contains the rotation component of the decomposed matrix.
Returns
Remarks
This method is designed to decompose only an SRT transformation matrix that has the same scale in every axis.
Determinant()
Calculates the determinant of the Matrix3x3.
public readonly float Determinant()
Returns
- float
The determinant of the Matrix3x3.
Divide(Matrix3x3, Matrix3x3)
Determines the quotient of two matrices.
public static Matrix3x3 Divide(Matrix3x3 left, Matrix3x3 right)
Parameters
Returns
- Matrix3x3
The quotient of the two matrices.
Divide(Matrix3x3, float)
Scales a Matrix3x3 by the given value.
public static Matrix3x3 Divide(Matrix3x3 left, float right)
Parameters
Returns
- Matrix3x3
The scaled Matrix3x3.
Divide(ref Matrix3x3, ref Matrix3x3, out Matrix3x3)
Determines the quotient of two matrices.
public static void Divide(ref Matrix3x3 left, ref Matrix3x3 right, out Matrix3x3 result)
Parameters
leftMatrix3x3The first Matrix3x3 to divide.
rightMatrix3x3The second Matrix3x3 to divide.
resultMatrix3x3When the method completes, contains the quotient of the two matrices.
Divide(ref Matrix3x3, float, out Matrix3x3)
Scales a Matrix3x3 by the given value.
public static void Divide(ref Matrix3x3 left, float right, out Matrix3x3 result)
Parameters
leftMatrix3x3The Matrix3x3 to scale.
rightfloatThe amount by which to scale.
resultMatrix3x3When the method completes, contains the scaled Matrix3x3.
Equals(Matrix3x3)
Determines whether the specified Matrix3x3 is equal to this instance.
public readonly bool Equals(Matrix3x3 other)
Parameters
Returns
Equals(ref Matrix3x3)
Determines whether the specified Matrix3x3 is equal to this instance.
public readonly bool Equals(ref Matrix3x3 other)
Parameters
Returns
Equals(ref Matrix3x3, ref Matrix3x3)
Determines whether the specified Matrix3x3 are equal.
public static bool Equals(ref Matrix3x3 a, ref Matrix3x3 b)
Parameters
Returns
Equals(object?)
Determines whether the specified object is equal to this instance.
public override readonly bool Equals(object? value)
Parameters
Returns
ExchangeColumns(int, int)
Exchanges two columns in the Matrix3x3.
public void ExchangeColumns(int firstColumn, int secondColumn)
Parameters
firstColumnintThe first column to exchange. This is an index of the column starting at zero.
secondColumnintThe second column to exchange. This is an index of the column starting at zero.
ExchangeRows(int, int)
Exchanges two rows in the Matrix3x3.
public void ExchangeRows(int firstRow, int secondRow)
Parameters
firstRowintThe first row to exchange. This is an index of the row starting at zero.
secondRowintThe second row to exchange. This is an index of the row starting at zero.
Exponent(Matrix3x3, int)
Performs the exponential operation on a Matrix3x3.
public static Matrix3x3 Exponent(Matrix3x3 value, int exponent)
Parameters
valueMatrix3x3The Matrix3x3 to perform the operation on.
exponentintThe exponent to raise the Matrix3x3 to.
Returns
- Matrix3x3
The exponential Matrix3x3.
Exceptions
- ArgumentOutOfRangeException
Thrown when the
exponentis negative.
Exponent(ref Matrix3x3, int, out Matrix3x3)
Performs the exponential operation on a Matrix3x3.
public static void Exponent(ref Matrix3x3 value, int exponent, out Matrix3x3 result)
Parameters
valueMatrix3x3The Matrix3x3 to perform the operation on.
exponentintThe exponent to raise the Matrix3x3 to.
resultMatrix3x3When the method completes, contains the exponential Matrix3x3.
Exceptions
- ArgumentOutOfRangeException
Thrown when the
exponentis negative.
GetHashCode()
Returns a hash code for this instance.
public override readonly int GetHashCode()
Returns
- int
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Invert()
Inverts the Matrix3x3.
public void Invert()
Invert(Matrix3x3)
Calculates the inverse of the specified Matrix3x3.
public static Matrix3x3 Invert(Matrix3x3 value)
Parameters
valueMatrix3x3The Matrix3x3 whose inverse is to be calculated.
Returns
- Matrix3x3
The inverse of the specified Matrix3x3.
Invert(ref Matrix3x3, out Matrix3x3)
Calculates the inverse of the specified Matrix3x3.
public static void Invert(ref Matrix3x3 value, out Matrix3x3 result)
Parameters
valueMatrix3x3The Matrix3x3 whose inverse is to be calculated.
resultMatrix3x3When the method completes, contains the inverse of the specified Matrix3x3.
Lerp(Matrix3x3, Matrix3x3, float)
Performs a linear interpolation between two matrices.
public static Matrix3x3 Lerp(Matrix3x3 start, Matrix3x3 end, float amount)
Parameters
startMatrix3x3Start Matrix3x3.
endMatrix3x3End Matrix3x3.
amountfloatValue between 0 and 1 indicating the weight of
end.
Returns
- Matrix3x3
The linear interpolation of the two matrices.
Remarks
Passing amount a value of 0 will cause start to be returned; a value of 1 will cause end to be returned.
Lerp(ref Matrix3x3, ref Matrix3x3, float, out Matrix3x3)
Performs a linear interpolation between two matrices.
public static void Lerp(ref Matrix3x3 start, ref Matrix3x3 end, float amount, out Matrix3x3 result)
Parameters
startMatrix3x3Start Matrix3x3.
endMatrix3x3End Matrix3x3.
amountfloatValue between 0 and 1 indicating the weight of
end.resultMatrix3x3When the method completes, contains the linear interpolation of the two matrices.
Remarks
Passing amount a value of 0 will cause start to be returned; a value of 1 will cause end to be returned.
LookAtLH(Vector3, Vector3, Vector3)
Creates a left-handed, look-at Matrix3x3.
public static Matrix3x3 LookAtLH(Vector3 eye, Vector3 target, Vector3 up)
Parameters
eyeVector3The position of the viewer's eye.
targetVector3The camera look-at target.
upVector3The camera's up vector.
Returns
- Matrix3x3
The created look-at Matrix3x3.
LookAtLH(ref Vector3, ref Vector3, ref Vector3, out Matrix3x3)
Creates a left-handed, look-at Matrix3x3.
public static void LookAtLH(ref Vector3 eye, ref Vector3 target, ref Vector3 up, out Matrix3x3 result)
Parameters
eyeVector3The position of the viewer's eye.
targetVector3The camera look-at target.
upVector3The camera's up vector.
resultMatrix3x3When the method completes, contains the created look-at Matrix3x3.
LookAtRH(Vector3, Vector3, Vector3)
Creates a right-handed, look-at Matrix3x3.
public static Matrix3x3 LookAtRH(Vector3 eye, Vector3 target, Vector3 up)
Parameters
eyeVector3The position of the viewer's eye.
targetVector3The camera look-at target.
upVector3The camera's up vector.
Returns
- Matrix3x3
The created look-at Matrix3x3.
LookAtRH(ref Vector3, ref Vector3, ref Vector3, out Matrix3x3)
Creates a right-handed, look-at Matrix3x3.
public static void LookAtRH(ref Vector3 eye, ref Vector3 target, ref Vector3 up, out Matrix3x3 result)
Parameters
eyeVector3The position of the viewer's eye.
targetVector3The camera look-at target.
upVector3The camera's up vector.
resultMatrix3x3When the method completes, contains the created look-at Matrix3x3.
LowerTriangularForm(Matrix3x3)
Brings the Matrix3x3 into lower triangular form using elementary row operations.
public static Matrix3x3 LowerTriangularForm(Matrix3x3 value)
Parameters
valueMatrix3x3The Matrix3x3 to put into lower triangular form.
Returns
- Matrix3x3
The lower triangular Matrix3x3.
Remarks
If the Matrix3x3 is not invertible (i.e. its determinant is zero) than the result of this method may produce Single.Nan and Single.Inf values. When the Matrix3x3 represents a system of linear equations, than this often means that either no solution exists or an infinite number of solutions exist.
LowerTriangularForm(ref Matrix3x3, out Matrix3x3)
Brings the Matrix3x3 into lower triangular form using elementary row operations.
public static void LowerTriangularForm(ref Matrix3x3 value, out Matrix3x3 result)
Parameters
valueMatrix3x3The Matrix3x3 to put into lower triangular form.
resultMatrix3x3When the method completes, contains the lower triangular Matrix3x3.
Remarks
If the Matrix3x3 is not invertible (i.e. its determinant is zero) than the result of this method may produce Single.Nan and Single.Inf values. When the Matrix3x3 represents a system of linear equations, than this often means that either no solution exists or an infinite number of solutions exist.
Multiply(Matrix3x3, Matrix3x3)
Determines the product of two matrices.
public static Matrix3x3 Multiply(Matrix3x3 left, Matrix3x3 right)
Parameters
Returns
- Matrix3x3
The product of the two matrices.
Multiply(Matrix3x3, float)
Scales a Matrix3x3 by the given value.
public static Matrix3x3 Multiply(Matrix3x3 left, float right)
Parameters
Returns
- Matrix3x3
The scaled Matrix3x3.
Multiply(ref Matrix3x3, ref Matrix3x3, out Matrix3x3)
Determines the product of two matrices.
public static void Multiply(ref Matrix3x3 left, ref Matrix3x3 right, out Matrix3x3 result)
Parameters
leftMatrix3x3The first Matrix3x3 to multiply.
rightMatrix3x3The second Matrix3x3 to multiply.
resultMatrix3x3The product of the two matrices.
Multiply(ref Matrix3x3, float, out Matrix3x3)
Scales a Matrix3x3 by the given value.
public static void Multiply(ref Matrix3x3 left, float right, out Matrix3x3 result)
Parameters
leftMatrix3x3The Matrix3x3 to scale.
rightfloatThe amount by which to scale.
resultMatrix3x3When the method completes, contains the scaled Matrix3x3.
Negate(Matrix3x3)
Negates a Matrix3x3.
public static Matrix3x3 Negate(Matrix3x3 value)
Parameters
valueMatrix3x3The Matrix3x3 to be negated.
Returns
- Matrix3x3
The negated Matrix3x3.
Negate(ref Matrix3x3, out Matrix3x3)
Negates a Matrix3x3.
public static void Negate(ref Matrix3x3 value, out Matrix3x3 result)
Parameters
valueMatrix3x3The Matrix3x3 to be negated.
resultMatrix3x3When the method completes, contains the negated Matrix3x3.
Orthogonalize()
Orthogonalizes the specified Matrix3x3.
public void Orthogonalize()
Remarks
Orthogonalization is the process of making all rows orthogonal to each other. This means that any given row in the Matrix3x3 will be orthogonal to any other given row in the Matrix3x3.
Because this method uses the modified Gram-Schmidt process, the resulting Matrix3x3 tends to be numerically unstable. The numeric stability decreases according to the rows so that the first row is the most stable and the last row is the least stable.
This operation is performed on the rows of the Matrix3x3 rather than the columns. If you wish for this operation to be performed on the columns, first transpose the input and than transpose the output.
Orthogonalize(Matrix3x3)
Orthogonalizes the specified Matrix3x3.
public static Matrix3x3 Orthogonalize(Matrix3x3 value)
Parameters
valueMatrix3x3The Matrix3x3 to orthogonalize.
Returns
- Matrix3x3
The orthogonalized Matrix3x3.
Remarks
Orthogonalization is the process of making all rows orthogonal to each other. This means that any given row in the Matrix3x3 will be orthogonal to any other given row in the Matrix3x3.
Because this method uses the modified Gram-Schmidt process, the resulting Matrix3x3 tends to be numerically unstable. The numeric stability decreases according to the rows so that the first row is the most stable and the last row is the least stable.
This operation is performed on the rows of the Matrix3x3 rather than the columns. If you wish for this operation to be performed on the columns, first transpose the input and than transpose the output.
Orthogonalize(ref Matrix3x3, out Matrix3x3)
Orthogonalizes the specified Matrix3x3.
public static void Orthogonalize(ref Matrix3x3 value, out Matrix3x3 result)
Parameters
valueMatrix3x3The Matrix3x3 to orthogonalize.
resultMatrix3x3When the method completes, contains the orthogonalized Matrix3x3.
Remarks
Orthogonalization is the process of making all rows orthogonal to each other. This means that any given row in the Matrix3x3 will be orthogonal to any other given row in the Matrix3x3.
Because this method uses the modified Gram-Schmidt process, the resulting Matrix3x3 tends to be numerically unstable. The numeric stability decreases according to the rows so that the first row is the most stable and the last row is the least stable.
This operation is performed on the rows of the Matrix3x3 rather than the columns. If you wish for this operation to be performed on the columns, first transpose the input and than transpose the output.
Orthonormalize()
Orthonormalizes the specified Matrix3x3.
public void Orthonormalize()
Remarks
Orthonormalization is the process of making all rows and columns orthogonal to each other and making all rows and columns of unit length. This means that any given row will be orthogonal to any other given row and any given column will be orthogonal to any other given column. Any given row will not be orthogonal to any given column. Every row and every column will be of unit length.
Because this method uses the modified Gram-Schmidt process, the resulting Matrix3x3 tends to be numerically unstable. The numeric stability decreases according to the rows so that the first row is the most stable and the last row is the least stable.
This operation is performed on the rows of the Matrix3x3 rather than the columns. If you wish for this operation to be performed on the columns, first transpose the input and than transpose the output.
Orthonormalize(Matrix3x3)
Orthonormalizes the specified Matrix3x3.
public static Matrix3x3 Orthonormalize(Matrix3x3 value)
Parameters
valueMatrix3x3The Matrix3x3 to orthonormalize.
Returns
- Matrix3x3
The orthonormalized Matrix3x3.
Remarks
Orthonormalization is the process of making all rows and columns orthogonal to each other and making all rows and columns of unit length. This means that any given row will be orthogonal to any other given row and any given column will be orthogonal to any other given column. Any given row will not be orthogonal to any given column. Every row and every column will be of unit length.
Because this method uses the modified Gram-Schmidt process, the resulting Matrix3x3 tends to be numerically unstable. The numeric stability decreases according to the rows so that the first row is the most stable and the last row is the least stable.
This operation is performed on the rows of the Matrix3x3 rather than the columns. If you wish for this operation to be performed on the columns, first transpose the input and than transpose the output.
Orthonormalize(ref Matrix3x3, out Matrix3x3)
Orthonormalizes the specified Matrix3x3.
public static void Orthonormalize(ref Matrix3x3 value, out Matrix3x3 result)
Parameters
valueMatrix3x3The Matrix3x3 to orthonormalize.
resultMatrix3x3When the method completes, contains the orthonormalized Matrix3x3.
Remarks
Orthonormalization is the process of making all rows and columns orthogonal to each other and making all rows and columns of unit length. This means that any given row will be orthogonal to any other given row and any given column will be orthogonal to any other given column. Any given row will not be orthogonal to any given column. Every row and every column will be of unit length.
Because this method uses the modified Gram-Schmidt process, the resulting Matrix3x3 tends to be numerically unstable. The numeric stability decreases according to the rows so that the first row is the most stable and the last row is the least stable.
This operation is performed on the rows of the Matrix3x3 rather than the columns. If you wish for this operation to be performed on the columns, first transpose the input and than transpose the output.
RotationAxis(Vector3, float)
Creates a Matrix3x3 that rotates around an arbitrary axis.
public static Matrix3x3 RotationAxis(Vector3 axis, float angle)
Parameters
axisVector3The axis around which to rotate. This parameter is assumed to be normalized.
anglefloatAngle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.
Returns
- Matrix3x3
The created rotation Matrix3x3.
RotationAxis(ref Vector3, float, out Matrix3x3)
Creates a Matrix3x3 that rotates around an arbitrary axis.
public static void RotationAxis(ref Vector3 axis, float angle, out Matrix3x3 result)
Parameters
axisVector3The axis around which to rotate. This parameter is assumed to be normalized.
anglefloatAngle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.
resultMatrix3x3When the method completes, contains the created rotation Matrix3x3.
RotationQuaternion(Quaternion)
Creates a rotation Matrix3x3 from a quaternion.
public static Matrix3x3 RotationQuaternion(Quaternion rotation)
Parameters
rotationQuaternionThe quaternion to use to build the Matrix3x3.
Returns
- Matrix3x3
The created rotation Matrix3x3.
RotationQuaternion(ref Quaternion, out Matrix3x3)
Creates a rotation Matrix3x3 from a quaternion.
public static void RotationQuaternion(ref Quaternion rotation, out Matrix3x3 result)
Parameters
rotationQuaternionThe quaternion to use to build the Matrix3x3.
resultMatrix3x3The created rotation Matrix3x3.
RotationX(float)
Creates a Matrix3x3 that rotates around the x-axis.
public static Matrix3x3 RotationX(float angle)
Parameters
anglefloatAngle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.
Returns
- Matrix3x3
The created rotation Matrix3x3.
RotationX(float, out Matrix3x3)
Creates a Matrix3x3 that rotates around the x-axis.
public static void RotationX(float angle, out Matrix3x3 result)
Parameters
anglefloatAngle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.
resultMatrix3x3When the method completes, contains the created rotation Matrix3x3.
RotationY(float)
Creates a Matrix3x3 that rotates around the y-axis.
public static Matrix3x3 RotationY(float angle)
Parameters
anglefloatAngle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.
Returns
- Matrix3x3
The created rotation Matrix3x3.
RotationY(float, out Matrix3x3)
Creates a Matrix3x3 that rotates around the y-axis.
public static void RotationY(float angle, out Matrix3x3 result)
Parameters
anglefloatAngle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.
resultMatrix3x3When the method completes, contains the created rotation Matrix3x3.
RotationYawPitchRoll(float, float, float)
Creates a rotation Matrix3x3 with a specified yaw, pitch, and roll.
public static Matrix3x3 RotationYawPitchRoll(float yaw, float pitch, float roll)
Parameters
yawfloatYaw around the y-axis, in radians.
pitchfloatPitch around the x-axis, in radians.
rollfloatRoll around the z-axis, in radians.
Returns
- Matrix3x3
The created rotation Matrix3x3.
RotationYawPitchRoll(float, float, float, out Matrix3x3)
Creates a rotation Matrix3x3 with a specified yaw, pitch, and roll.
public static void RotationYawPitchRoll(float yaw, float pitch, float roll, out Matrix3x3 result)
Parameters
yawfloatYaw around the y-axis, in radians.
pitchfloatPitch around the x-axis, in radians.
rollfloatRoll around the z-axis, in radians.
resultMatrix3x3When the method completes, contains the created rotation Matrix3x3.
RotationZ(float)
Creates a Matrix3x3 that rotates around the z-axis.
public static Matrix3x3 RotationZ(float angle)
Parameters
anglefloatAngle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.
Returns
- Matrix3x3
The created rotation Matrix3x3.
RotationZ(float, out Matrix3x3)
Creates a Matrix3x3 that rotates around the z-axis.
public static void RotationZ(float angle, out Matrix3x3 result)
Parameters
anglefloatAngle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.
resultMatrix3x3When the method completes, contains the created rotation Matrix3x3.
RowEchelonForm(Matrix3x3)
Brings the Matrix3x3 into row echelon form using elementary row operations;
public static Matrix3x3 RowEchelonForm(Matrix3x3 value)
Parameters
valueMatrix3x3The Matrix3x3 to put into row echelon form.
Returns
- Matrix3x3
When the method completes, contains the row echelon form of the Matrix3x3.
RowEchelonForm(ref Matrix3x3, out Matrix3x3)
Brings the Matrix3x3 into row echelon form using elementary row operations;
public static void RowEchelonForm(ref Matrix3x3 value, out Matrix3x3 result)
Parameters
valueMatrix3x3The Matrix3x3 to put into row echelon form.
resultMatrix3x3When the method completes, contains the row echelon form of the Matrix3x3.
Scaling(Vector3)
Creates a Matrix3x3 that scales along the x-axis, y-axis, and y-axis.
public static Matrix3x3 Scaling(Vector3 scale)
Parameters
scaleVector3Scaling factor for all three axes.
Returns
- Matrix3x3
The created scaling Matrix3x3.
Scaling(ref Vector3, out Matrix3x3)
Creates a Matrix3x3 that scales along the x-axis, y-axis, and y-axis.
public static void Scaling(ref Vector3 scale, out Matrix3x3 result)
Parameters
scaleVector3Scaling factor for all three axes.
resultMatrix3x3When the method completes, contains the created scaling Matrix3x3.
Scaling(float)
Creates a Matrix3x3 that uniformly scales along all three axis.
public static Matrix3x3 Scaling(float scale)
Parameters
scalefloatThe uniform scale that is applied along all axis.
Returns
- Matrix3x3
The created scaling Matrix3x3.
Scaling(float, out Matrix3x3)
Creates a Matrix3x3 that uniformly scales along all three axis.
public static void Scaling(float scale, out Matrix3x3 result)
Parameters
scalefloatThe uniform scale that is applied along all axis.
resultMatrix3x3When the method completes, contains the created scaling Matrix3x3.
Scaling(float, float, float)
Creates a Matrix3x3 that scales along the x-axis, y-axis, and y-axis.
public static Matrix3x3 Scaling(float x, float y, float z)
Parameters
xfloatScaling factor that is applied along the x-axis.
yfloatScaling factor that is applied along the y-axis.
zfloatScaling factor that is applied along the z-axis.
Returns
- Matrix3x3
The created scaling Matrix3x3.
Scaling(float, float, float, out Matrix3x3)
Creates a Matrix3x3 that scales along the x-axis, y-axis, and y-axis.
public static void Scaling(float x, float y, float z, out Matrix3x3 result)
Parameters
xfloatScaling factor that is applied along the x-axis.
yfloatScaling factor that is applied along the y-axis.
zfloatScaling factor that is applied along the z-axis.
resultMatrix3x3When the method completes, contains the created scaling Matrix3x3.
SmoothStep(Matrix3x3, Matrix3x3, float)
Performs a cubic interpolation between two matrices.
public static Matrix3x3 SmoothStep(Matrix3x3 start, Matrix3x3 end, float amount)
Parameters
startMatrix3x3Start Matrix3x3.
endMatrix3x3End Matrix3x3.
amountfloatValue between 0 and 1 indicating the weight of
end.
Returns
- Matrix3x3
The cubic interpolation of the two matrices.
SmoothStep(ref Matrix3x3, ref Matrix3x3, float, out Matrix3x3)
Performs a cubic interpolation between two matrices.
public static void SmoothStep(ref Matrix3x3 start, ref Matrix3x3 end, float amount, out Matrix3x3 result)
Parameters
startMatrix3x3Start Matrix3x3.
endMatrix3x3End Matrix3x3.
amountfloatValue between 0 and 1 indicating the weight of
end.resultMatrix3x3When the method completes, contains the cubic interpolation of the two matrices.
Subtract(Matrix3x3, Matrix3x3)
Determines the difference between two matrices.
public static Matrix3x3 Subtract(Matrix3x3 left, Matrix3x3 right)
Parameters
Returns
- Matrix3x3
The difference between the two matrices.
Subtract(ref Matrix3x3, ref Matrix3x3, out Matrix3x3)
Determines the difference between two matrices.
public static void Subtract(ref Matrix3x3 left, ref Matrix3x3 right, out Matrix3x3 result)
Parameters
leftMatrix3x3The first Matrix3x3 to subtract.
rightMatrix3x3The second Matrix3x3 to subtract.
resultMatrix3x3When the method completes, contains the difference between the two matrices.
ToArray()
Creates an array containing the elements of the Matrix3x3.
public readonly float[] ToArray()
Returns
- float[]
A 9-element array containing the components of the Matrix3x3.
ToMatrix()
public readonly Matrix4x4 ToMatrix()
Returns
ToString()
Returns a string that represents this instance.
public override readonly string ToString()
Returns
ToString(IFormatProvider)
Returns a string that represents this instance.
public readonly string ToString(IFormatProvider formatProvider)
Parameters
formatProviderIFormatProviderThe format provider.
Returns
ToString(string)
Returns a string that represents this instance.
public readonly string ToString(string format)
Parameters
formatstringThe format.
Returns
ToString(string?, IFormatProvider?)
Returns a string that represents this instance.
public readonly string ToString(string? format, IFormatProvider? formatProvider)
Parameters
formatstringThe format.
formatProviderIFormatProviderThe format provider.
Returns
Transpose()
Transposes the Matrix3x3.
public void Transpose()
Transpose(Matrix3x3)
Calculates the transpose of the specified Matrix3x3.
public static Matrix3x3 Transpose(Matrix3x3 value)
Parameters
valueMatrix3x3The Matrix3x3 whose transpose is to be calculated.
Returns
- Matrix3x3
The transpose of the specified Matrix3x3.
Transpose(ref Matrix3x3, out Matrix3x3)
Calculates the transpose of the specified Matrix3x3.
public static void Transpose(ref Matrix3x3 value, out Matrix3x3 result)
Parameters
valueMatrix3x3The Matrix3x3 whose transpose is to be calculated.
resultMatrix3x3When the method completes, contains the transpose of the specified Matrix3x3.
TransposeByRef(ref Matrix3x3, ref Matrix3x3)
Calculates the transpose of the specified Matrix3x3.
public static void TransposeByRef(ref Matrix3x3 value, ref Matrix3x3 result)
Parameters
valueMatrix3x3The Matrix3x3 whose transpose is to be calculated.
resultMatrix3x3When the method completes, contains the transpose of the specified Matrix3x3.
UpperTriangularForm(Matrix3x3)
Brings the Matrix3x3 into upper triangular form using elementary row operations.
public static Matrix3x3 UpperTriangularForm(Matrix3x3 value)
Parameters
valueMatrix3x3The Matrix3x3 to put into upper triangular form.
Returns
- Matrix3x3
The upper triangular Matrix3x3.
Remarks
If the Matrix3x3 is not invertible (i.e. its determinant is zero) than the result of this method may produce Single.Nan and Single.Inf values. When the Matrix3x3 represents a system of linear equations, than this often means that either no solution exists or an infinite number of solutions exist.
UpperTriangularForm(ref Matrix3x3, out Matrix3x3)
Brings the Matrix3x3 into upper triangular form using elementary row operations.
public static void UpperTriangularForm(ref Matrix3x3 value, out Matrix3x3 result)
Parameters
valueMatrix3x3The Matrix3x3 to put into upper triangular form.
resultMatrix3x3When the method completes, contains the upper triangular Matrix3x3.
Remarks
If the Matrix3x3 is not invertible (i.e. its determinant is zero) than the result of this method may produce Single.Nan and Single.Inf values. When the Matrix3x3 represents a system of linear equations, than this often means that either no solution exists or an infinite number of solutions exist.
Operators
operator +(Matrix3x3, Matrix3x3)
Adds two matrices.
public static Matrix3x3 operator +(Matrix3x3 left, Matrix3x3 right)
Parameters
Returns
- Matrix3x3
The sum of the two matrices.
operator /(Matrix3x3, Matrix3x3)
Divides two matrices.
public static Matrix3x3 operator /(Matrix3x3 left, Matrix3x3 right)
Parameters
Returns
- Matrix3x3
The quotient of the two matrices.
operator /(Matrix3x3, float)
Scales a Matrix3x3 by a given value.
public static Matrix3x3 operator /(Matrix3x3 left, float right)
Parameters
Returns
- Matrix3x3
The scaled Matrix3x3.
operator ==(Matrix3x3, Matrix3x3)
Tests for equality between two objects.
public static bool operator ==(Matrix3x3 left, Matrix3x3 right)
Parameters
Returns
- bool
trueiflefthas the same value asright; otherwise,false.
explicit operator Matrix4x4(Matrix3x3)
Convert the 3x3 Matrix to a 4x4 Matrix.
public static explicit operator Matrix4x4(Matrix3x3 Value)
Parameters
ValueMatrix3x3
Returns
- Matrix4x4
A 4x4 Matrix with zero translation and M44=1
explicit operator Matrix3x3(Matrix4x4)
Convert the 4x4 Matrix to a 3x3 Matrix.
public static explicit operator Matrix3x3(Matrix4x4 Value)
Parameters
ValueMatrix4x4
Returns
- Matrix3x3
A 3x3 Matrix
operator !=(Matrix3x3, Matrix3x3)
Tests for inequality between two objects.
public static bool operator !=(Matrix3x3 left, Matrix3x3 right)
Parameters
Returns
- bool
trueiflefthas a different value thanright; otherwise,false.
operator *(Matrix3x3, Matrix3x3)
Multiplies two matrices.
public static Matrix3x3 operator *(Matrix3x3 left, Matrix3x3 right)
Parameters
Returns
- Matrix3x3
The product of the two matrices.
operator *(Matrix3x3, float)
Scales a Matrix3x3 by a given value.
public static Matrix3x3 operator *(Matrix3x3 left, float right)
Parameters
Returns
- Matrix3x3
The scaled Matrix3x3.
operator *(float, Matrix3x3)
Scales a Matrix3x3 by a given value.
public static Matrix3x3 operator *(float left, Matrix3x3 right)
Parameters
Returns
- Matrix3x3
The scaled Matrix3x3.
operator -(Matrix3x3, Matrix3x3)
Subtracts two matrices.
public static Matrix3x3 operator -(Matrix3x3 left, Matrix3x3 right)
Parameters
Returns
- Matrix3x3
The difference between the two matrices.
operator -(Matrix3x3)
Negates a Matrix3x3.
public static Matrix3x3 operator -(Matrix3x3 value)
Parameters
valueMatrix3x3The Matrix3x3 to negate.
Returns
- Matrix3x3
The negated Matrix3x3.
operator +(Matrix3x3)
Assert a Matrix3x3 (return it unchanged).
public static Matrix3x3 operator +(Matrix3x3 value)
Parameters
valueMatrix3x3The Matrix3x3 to assert (unchanged).
Returns
- Matrix3x3
The asserted (unchanged) Matrix3x3.