Struct Matrix2x4
Represents a 2x4 matrix.
Inherited Members
Namespace: OpenTK.Mathematics
Assembly: OpenTK.Mathematics.dll
Syntax
[Serializable]
public struct Matrix2x4 : IEquatable<Matrix2x4>, IFormattable
Constructors
Matrix2x4(Vector4, Vector4)
Initializes a new instance of the Matrix2x4 struct.
Declaration
public Matrix2x4(Vector4 row0, Vector4 row1)
Parameters
Type | Name | Description |
---|---|---|
Vector4 | row0 | Top row of the matrix. |
Vector4 | row1 | Bottom row of the matrix. |
Matrix2x4(float, float, float, float, float, float, float, float)
Initializes a new instance of the Matrix2x4 struct.
Declaration
public Matrix2x4(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13)
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 | m02 | Third item of the first row of the matrix. |
float | m03 | Fourth 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 | m12 | Third item of the second row of the matrix. |
float | m13 | Fourth item of the second row of the matrix. |
Fields
Row0
Top row of the matrix.
Declaration
public Vector4 Row0
Field Value
Type | Description |
---|---|
Vector4 |
Row1
Bottom row of the matrix.
Declaration
public Vector4 Row1
Field Value
Type | Description |
---|---|
Vector4 |
Zero
The zero matrix.
Declaration
public static readonly Matrix2x4 Zero
Field Value
Type | Description |
---|---|
Matrix2x4 |
Properties
Column0
Gets or sets the first column of the matrix.
Declaration
public Vector2 Column0 { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
Column1
Gets or sets the second column of the matrix.
Declaration
public Vector2 Column1 { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
Column2
Gets or sets the third column of the matrix.
Declaration
public Vector2 Column2 { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
Column3
Gets or sets the fourth column of the matrix.
Declaration
public Vector2 Column3 { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
Diagonal
Gets or sets the values along the main diagonal of the matrix.
Declaration
public Vector2 Diagonal { readonly 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] { readonly 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 { readonly 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 { readonly get; set; }
Property Value
Type | Description |
---|---|
float |
M13
Gets or sets the value at row 1, column 3 of this instance.
Declaration
public float M13 { readonly get; set; }
Property Value
Type | Description |
---|---|
float |
M14
Gets or sets the value at row 1, column 4 of this instance.
Declaration
public float M14 { readonly 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 { readonly 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 { readonly get; set; }
Property Value
Type | Description |
---|---|
float |
M23
Gets or sets the value at row 2, column 3 of this instance.
Declaration
public float M23 { readonly get; set; }
Property Value
Type | Description |
---|---|
float |
M24
Gets or sets the value at row 2, column 4 of this instance.
Declaration
public float M24 { readonly get; set; }
Property Value
Type | Description |
---|---|
float |
Trace
Gets the trace of the matrix, the sum of the values along the diagonal.
Declaration
public readonly float Trace { get; }
Property Value
Type | Description |
---|---|
float |
Methods
Add(Matrix2x4, Matrix2x4)
Adds two instances.
Declaration
[Pure]
public static Matrix2x4 Add(Matrix2x4 left, Matrix2x4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | The left operand of the addition. |
Matrix2x4 | right | The right operand of the addition. |
Returns
Type | Description |
---|---|
Matrix2x4 | A new instance that is the result of the addition. |
Add(in Matrix2x4, in Matrix2x4, out Matrix2x4)
Adds two instances.
Declaration
public static void Add(in Matrix2x4 left, in Matrix2x4 right, out Matrix2x4 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | The left operand of the addition. |
Matrix2x4 | right | The right operand of the addition. |
Matrix2x4 | result | A new instance that is the result of the addition. |
CreateRotation(float)
Builds a rotation matrix.
Declaration
[Pure]
public static Matrix2x4 CreateRotation(float angle)
Parameters
Type | Name | Description |
---|---|---|
float | angle | The counter-clockwise angle in radians. |
Returns
Type | Description |
---|---|
Matrix2x4 | The resulting Matrix2x3 instance. |
CreateRotation(float, out Matrix2x4)
Builds a rotation matrix.
Declaration
public static void CreateRotation(float angle, out Matrix2x4 result)
Parameters
Type | Name | Description |
---|---|---|
float | angle | The counter-clockwise angle in radians. |
Matrix2x4 | result | The resulting Matrix2x4 instance. |
CreateScale(Vector2)
Creates a scale matrix.
Declaration
[Pure]
public static Matrix2x4 CreateScale(Vector2 scale)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | scale | Scale factors for the x and y axes. |
Returns
Type | Description |
---|---|
Matrix2x4 | A scale matrix. |
CreateScale(Vector2, out Matrix2x4)
Creates a scale matrix.
Declaration
public static void CreateScale(Vector2 scale, out Matrix2x4 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | scale | Scale factors for the x and y axes. |
Matrix2x4 | result | A scale matrix. |
CreateScale(float)
Creates a scale matrix.
Declaration
[Pure]
public static Matrix2x4 CreateScale(float scale)
Parameters
Type | Name | Description |
---|---|---|
float | scale | Single scale factor for the x and y axes. |
Returns
Type | Description |
---|---|
Matrix2x4 | A scale matrix. |
CreateScale(float, out Matrix2x4)
Creates a scale matrix.
Declaration
public static void CreateScale(float scale, out Matrix2x4 result)
Parameters
Type | Name | Description |
---|---|---|
float | scale | Single scale factor for the x, y, and z axes. |
Matrix2x4 | result | A scale matrix. |
CreateScale(float, float)
Creates a scale matrix.
Declaration
[Pure]
public static Matrix2x4 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 |
---|---|
Matrix2x4 | A scale matrix. |
CreateScale(float, float, out Matrix2x4)
Creates a scale matrix.
Declaration
public static void CreateScale(float x, float y, out Matrix2x4 result)
Parameters
Type | Name | Description |
---|---|---|
float | x | Scale factor for the x axis. |
float | y | Scale factor for the y axis. |
Matrix2x4 | result | A scale matrix. |
Equals(Matrix2x4)
Indicates whether the current matrix is equal to another matrix.
Declaration
[Pure]
public readonly bool Equals(Matrix2x4 other)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | 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 readonly 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 readonly int GetHashCode()
Returns
Type | Description |
---|---|
int | A System.Int32 containing the unique hashcode for this instance. |
Overrides
Mult(Matrix2x4, Matrix4)
Multiplies two instances.
Declaration
[Pure]
public static Matrix2x4 Mult(Matrix2x4 left, Matrix4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | The left operand of the multiplication. |
Matrix4 | right | The right operand of the multiplication. |
Returns
Type | Description |
---|---|
Matrix2x4 | A new instance that is the result of the multiplication. |
Mult(Matrix2x4, Matrix4x2)
Multiplies two instances.
Declaration
[Pure]
public static Matrix2 Mult(Matrix2x4 left, Matrix4x2 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | The left operand of the multiplication. |
Matrix4x2 | right | The right operand of the multiplication. |
Returns
Type | Description |
---|---|
Matrix2 | A new instance that is the result of the multiplication. |
Mult(Matrix2x4, Matrix4x3)
Multiplies two instances.
Declaration
[Pure]
public static Matrix2x3 Mult(Matrix2x4 left, Matrix4x3 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | The left operand of the multiplication. |
Matrix4x3 | right | The right operand of the multiplication. |
Returns
Type | Description |
---|---|
Matrix2x3 | A new instance that is the result of the multiplication. |
Mult(Matrix2x4, float)
Multiplies and instance by a scalar.
Declaration
[Pure]
public static Matrix2x4 Mult(Matrix2x4 left, float right)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | The left operand of the multiplication. |
float | right | The right operand of the multiplication. |
Returns
Type | Description |
---|---|
Matrix2x4 | A new instance that is the result of the multiplication. |
Mult(in Matrix2x4, in Matrix4, out Matrix2x4)
Multiplies two instances.
Declaration
public static void Mult(in Matrix2x4 left, in Matrix4 right, out Matrix2x4 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | The left operand of the multiplication. |
Matrix4 | right | The right operand of the multiplication. |
Matrix2x4 | result | A new instance that is the result of the multiplication. |
Mult(in Matrix2x4, in Matrix4x2, out Matrix2)
Multiplies two instances.
Declaration
public static void Mult(in Matrix2x4 left, in Matrix4x2 right, out Matrix2 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | The left operand of the multiplication. |
Matrix4x2 | right | The right operand of the multiplication. |
Matrix2 | result | A new instance that is the result of the multiplication. |
Mult(in Matrix2x4, in Matrix4x3, out Matrix2x3)
Multiplies two instances.
Declaration
public static void Mult(in Matrix2x4 left, in Matrix4x3 right, out Matrix2x3 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | The left operand of the multiplication. |
Matrix4x3 | right | The right operand of the multiplication. |
Matrix2x3 | result | A new instance that is the result of the multiplication. |
Mult(in Matrix2x4, float, out Matrix2x4)
Multiplies and instance by a scalar.
Declaration
public static void Mult(in Matrix2x4 left, float right, out Matrix2x4 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | The left operand of the multiplication. |
float | right | The right operand of the multiplication. |
Matrix2x4 | result | A new instance that is the result of the multiplication. |
Subtract(Matrix2x4, Matrix2x4)
Subtracts two instances.
Declaration
[Pure]
public static Matrix2x4 Subtract(Matrix2x4 left, Matrix2x4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | The left operand of the subtraction. |
Matrix2x4 | right | The right operand of the subtraction. |
Returns
Type | Description |
---|---|
Matrix2x4 | A new instance that is the result of the subtraction. |
Subtract(in Matrix2x4, in Matrix2x4, out Matrix2x4)
Subtracts two instances.
Declaration
public static void Subtract(in Matrix2x4 left, in Matrix2x4 right, out Matrix2x4 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | The left operand of the subtraction. |
Matrix2x4 | right | The right operand of the subtraction. |
Matrix2x4 | result | A new instance that is the result of the subtraction. |
Swizzle(Matrix2x4, int, int)
Swizzles a matrix, i.e. switches rows of the matrix.
Declaration
public static Matrix2x4 Swizzle(Matrix2x4 mat, int rowForRow0, int rowForRow1)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | mat | The matrix to swizzle. |
int | rowForRow0 | Which row to place in Row0. |
int | rowForRow1 | Which row to place in Row1. |
Returns
Type | Description |
---|---|
Matrix2x4 | The swizzled matrix. |
Exceptions
Type | Condition |
---|---|
IndexOutOfRangeException | If any of the rows are outside of the range [0, 1]. |
Swizzle(in Matrix2x4, int, int, out Matrix2x4)
Swizzles a matrix, i.e. switches rows of the matrix.
Declaration
public static void Swizzle(in Matrix2x4 mat, int rowForRow0, int rowForRow1, out Matrix2x4 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | mat | The matrix to swizzle. |
int | rowForRow0 | Which row to place in Row0. |
int | rowForRow1 | Which row to place in Row1. |
Matrix2x4 | result | The swizzled matrix. |
Exceptions
Type | Condition |
---|---|
IndexOutOfRangeException | If any of the rows are outside of the range [0, 1]. |
Swizzle(int, int)
Swizzles this instance. Swiches places of the rows of the matrix.
Declaration
public void Swizzle(int rowForRow0, int rowForRow1)
Parameters
Type | Name | Description |
---|---|---|
int | rowForRow0 | Which row to place in Row0. |
int | rowForRow1 | Which row to place in Row1. |
Swizzled(int, int)
Returns a swizzled copy of this instance.
Declaration
public readonly Matrix2x4 Swizzled(int rowForRow0, int rowForRow1)
Parameters
Type | Name | Description |
---|---|---|
int | rowForRow0 | Which row to place in Row0. |
int | rowForRow1 | Which row to place in Row1. |
Returns
Type | Description |
---|---|
Matrix2x4 | The swizzled copy. |
ToString()
Returns a System.String that represents the current Matrix4.
Declaration
public override readonly string ToString()
Returns
Type | Description |
---|---|
string | The string representation of the matrix. |
Overrides
ToString(IFormatProvider)
Formats the value of the current instance using the specified format.
Declaration
public readonly string ToString(IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | formatProvider | The provider to use to format the value. -or- A null reference ( |
Returns
Type | Description |
---|---|
string | The value of the current instance in the specified format. |
ToString(string)
Formats the value of the current instance using the specified format.
Declaration
public readonly string ToString(string format)
Parameters
Type | Name | Description |
---|---|---|
string | format | The format to use. -or- A null reference ( |
Returns
Type | Description |
---|---|
string | The value of the current instance in the specified format. |
ToString(string, IFormatProvider)
Formats the value of the current instance using the specified format.
Declaration
public readonly string ToString(string format, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
string | format | The format to use. -or- A null reference ( |
IFormatProvider | formatProvider | The provider to use to format the value. -or- A null reference ( |
Returns
Type | Description |
---|---|
string | The value of the current instance in the specified format. |
Transpose(Matrix2x4)
Calculate the transpose of the given matrix.
Declaration
[Pure]
public static Matrix4x2 Transpose(Matrix2x4 mat)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | mat | The matrix to transpose. |
Returns
Type | Description |
---|---|
Matrix4x2 | The transpose of the given matrix. |
Transpose(in Matrix2x4, out Matrix4x2)
Calculate the transpose of the given matrix.
Declaration
public static void Transpose(in Matrix2x4 mat, out Matrix4x2 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | mat | The matrix to transpose. |
Matrix4x2 | result | The transpose of the given matrix. |
Transposed()
Returns a transposed copy of this instance.
Declaration
public readonly Matrix4x2 Transposed()
Returns
Type | Description |
---|---|
Matrix4x2 | The transposed copy. |
Operators
operator +(Matrix2x4, Matrix2x4)
Matrix addition.
Declaration
[Pure]
public static Matrix2x4 operator +(Matrix2x4 left, Matrix2x4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | left-hand operand. |
Matrix2x4 | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix2x4 | A new Matrix2 which holds the result of the addition. |
operator ==(Matrix2x4, Matrix2x4)
Compares two instances for equality.
Declaration
[Pure]
public static bool operator ==(Matrix2x4 left, Matrix2x4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | The first instance. |
Matrix2x4 | right | The second instance. |
Returns
Type | Description |
---|---|
bool | True, if left equals right; false otherwise. |
operator !=(Matrix2x4, Matrix2x4)
Compares two instances for inequality.
Declaration
[Pure]
public static bool operator !=(Matrix2x4 left, Matrix2x4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | The first instance. |
Matrix2x4 | right | The second instance. |
Returns
Type | Description |
---|---|
bool | True, if left does not equal right; false otherwise. |
operator *(Matrix2x4, Matrix4)
Matrix multiplication.
Declaration
[Pure]
public static Matrix2x4 operator *(Matrix2x4 left, Matrix4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | left-hand operand. |
Matrix4 | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix2x4 | A new Matrix2x4 which holds the result of the multiplication. |
operator *(Matrix2x4, Matrix4x2)
Matrix multiplication.
Declaration
[Pure]
public static Matrix2 operator *(Matrix2x4 left, Matrix4x2 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | left-hand operand. |
Matrix4x2 | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix2 | A new Matrix2 which holds the result of the multiplication. |
operator *(Matrix2x4, Matrix4x3)
Matrix multiplication.
Declaration
[Pure]
public static Matrix2x3 operator *(Matrix2x4 left, Matrix4x3 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | left-hand operand. |
Matrix4x3 | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix2x3 | A new Matrix2x3 which holds the result of the multiplication. |
operator *(Matrix2x4, float)
Scalar multiplication.
Declaration
[Pure]
public static Matrix2x4 operator *(Matrix2x4 left, float right)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | left-hand operand. |
float | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix2x4 | A new Matrix2x4 which holds the result of the multiplication. |
operator *(float, Matrix2x4)
Scalar multiplication.
Declaration
[Pure]
public static Matrix2x4 operator *(float left, Matrix2x4 right)
Parameters
Type | Name | Description |
---|---|---|
float | left | left-hand operand. |
Matrix2x4 | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix2x4 | A new Matrix2x4 which holds the result of the multiplication. |
operator -(Matrix2x4, Matrix2x4)
Matrix subtraction.
Declaration
[Pure]
public static Matrix2x4 operator -(Matrix2x4 left, Matrix2x4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix2x4 | left | left-hand operand. |
Matrix2x4 | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix2x4 | A new Matrix2x4 which holds the result of the subtraction. |