Struct Matrix4x2
Represents a 4x2 matrix.
Inherited Members
Namespace: OpenTK.Mathematics
Assembly: OpenTK.Mathematics.dll
Syntax
[Serializable]
public struct Matrix4x2 : IEquatable<Matrix4x2>, IFormattable
Constructors
Matrix4x2(Vector2, Vector2, Vector2, Vector2)
Initializes a new instance of the Matrix4x2 struct.
Declaration
public Matrix4x2(Vector2 row0, Vector2 row1, Vector2 row2, Vector2 row3)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | row0 | Top row of the matrix. |
Vector2 | row1 | Second row of the matrix. |
Vector2 | row2 | Third row of the matrix. |
Vector2 | row3 | Bottom row of the matrix. |
Matrix4x2(float, float, float, float, float, float, float, float)
Initializes a new instance of the Matrix4x2 struct.
Declaration
public Matrix4x2(float m00, float m01, float m10, float m11, float m20, float m21, float m30, float m31)
Parameters
Type | Name | Description |
---|---|---|
float | m00 | First item of the first row of the matrix. |
float | m01 | Second item of the first row of the matrix. |
float | m10 | First item of the second row of the matrix. |
float | m11 | Second item of the second row of the matrix. |
float | m20 | First item of the third row of the matrix. |
float | m21 | Second item of the third row of the matrix. |
float | m30 | First item of the fourth row of the matrix. |
float | m31 | Second item of the fourth row of the matrix. |
Fields
Row0
Top row of the matrix.
Declaration
public Vector2 Row0
Field Value
Type | Description |
---|---|
Vector2 |
Row1
Second row of the matrix.
Declaration
public Vector2 Row1
Field Value
Type | Description |
---|---|
Vector2 |
Row2
Third row of the matrix.
Declaration
public Vector2 Row2
Field Value
Type | Description |
---|---|
Vector2 |
Row3
Bottom row of the matrix.
Declaration
public Vector2 Row3
Field Value
Type | Description |
---|---|
Vector2 |
Zero
The zero matrix.
Declaration
public static readonly Matrix4x2 Zero
Field Value
Type | Description |
---|---|
Matrix4x2 |
Properties
Column0
Gets or sets the first column of this matrix.
Declaration
public Vector4 Column0 { get; set; }
Property Value
Type | Description |
---|---|
Vector4 |
Column1
Gets or sets the second column of this matrix.
Declaration
public Vector4 Column1 { get; set; }
Property Value
Type | Description |
---|---|
Vector4 |
Diagonal
Gets or sets the values along the main diagonal of the matrix.
Declaration
public Vector2 Diagonal { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
this[int, int]
Gets or sets the value at a specified row and column.
Declaration
public float this[int rowIndex, int columnIndex] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
int | rowIndex | The index of the row. |
int | columnIndex | The index of the column. |
Property Value
Type | Description |
---|---|
float | The element at the given row and column index. |
M11
Gets or sets the value at row 1, column 1 of this instance.
Declaration
public float M11 { get; set; }
Property Value
Type | Description |
---|---|
float |
M12
Gets or sets the value at row 1, column 2 of this instance.
Declaration
public float M12 { get; set; }
Property Value
Type | Description |
---|---|
float |
M21
Gets or sets the value at row 2, column 1 of this instance.
Declaration
public float M21 { get; set; }
Property Value
Type | Description |
---|---|
float |
M22
Gets or sets the value at row 2, column 2 of this instance.
Declaration
public float M22 { get; set; }
Property Value
Type | Description |
---|---|
float |
M31
Gets or sets the value at row 3, column 1 of this instance.
Declaration
public float M31 { get; set; }
Property Value
Type | Description |
---|---|
float |
M32
Gets or sets the value at row 3, column 2 of this instance.
Declaration
public float M32 { get; set; }
Property Value
Type | Description |
---|---|
float |
M41
Gets or sets the value at row 4, column 1 of this instance.
Declaration
public float M41 { get; set; }
Property Value
Type | Description |
---|---|
float |
M42
Gets or sets the value at row 4, column 2 of this instance.
Declaration
public float M42 { get; set; }
Property Value
Type | Description |
---|---|
float |
Trace
Gets the trace of the matrix, the sum of the values along the diagonal.
Declaration
public float Trace { get; }
Property Value
Type | Description |
---|---|
float |
Methods
Add(Matrix4x2, Matrix4x2)
Adds two instances.
Declaration
[Pure]
public static Matrix4x2 Add(Matrix4x2 left, Matrix4x2 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | The left operand of the addition. |
Matrix4x2 | right | The right operand of the addition. |
Returns
Type | Description |
---|---|
Matrix4x2 | A new instance that is the result of the addition. |
Add(in Matrix4x2, in Matrix4x2, out Matrix4x2)
Adds two instances.
Declaration
public static void Add(in Matrix4x2 left, in Matrix4x2 right, out Matrix4x2 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | The left operand of the addition. |
Matrix4x2 | right | The right operand of the addition. |
Matrix4x2 | result | A new instance that is the result of the addition. |
CreateRotation(float, out Matrix4x2)
Builds a rotation matrix.
Declaration
public static void CreateRotation(float angle, out Matrix4x2 result)
Parameters
Type | Name | Description |
---|---|---|
float | angle | The counter-clockwise angle in radians. |
Matrix4x2 | result | The resulting Matrix3x2 instance. |
CreateRotation(float)
Builds a rotation matrix.
Declaration
[Pure]
public static Matrix4x2 CreateRotation(float angle)
Parameters
Type | Name | Description |
---|---|---|
float | angle | The counter-clockwise angle in radians. |
Returns
Type | Description |
---|---|
Matrix4x2 | The resulting Matrix3x2 instance. |
CreateScale(Vector2, out Matrix4x2)
Creates a scale matrix.
Declaration
public static void CreateScale(Vector2 scale, out Matrix4x2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | scale | Scale factors for the x and y axes. |
Matrix4x2 | result | A scale matrix. |
CreateScale(Vector2)
Creates a scale matrix.
Declaration
[Pure]
public static Matrix4x2 CreateScale(Vector2 scale)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | scale | Scale factors for the x and y axes. |
Returns
Type | Description |
---|---|
Matrix4x2 | A scale matrix. |
CreateScale(float, out Matrix4x2)
Creates a scale matrix.
Declaration
public static void CreateScale(float scale, out Matrix4x2 result)
Parameters
Type | Name | Description |
---|---|---|
float | scale | Single scale factor for the x, y, and z axes. |
Matrix4x2 | result | A scale matrix. |
CreateScale(float, float, out Matrix4x2)
Creates a scale matrix.
Declaration
public static void CreateScale(float x, float y, out Matrix4x2 result)
Parameters
Type | Name | Description |
---|---|---|
float | x | Scale factor for the x axis. |
float | y | Scale factor for the y axis. |
Matrix4x2 | result | A scale matrix. |
CreateScale(float, float)
Creates a scale matrix.
Declaration
[Pure]
public static Matrix4x2 CreateScale(float x, float y)
Parameters
Type | Name | Description |
---|---|---|
float | x | Scale factor for the x axis. |
float | y | Scale factor for the y axis. |
Returns
Type | Description |
---|---|
Matrix4x2 | A scale matrix. |
CreateScale(float)
Creates a scale matrix.
Declaration
[Pure]
public static Matrix4x2 CreateScale(float scale)
Parameters
Type | Name | Description |
---|---|---|
float | scale | Single scale factor for the x and y axes. |
Returns
Type | Description |
---|---|
Matrix4x2 | A scale matrix. |
Equals(Matrix4x2)
Indicates whether the current matrix is equal to another matrix.
Declaration
[Pure]
public bool Equals(Matrix4x2 other)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | other | An matrix to compare with this matrix. |
Returns
Type | Description |
---|---|
bool | true if the current matrix is equal to the matrix parameter; otherwise, false. |
Equals(object)
Indicates whether this instance and a specified object are equal.
Declaration
[Pure]
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare to. |
Returns
Type | Description |
---|---|
bool | True if the instances are equal; false otherwise. |
Overrides
GetHashCode()
Returns the hashcode for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A System.Int32 containing the unique hashcode for this instance. |
Overrides
Mult(Matrix4x2, Matrix2)
Multiplies two instances.
Declaration
[Pure]
public static Matrix4x2 Mult(Matrix4x2 left, Matrix2 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | The left operand of the multiplication. |
Matrix2 | right | The right operand of the multiplication. |
Returns
Type | Description |
---|---|
Matrix4x2 | A new instance that is the result of the multiplication. |
Mult(Matrix4x2, Matrix2x3)
Multiplies two instances.
Declaration
[Pure]
public static Matrix4x3 Mult(Matrix4x2 left, Matrix2x3 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | The left operand of the multiplication. |
Matrix2x3 | right | The right operand of the multiplication. |
Returns
Type | Description |
---|---|
Matrix4x3 | A new instance that is the result of the multiplication. |
Mult(Matrix4x2, Matrix2x4)
Multiplies two instances.
Declaration
[Pure]
public static Matrix4 Mult(Matrix4x2 left, Matrix2x4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | The left operand of the multiplication. |
Matrix2x4 | right | The right operand of the multiplication. |
Returns
Type | Description |
---|---|
Matrix4 | A new instance that is the result of the multiplication. |
Mult(Matrix4x2, float)
Multiplies and instance by a scalar.
Declaration
[Pure]
public static Matrix4x2 Mult(Matrix4x2 left, float right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | The left operand of the multiplication. |
float | right | The right operand of the multiplication. |
Returns
Type | Description |
---|---|
Matrix4x2 | A new instance that is the result of the multiplication. |
Mult(in Matrix4x2, in Matrix2, out Matrix4x2)
Multiplies two instances.
Declaration
public static void Mult(in Matrix4x2 left, in Matrix2 right, out Matrix4x2 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | The left operand of the multiplication. |
Matrix2 | right | The right operand of the multiplication. |
Matrix4x2 | result | A new instance that is the result of the multiplication. |
Mult(in Matrix4x2, in Matrix2x3, out Matrix4x3)
Multiplies two instances.
Declaration
public static void Mult(in Matrix4x2 left, in Matrix2x3 right, out Matrix4x3 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | The left operand of the multiplication. |
Matrix2x3 | right | The right operand of the multiplication. |
Matrix4x3 | result | A new instance that is the result of the multiplication. |
Mult(in Matrix4x2, in Matrix2x4, out Matrix4)
Multiplies two instances.
Declaration
public static void Mult(in Matrix4x2 left, in Matrix2x4 right, out Matrix4 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | The left operand of the multiplication. |
Matrix2x4 | right | The right operand of the multiplication. |
Matrix4 | result | A new instance that is the result of the multiplication. |
Mult(in Matrix4x2, float, out Matrix4x2)
Multiplies and instance by a scalar.
Declaration
public static void Mult(in Matrix4x2 left, float right, out Matrix4x2 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | The left operand of the multiplication. |
float | right | The right operand of the multiplication. |
Matrix4x2 | result | A new instance that is the result of the multiplication. |
Subtract(Matrix4x2, Matrix4x2)
Subtracts two instances.
Declaration
[Pure]
public static Matrix4x2 Subtract(Matrix4x2 left, Matrix4x2 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | The left operand of the subtraction. |
Matrix4x2 | right | The right operand of the subtraction. |
Returns
Type | Description |
---|---|
Matrix4x2 | A new instance that is the result of the subtraction. |
Subtract(in Matrix4x2, in Matrix4x2, out Matrix4x2)
Subtracts two instances.
Declaration
public static void Subtract(in Matrix4x2 left, in Matrix4x2 right, out Matrix4x2 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | The left operand of the subtraction. |
Matrix4x2 | right | The right operand of the subtraction. |
Matrix4x2 | result | A new instance that is the result of the subtraction. |
ToString()
Returns a System.String that represents the current Matrix3d.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | The string representation of the matrix. |
Overrides
ToString(IFormatProvider)
Declaration
public string ToString(IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | formatProvider |
Returns
Type | Description |
---|---|
string |
ToString(string, IFormatProvider)
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
string | format | |
IFormatProvider | formatProvider |
Returns
Type | Description |
---|---|
string |
ToString(string)
Declaration
public string ToString(string format)
Parameters
Type | Name | Description |
---|---|---|
string | format |
Returns
Type | Description |
---|---|
string |
Transpose(Matrix4x2)
Calculate the transpose of the given matrix.
Declaration
[Pure]
public static Matrix2x4 Transpose(Matrix4x2 mat)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | mat | The matrix to transpose. |
Returns
Type | Description |
---|---|
Matrix2x4 | The transpose of the given matrix. |
Transpose(in Matrix4x2, out Matrix2x4)
Calculate the transpose of the given matrix.
Declaration
public static void Transpose(in Matrix4x2 mat, out Matrix2x4 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | mat | The matrix to transpose. |
Matrix2x4 | result | The transpose of the given matrix. |
Operators
operator +(Matrix4x2, Matrix4x2)
Matrix addition.
Declaration
[Pure]
public static Matrix4x2 operator +(Matrix4x2 left, Matrix4x2 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | left-hand operand. |
Matrix4x2 | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix4x2 | A new Matrix4x2 which holds the result of the addition. |
operator ==(Matrix4x2, Matrix4x2)
Compares two instances for equality.
Declaration
[Pure]
public static bool operator ==(Matrix4x2 left, Matrix4x2 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | The first instance. |
Matrix4x2 | right | The second instance. |
Returns
Type | Description |
---|---|
bool | True, if left equals right; false otherwise. |
operator !=(Matrix4x2, Matrix4x2)
Compares two instances for inequality.
Declaration
[Pure]
public static bool operator !=(Matrix4x2 left, Matrix4x2 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | The first instance. |
Matrix4x2 | right | The second instance. |
Returns
Type | Description |
---|---|
bool | True, if left does not equal right; false otherwise. |
operator *(Matrix4x2, Matrix2)
Matrix multiplication.
Declaration
[Pure]
public static Matrix4x2 operator *(Matrix4x2 left, Matrix2 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | left-hand operand. |
Matrix2 | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix4x2 | A new Matrix2 which holds the result of the multiplication. |
operator *(Matrix4x2, Matrix2x3)
Matrix multiplication.
Declaration
[Pure]
public static Matrix4x3 operator *(Matrix4x2 left, Matrix2x3 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | left-hand operand. |
Matrix2x3 | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix4x3 | A new Matrix4x3 which holds the result of the multiplication. |
operator *(Matrix4x2, Matrix2x4)
Matrix multiplication.
Declaration
[Pure]
public static Matrix4 operator *(Matrix4x2 left, Matrix2x4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | left-hand operand. |
Matrix2x4 | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix4 | A new Matrix4 which holds the result of the multiplication. |
operator *(Matrix4x2, float)
Scalar multiplication.
Declaration
[Pure]
public static Matrix4x2 operator *(Matrix4x2 left, float right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | left-hand operand. |
float | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix4x2 | A new Matrix4x2 which holds the result of the multiplication. |
operator *(float, Matrix4x2)
Scalar multiplication.
Declaration
[Pure]
public static Matrix4x2 operator *(float left, Matrix4x2 right)
Parameters
Type | Name | Description |
---|---|---|
float | left | left-hand operand. |
Matrix4x2 | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix4x2 | A new Matrix4x2 which holds the result of the multiplication. |
operator -(Matrix4x2, Matrix4x2)
Matrix subtraction.
Declaration
[Pure]
public static Matrix4x2 operator -(Matrix4x2 left, Matrix4x2 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x2 | left | left-hand operand. |
Matrix4x2 | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix4x2 | A new Matrix4x2 which holds the result of the subtraction. |