Struct Matrix3x4
Represents a 3x4 Matrix.
Inherited Members
Namespace: OpenTK.Mathematics
Assembly: OpenTK.Mathematics.dll
Syntax
[Serializable]
public struct Matrix3x4 : IEquatable<Matrix3x4>, IFormattable
Constructors
Matrix3x4(Vector4, Vector4, Vector4)
Initializes a new instance of the Matrix3x4 struct.
Declaration
public Matrix3x4(Vector4 row0, Vector4 row1, Vector4 row2)
Parameters
Type | Name | Description |
---|---|---|
Vector4 | row0 | Top row of the matrix. |
Vector4 | row1 | Second row of the matrix. |
Vector4 | row2 | Bottom row of the matrix. |
Matrix3x4(float, float, float, float, float, float, float, float, float, float, float, float)
Initializes a new instance of the Matrix3x4 struct.
Declaration
public Matrix3x4(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23)
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. |
float | m20 | First item of the third row of the matrix. |
float | m21 | Second item of the third row of the matrix. |
float | m22 | Third item of the third row of the matrix. |
float | m23 | Fourth item of the third row of the matrix. |
Fields
Row0
Top row of the matrix.
Declaration
public Vector4 Row0
Field Value
Type | Description |
---|---|
Vector4 |
Row1
2nd row of the matrix.
Declaration
public Vector4 Row1
Field Value
Type | Description |
---|---|
Vector4 |
Row2
Bottom row of the matrix.
Declaration
public Vector4 Row2
Field Value
Type | Description |
---|---|
Vector4 |
Zero
The zero matrix.
Declaration
public static Matrix3x4 Zero
Field Value
Type | Description |
---|---|
Matrix3x4 |
Properties
Column0
Gets the first column of this matrix.
Declaration
public Vector3 Column0 { get; }
Property Value
Type | Description |
---|---|
Vector3 |
Column1
Gets the second column of this matrix.
Declaration
public Vector3 Column1 { get; }
Property Value
Type | Description |
---|---|
Vector3 |
Column2
Gets the third column of this matrix.
Declaration
public Vector3 Column2 { get; }
Property Value
Type | Description |
---|---|
Vector3 |
Column3
Gets the fourth column of this matrix.
Declaration
public Vector3 Column3 { get; }
Property Value
Type | Description |
---|---|
Vector3 |
Diagonal
Gets or sets the values along the main diagonal of the matrix.
Declaration
public Vector3 Diagonal { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
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 |
M13
Gets or sets the value at row 1, column 3 of this instance.
Declaration
public float M13 { 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 { 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 |
M23
Gets or sets the value at row 2, column 3 of this instance.
Declaration
public float M23 { 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 { 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 |
M33
Gets or sets the value at row 3, column 3 of this instance.
Declaration
public float M33 { get; set; }
Property Value
Type | Description |
---|---|
float |
M34
Gets or sets the value at row 3, column 4 of this instance.
Declaration
public float M34 { 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(Matrix3x4, Matrix3x4)
Adds two instances.
Declaration
[Pure]
public static Matrix3x4 Add(Matrix3x4 left, Matrix3x4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | left | The left operand of the addition. |
Matrix3x4 | right | The right operand of the addition. |
Returns
Type | Description |
---|---|
Matrix3x4 | A new instance that is the result of the addition. |
Add(in Matrix3x4, in Matrix3x4, out Matrix3x4)
Adds two instances.
Declaration
public static void Add(in Matrix3x4 left, in Matrix3x4 right, out Matrix3x4 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | left | The left operand of the addition. |
Matrix3x4 | right | The right operand of the addition. |
Matrix3x4 | result | A new instance that is the result of the addition. |
CreateFromAxisAngle(Vector3, float, out Matrix3x4)
Build a rotation matrix from the specified axis/angle rotation.
Declaration
public static void CreateFromAxisAngle(Vector3 axis, float angle, out Matrix3x4 result)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | axis | The axis to rotate about. |
float | angle | Angle in radians to rotate counter-clockwise (looking in the direction of the given axis). |
Matrix3x4 | result | A matrix instance. |
CreateFromAxisAngle(Vector3, float)
Build a rotation matrix from the specified axis/angle rotation.
Declaration
[Pure]
public static Matrix3x4 CreateFromAxisAngle(Vector3 axis, float angle)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | axis | The axis to rotate about. |
float | angle | Angle in radians to rotate counter-clockwise (looking in the direction of the given axis). |
Returns
Type | Description |
---|---|
Matrix3x4 | A matrix instance. |
CreateFromQuaternion(Quaternion)
Builds a rotation matrix from a quaternion.
Declaration
[Pure]
public static Matrix3x4 CreateFromQuaternion(Quaternion q)
Parameters
Type | Name | Description |
---|---|---|
Quaternion | q | The quaternion to rotate by. |
Returns
Type | Description |
---|---|
Matrix3x4 | A matrix instance. |
CreateFromQuaternion(in Quaternion, out Matrix3x4)
Builds a rotation matrix from a quaternion.
Declaration
public static void CreateFromQuaternion(in Quaternion q, out Matrix3x4 result)
Parameters
Type | Name | Description |
---|---|---|
Quaternion | q | The quaternion to rotate by. |
Matrix3x4 | result | A matrix instance. |
CreateRotationX(float, out Matrix3x4)
Builds a rotation matrix for a rotation around the x-axis.
Declaration
public static void CreateRotationX(float angle, out Matrix3x4 result)
Parameters
Type | Name | Description |
---|---|---|
float | angle | The counter-clockwise angle in radians. |
Matrix3x4 | result | The resulting Matrix4 instance. |
CreateRotationX(float)
Builds a rotation matrix for a rotation around the x-axis.
Declaration
[Pure]
public static Matrix3x4 CreateRotationX(float angle)
Parameters
Type | Name | Description |
---|---|---|
float | angle | The counter-clockwise angle in radians. |
Returns
Type | Description |
---|---|
Matrix3x4 | The resulting Matrix4 instance. |
CreateRotationY(float, out Matrix3x4)
Builds a rotation matrix for a rotation around the y-axis.
Declaration
public static void CreateRotationY(float angle, out Matrix3x4 result)
Parameters
Type | Name | Description |
---|---|---|
float | angle | The counter-clockwise angle in radians. |
Matrix3x4 | result | The resulting Matrix4 instance. |
CreateRotationY(float)
Builds a rotation matrix for a rotation around the y-axis.
Declaration
[Pure]
public static Matrix3x4 CreateRotationY(float angle)
Parameters
Type | Name | Description |
---|---|---|
float | angle | The counter-clockwise angle in radians. |
Returns
Type | Description |
---|---|
Matrix3x4 | The resulting Matrix4 instance. |
CreateRotationZ(float, out Matrix3x4)
Builds a rotation matrix for a rotation around the z-axis.
Declaration
public static void CreateRotationZ(float angle, out Matrix3x4 result)
Parameters
Type | Name | Description |
---|---|---|
float | angle | The counter-clockwise angle in radians. |
Matrix3x4 | result | The resulting Matrix4 instance. |
CreateRotationZ(float)
Builds a rotation matrix for a rotation around the z-axis.
Declaration
[Pure]
public static Matrix3x4 CreateRotationZ(float angle)
Parameters
Type | Name | Description |
---|---|---|
float | angle | The counter-clockwise angle in radians. |
Returns
Type | Description |
---|---|
Matrix3x4 | The resulting Matrix4 instance. |
CreateScale(Vector3)
Build a scaling matrix.
Declaration
[Pure]
public static Matrix3x4 CreateScale(Vector3 scale)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | scale | Scale factors for x,y and z axes. |
Returns
Type | Description |
---|---|
Matrix3x4 | A scaling matrix. |
CreateScale(float, float, float)
Build a scaling matrix.
Declaration
[Pure]
public static Matrix3x4 CreateScale(float x, float y, float z)
Parameters
Type | Name | Description |
---|---|---|
float | x | Scale factor for x-axis. |
float | y | Scale factor for y-axis. |
float | z | Scale factor for z-axis. |
Returns
Type | Description |
---|---|
Matrix3x4 | A scaling matrix. |
CreateScale(float)
Build a scaling matrix.
Declaration
[Pure]
public static Matrix3x4 CreateScale(float scale)
Parameters
Type | Name | Description |
---|---|---|
float | scale | Single scale factor for x,y and z axes. |
Returns
Type | Description |
---|---|
Matrix3x4 | A scaling matrix. |
CreateTranslation(Vector3)
Creates a translation matrix.
Declaration
[Pure]
public static Matrix3x4 CreateTranslation(Vector3 vector)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | vector | The translation vector. |
Returns
Type | Description |
---|---|
Matrix3x4 | The resulting Matrix4 instance. |
CreateTranslation(in Vector3, out Matrix3x4)
Creates a translation matrix.
Declaration
public static void CreateTranslation(in Vector3 vector, out Matrix3x4 result)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | vector | The translation vector. |
Matrix3x4 | result | The resulting Matrix4 instance. |
CreateTranslation(float, float, float, out Matrix3x4)
Creates a translation matrix.
Declaration
public static void CreateTranslation(float x, float y, float z, out Matrix3x4 result)
Parameters
Type | Name | Description |
---|---|---|
float | x | X translation. |
float | y | Y translation. |
float | z | Z translation. |
Matrix3x4 | result | The resulting Matrix4 instance. |
CreateTranslation(float, float, float)
Creates a translation matrix.
Declaration
[Pure]
public static Matrix3x4 CreateTranslation(float x, float y, float z)
Parameters
Type | Name | Description |
---|---|---|
float | x | X translation. |
float | y | Y translation. |
float | z | Z translation. |
Returns
Type | Description |
---|---|
Matrix3x4 | The resulting Matrix4 instance. |
Equals(Matrix3x4)
Indicates whether the current matrix is equal to another matrix.
Declaration
[Pure]
public bool Equals(Matrix3x4 other)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | 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
Invert()
Converts this instance into its inverse.
Declaration
public void Invert()
Invert(Matrix3x4)
Calculate the inverse of the given matrix.
Declaration
[Pure]
public static Matrix3x4 Invert(Matrix3x4 mat)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | mat | The matrix to invert. |
Returns
Type | Description |
---|---|
Matrix3x4 | The inverse of the given matrix. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if the Matrix4 is singular. |
Invert(in Matrix3x4, out Matrix3x4)
Calculate the inverse of the given matrix.
Declaration
public static void Invert(in Matrix3x4 mat, out Matrix3x4 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | mat | The matrix to invert. |
Matrix3x4 | result | The inverse of the given matrix if it has one, or the input if it is singular. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if the Matrix4 is singular. |
Mult(Matrix3x4, Matrix3x4)
Multiplies two instances.
Declaration
[Pure]
public static Matrix3x4 Mult(Matrix3x4 left, Matrix3x4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | left | The left operand of the multiplication. |
Matrix3x4 | right | The right operand of the multiplication. |
Returns
Type | Description |
---|---|
Matrix3x4 | A new instance that is the result of the multiplication. |
Mult(Matrix3x4, Matrix4x3)
Multiplies two instances.
Declaration
[Pure]
public static Matrix3 Mult(Matrix3x4 left, Matrix4x3 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | left | The left operand of the multiplication. |
Matrix4x3 | right | The right operand of the multiplication. |
Returns
Type | Description |
---|---|
Matrix3 | A new instance that is the result of the multiplication. |
Mult(Matrix3x4, float)
Multiplies an instance by a scalar.
Declaration
[Pure]
public static Matrix3x4 Mult(Matrix3x4 left, float right)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | left | The left operand of the multiplication. |
float | right | The right operand of the multiplication. |
Returns
Type | Description |
---|---|
Matrix3x4 | A new instance that is the result of the multiplication. |
Mult(in Matrix3x4, in Matrix3x4, out Matrix3x4)
Multiplies two instances.
Declaration
public static void Mult(in Matrix3x4 left, in Matrix3x4 right, out Matrix3x4 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | left | The left operand of the multiplication. |
Matrix3x4 | right | The right operand of the multiplication. |
Matrix3x4 | result | A new instance that is the result of the multiplication. |
Mult(in Matrix3x4, in Matrix4x3, out Matrix3)
Multiplies two instances.
Declaration
public static void Mult(in Matrix3x4 left, in Matrix4x3 right, out Matrix3 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | left | The left operand of the multiplication. |
Matrix4x3 | right | The right operand of the multiplication. |
Matrix3 | result | A new instance that is the result of the multiplication. |
Mult(in Matrix3x4, float, out Matrix3x4)
Multiplies an instance by a scalar.
Declaration
public static void Mult(in Matrix3x4 left, float right, out Matrix3x4 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | left | The left operand of the multiplication. |
float | right | The right operand of the multiplication. |
Matrix3x4 | result | A new instance that is the result of the multiplication. |
Subtract(Matrix3x4, Matrix3x4)
Subtracts one instance from another.
Declaration
[Pure]
public static Matrix3x4 Subtract(Matrix3x4 left, Matrix3x4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | left | The left operand of the subraction. |
Matrix3x4 | right | The right operand of the subraction. |
Returns
Type | Description |
---|---|
Matrix3x4 | A new instance that is the result of the subraction. |
Subtract(in Matrix3x4, in Matrix3x4, out Matrix3x4)
Subtracts one instance from another.
Declaration
public static void Subtract(in Matrix3x4 left, in Matrix3x4 right, out Matrix3x4 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | left | The left operand of the subraction. |
Matrix3x4 | right | The right operand of the subraction. |
Matrix3x4 | result | A new instance that is the result of the subraction. |
ToString()
Returns a System.String that represents the current Matrix4.
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(Matrix3x4)
Calculate the transpose of the given matrix.
Declaration
[Pure]
public static Matrix4x3 Transpose(Matrix3x4 mat)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | mat | The matrix to transpose. |
Returns
Type | Description |
---|---|
Matrix4x3 | The transpose of the given matrix. |
Transpose(in Matrix3x4, out Matrix4x3)
Calculate the transpose of the given matrix.
Declaration
public static void Transpose(in Matrix3x4 mat, out Matrix4x3 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | mat | The matrix to transpose. |
Matrix4x3 | result | The result of the calculation. |
Operators
operator +(Matrix3x4, Matrix3x4)
Matrix addition.
Declaration
[Pure]
public static Matrix3x4 operator +(Matrix3x4 left, Matrix3x4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | left | left-hand operand. |
Matrix3x4 | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix3x4 | A new Matrix3x4 which holds the result of the addition. |
operator ==(Matrix3x4, Matrix3x4)
Compares two instances for equality.
Declaration
[Pure]
public static bool operator ==(Matrix3x4 left, Matrix3x4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | left | The first instance. |
Matrix3x4 | right | The second instance. |
Returns
Type | Description |
---|---|
bool | True, if left equals right; false otherwise. |
operator !=(Matrix3x4, Matrix3x4)
Compares two instances for inequality.
Declaration
[Pure]
public static bool operator !=(Matrix3x4 left, Matrix3x4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | left | The first instance. |
Matrix3x4 | right | The second instance. |
Returns
Type | Description |
---|---|
bool | True, if left does not equal right; false otherwise. |
operator *(Matrix3x4, Matrix3x4)
Matrix-scalar multiplication.
Declaration
[Pure]
public static Matrix3x4 operator *(Matrix3x4 left, Matrix3x4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | left | left-hand operand. |
Matrix3x4 | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix3x4 | A new Matrix3x4 which holds the result of the multiplication. |
operator *(Matrix3x4, Matrix4x3)
Matrix multiplication.
Declaration
[Pure]
public static Matrix3 operator *(Matrix3x4 left, Matrix4x3 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | left | left-hand operand. |
Matrix4x3 | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix3 | A new Matrix3 which holds the result of the multiplication. |
operator *(Matrix3x4, float)
Matrix-scalar multiplication.
Declaration
[Pure]
public static Matrix3x4 operator *(Matrix3x4 left, float right)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | left | left-hand operand. |
float | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix3x4 | A new Matrix3x4 which holds the result of the multiplication. |
operator -(Matrix3x4, Matrix3x4)
Matrix subtraction.
Declaration
[Pure]
public static Matrix3x4 operator -(Matrix3x4 left, Matrix3x4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x4 | left | left-hand operand. |
Matrix3x4 | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix3x4 | A new Matrix3x4 which holds the result of the subtraction. |