Struct Matrix3x2
A structure encapsulating a 3x2 matrix.
Inherited Members
Namespace: System.Numerics
Assembly: System.Numerics.dll
Syntax
public struct Matrix3x2
Constructors
| Improve this Doc View SourceMatrix3x2(Double, Double, Double, Double, Double, Double)
Constructs a Matrix3x2 from the given components.
Declaration
public Matrix3x2(double m11, double m12, double m21, double m22, double m31, double m32)
Parameters
Type | Name | Description |
---|---|---|
Double | m11 | |
Double | m12 | |
Double | m21 | |
Double | m22 | |
Double | m31 | |
Double | m32 |
Fields
| Improve this Doc View SourceM11
The first element of the first row
Declaration
public double M11
Field Value
Type | Description |
---|---|
Double |
M12
The second element of the first row
Declaration
public double M12
Field Value
Type | Description |
---|---|
Double |
M21
The first element of the second row
Declaration
public double M21
Field Value
Type | Description |
---|---|
Double |
M22
The second element of the second row
Declaration
public double M22
Field Value
Type | Description |
---|---|
Double |
M31
The first element of the third row
Declaration
public double M31
Field Value
Type | Description |
---|---|
Double |
M32
The second element of the third row
Declaration
public double M32
Field Value
Type | Description |
---|---|
Double |
Properties
| Improve this Doc View SourceIdentity
Returns the multiplicative identity matrix.
Declaration
public static readonly Matrix3x2 Identity { get; }
Property Value
Type | Description |
---|---|
Matrix3x2 |
IsIdentity
Returns whether the matrix is the identity matrix.
Declaration
public readonly bool IsIdentity { get; }
Property Value
Type | Description |
---|---|
Boolean |
Translation
Gets or sets the translation component of this matrix.
Declaration
public Vector2 Translation { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
Methods
| Improve this Doc View SourceAdd(Matrix3x2, Matrix3x2)
Adds each matrix element in value1 with its corresponding element in value2.
Declaration
public static Matrix3x2 Add(Matrix3x2 value1, Matrix3x2 value2)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x2 | value1 | The first source matrix. |
Matrix3x2 | value2 | The second source matrix. |
Returns
Type | Description |
---|---|
Matrix3x2 | The matrix containing the summed values. |
CreateRotation(Double)
Creates a rotation matrix using the given rotation in radians.
Declaration
public static Matrix3x2 CreateRotation(double radians)
Parameters
Type | Name | Description |
---|---|---|
Double | radians | The amount of rotation, in radians. |
Returns
Type | Description |
---|---|
Matrix3x2 | A rotation matrix. |
CreateRotation(Double, Vector2)
Creates a rotation matrix using the given rotation in radians and a center point.
Declaration
public static Matrix3x2 CreateRotation(double radians, Vector2 centerPoint)
Parameters
Type | Name | Description |
---|---|---|
Double | radians | The amount of rotation, in radians. |
Vector2 | centerPoint | The center point. |
Returns
Type | Description |
---|---|
Matrix3x2 | A rotation matrix. |
CreateScale(Double)
Creates a scale matrix that scales uniformly with the given scale.
Declaration
public static Matrix3x2 CreateScale(double scale)
Parameters
Type | Name | Description |
---|---|---|
Double | scale | The uniform scale to use. |
Returns
Type | Description |
---|---|
Matrix3x2 | A scaling matrix. |
CreateScale(Double, Double)
Creates a scale matrix from the given X and Y components.
Declaration
public static Matrix3x2 CreateScale(double xScale, double yScale)
Parameters
Type | Name | Description |
---|---|---|
Double | xScale | Value to scale by on the X-axis. |
Double | yScale | Value to scale by on the Y-axis. |
Returns
Type | Description |
---|---|
Matrix3x2 | A scaling matrix. |
CreateScale(Double, Double, Vector2)
Creates a scale matrix that is offset by a given center point.
Declaration
public static Matrix3x2 CreateScale(double xScale, double yScale, Vector2 centerPoint)
Parameters
Type | Name | Description |
---|---|---|
Double | xScale | Value to scale by on the X-axis. |
Double | yScale | Value to scale by on the Y-axis. |
Vector2 | centerPoint | The center point. |
Returns
Type | Description |
---|---|
Matrix3x2 | A scaling matrix. |
CreateScale(Double, Vector2)
Creates a scale matrix that scales uniformly with the given scale with an offset from the given center.
Declaration
public static Matrix3x2 CreateScale(double scale, Vector2 centerPoint)
Parameters
Type | Name | Description |
---|---|---|
Double | scale | The uniform scale to use. |
Vector2 | centerPoint | The center offset. |
Returns
Type | Description |
---|---|
Matrix3x2 | A scaling matrix. |
CreateScale(Vector2)
Creates a scale matrix from the given vector scale.
Declaration
public static Matrix3x2 CreateScale(Vector2 scales)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | scales | The scale to use. |
Returns
Type | Description |
---|---|
Matrix3x2 | A scaling matrix. |
CreateScale(Vector2, Vector2)
Creates a scale matrix from the given vector scale with an offset from the given center point.
Declaration
public static Matrix3x2 CreateScale(Vector2 scales, Vector2 centerPoint)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | scales | The scale to use. |
Vector2 | centerPoint | The center offset. |
Returns
Type | Description |
---|---|
Matrix3x2 | A scaling matrix. |
CreateSkew(Double, Double)
Creates a skew matrix from the given angles in radians.
Declaration
public static Matrix3x2 CreateSkew(double radiansX, double radiansY)
Parameters
Type | Name | Description |
---|---|---|
Double | radiansX | The X angle, in radians. |
Double | radiansY | The Y angle, in radians. |
Returns
Type | Description |
---|---|
Matrix3x2 | A skew matrix. |
CreateSkew(Double, Double, Vector2)
Creates a skew matrix from the given angles in radians and a center point.
Declaration
public static Matrix3x2 CreateSkew(double radiansX, double radiansY, Vector2 centerPoint)
Parameters
Type | Name | Description |
---|---|---|
Double | radiansX | The X angle, in radians. |
Double | radiansY | The Y angle, in radians. |
Vector2 | centerPoint | The center point. |
Returns
Type | Description |
---|---|
Matrix3x2 | A skew matrix. |
CreateTranslation(Double, Double)
Creates a translation matrix from the given X and Y components.
Declaration
public static Matrix3x2 CreateTranslation(double xPosition, double yPosition)
Parameters
Type | Name | Description |
---|---|---|
Double | xPosition | The X position. |
Double | yPosition | The Y position. |
Returns
Type | Description |
---|---|
Matrix3x2 | A translation matrix. |
CreateTranslation(Vector2)
Creates a translation matrix from the given vector.
Declaration
public static Matrix3x2 CreateTranslation(Vector2 position)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | position | The translation position. |
Returns
Type | Description |
---|---|
Matrix3x2 | A translation matrix. |
Equals(Matrix3x2)
Returns a boolean indicating whether the matrix is equal to the other given matrix.
Declaration
public bool Equals(Matrix3x2 other)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x2 | other | The other matrix to test equality against. |
Returns
Type | Description |
---|---|
Boolean | True if this matrix is equal to other; False otherwise. |
Equals(Object)
Returns a boolean indicating whether the given Object is equal to this matrix instance.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The Object to compare against. |
Returns
Type | Description |
---|---|
Boolean | True if the Object is equal to this matrix; False otherwise. |
Overrides
| Improve this Doc View SourceGetDeterminant()
Calculates the determinant for this matrix. The determinant is calculated by expanding the matrix with a third column whose values are (0,0,1).
Declaration
public double GetDeterminant()
Returns
Type | Description |
---|---|
Double | The determinant. |
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | The hash code. |
Overrides
| Improve this Doc View SourceInvert(Matrix3x2, out Matrix3x2)
Attempts to invert the given matrix. If the operation succeeds, the inverted matrix is stored in the result parameter.
Declaration
public static bool Invert(Matrix3x2 matrix, out Matrix3x2 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x2 | matrix | The source matrix. |
Matrix3x2 | result | The output matrix. |
Returns
Type | Description |
---|---|
Boolean | True if the operation succeeded, False otherwise. |
Lerp(Matrix3x2, Matrix3x2, Double)
Linearly interpolates from matrix1 to matrix2, based on the third parameter.
Declaration
public static Matrix3x2 Lerp(Matrix3x2 matrix1, Matrix3x2 matrix2, double amount)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x2 | matrix1 | The first source matrix. |
Matrix3x2 | matrix2 | The second source matrix. |
Double | amount | The relative weighting of matrix2. |
Returns
Type | Description |
---|---|
Matrix3x2 | The interpolated matrix. |
Multiply(Matrix3x2, Double)
Scales all elements in a matrix by the given scalar factor.
Declaration
public static Matrix3x2 Multiply(Matrix3x2 value1, double value2)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x2 | value1 | The source matrix. |
Double | value2 | The scaling value to use. |
Returns
Type | Description |
---|---|
Matrix3x2 | The resulting matrix. |
Multiply(Matrix3x2, Matrix3x2)
Multiplies two matrices together and returns the resulting matrix.
Declaration
public static Matrix3x2 Multiply(Matrix3x2 value1, Matrix3x2 value2)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x2 | value1 | The first source matrix. |
Matrix3x2 | value2 | The second source matrix. |
Returns
Type | Description |
---|---|
Matrix3x2 | The product matrix. |
Negate(Matrix3x2)
Negates the given matrix by multiplying all values by -1.
Declaration
public static Matrix3x2 Negate(Matrix3x2 value)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x2 | value | The source matrix. |
Returns
Type | Description |
---|---|
Matrix3x2 | The negated matrix. |
Subtract(Matrix3x2, Matrix3x2)
Subtracts each matrix element in value2 from its corresponding element in value1.
Declaration
public static Matrix3x2 Subtract(Matrix3x2 value1, Matrix3x2 value2)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x2 | value1 | The first source matrix. |
Matrix3x2 | value2 | The second source matrix. |
Returns
Type | Description |
---|---|
Matrix3x2 | The matrix containing the resulting values. |
ToString()
Returns a String representing this matrix instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | The string representation. |
Overrides
Operators
| Improve this Doc View SourceAddition(Matrix3x2, Matrix3x2)
Adds each matrix element in value1 with its corresponding element in value2.
Declaration
public static Matrix3x2 operator +(Matrix3x2 value1, Matrix3x2 value2)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x2 | value1 | The first source matrix. |
Matrix3x2 | value2 | The second source matrix. |
Returns
Type | Description |
---|---|
Matrix3x2 | The matrix containing the summed values. |
Equality(Matrix3x2, Matrix3x2)
Returns a boolean indicating whether the given matrices are equal.
Declaration
public static bool operator ==(Matrix3x2 value1, Matrix3x2 value2)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x2 | value1 | The first source matrix. |
Matrix3x2 | value2 | The second source matrix. |
Returns
Type | Description |
---|---|
Boolean | True if the matrices are equal; False otherwise. |
Inequality(Matrix3x2, Matrix3x2)
Returns a boolean indicating whether the given matrices are not equal.
Declaration
public static bool operator !=(Matrix3x2 value1, Matrix3x2 value2)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x2 | value1 | The first source matrix. |
Matrix3x2 | value2 | The second source matrix. |
Returns
Type | Description |
---|---|
Boolean | True if the matrices are not equal; False if they are equal. |
Multiply(Matrix3x2, Double)
Scales all elements in a matrix by the given scalar factor.
Declaration
public static Matrix3x2 operator *(Matrix3x2 value1, double value2)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x2 | value1 | The source matrix. |
Double | value2 | The scaling value to use. |
Returns
Type | Description |
---|---|
Matrix3x2 | The resulting matrix. |
Multiply(Matrix3x2, Matrix3x2)
Multiplies two matrices together and returns the resulting matrix.
Declaration
public static Matrix3x2 operator *(Matrix3x2 value1, Matrix3x2 value2)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x2 | value1 | The first source matrix. |
Matrix3x2 | value2 | The second source matrix. |
Returns
Type | Description |
---|---|
Matrix3x2 | The product matrix. |
Subtraction(Matrix3x2, Matrix3x2)
Subtracts each matrix element in value2 from its corresponding element in value1.
Declaration
public static Matrix3x2 operator -(Matrix3x2 value1, Matrix3x2 value2)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x2 | value1 | The first source matrix. |
Matrix3x2 | value2 | The second source matrix. |
Returns
Type | Description |
---|---|
Matrix3x2 | The matrix containing the resulting values. |
UnaryNegation(Matrix3x2)
Negates the given matrix by multiplying all values by -1.
Declaration
public static Matrix3x2 operator -(Matrix3x2 value)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x2 | value | The source matrix. |
Returns
Type | Description |
---|---|
Matrix3x2 | The negated matrix. |