Struct Matrix4x3
Represents a 3x4 matrix.
Implements
Inherited Members
Namespace: OpenTK
Assembly: OpenTK.dll
Syntax
[Serializable]
public struct Matrix4x3 : IEquatable<Matrix4x3>
Constructors
Matrix4x3(Vector3, Vector3, Vector3, Vector3)
Constructs a new instance.
Declaration
public Matrix4x3(Vector3 row0, Vector3 row1, Vector3 row2, Vector3 row3)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | row0 | Top row of the matrix |
Vector3 | row1 | Second row of the matrix |
Vector3 | row2 | Third row of the matrix |
Vector3 | row3 | Bottom row of the matrix |
Matrix4x3(Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single)
Constructs a new instance.
Declaration
public Matrix4x3(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22, float m30, float m31, float m32)
Parameters
Type | Name | Description |
---|---|---|
Single | m00 | First item of the first row of the matrix. |
Single | m01 | Second item of the first row of the matrix. |
Single | m02 | Third item of the first row of the matrix. |
Single | m10 | First item of the second row of the matrix. |
Single | m11 | Second item of the second row of the matrix. |
Single | m12 | Third item of the second row of the matrix. |
Single | m20 | First item of the third row of the matrix. |
Single | m21 | Second item of the third row of the matrix. |
Single | m22 | Third item of the third row of the matrix. |
Single | m30 | First item of the fourth row of the matrix. |
Single | m31 | Second item of the fourth row of the matrix. |
Single | m32 | Third item of the fourth row of the matrix. |
Fields
Row0
Top row of the matrix
Declaration
public Vector3 Row0
Field Value
Type | Description |
---|---|
Vector3 |
Row1
2nd row of the matrix
Declaration
public Vector3 Row1
Field Value
Type | Description |
---|---|
Vector3 |
Row2
3rd row of the matrix
Declaration
public Vector3 Row2
Field Value
Type | Description |
---|---|
Vector3 |
Row3
Bottom row of the matrix
Declaration
public Vector3 Row3
Field Value
Type | Description |
---|---|
Vector3 |
Zero
The zero matrix
Declaration
public static readonly Matrix4x3 Zero
Field Value
Type | Description |
---|---|
Matrix4x3 |
Properties
Column0
Gets the first column of this matrix.
Declaration
public readonly Vector4 Column0 { get; }
Property Value
Type | Description |
---|---|
Vector4 |
Column1
Gets the second column of this matrix.
Declaration
public readonly Vector4 Column1 { get; }
Property Value
Type | Description |
---|---|
Vector4 |
Column2
Gets the third column of this matrix.
Declaration
public readonly Vector4 Column2 { get; }
Property Value
Type | Description |
---|---|
Vector4 |
Diagonal
Gets or sets the values along the main diagonal of the matrix.
Declaration
public Vector3 Diagonal { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Item[Int32, Int32]
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 |
---|---|---|
Int32 | rowIndex | |
Int32 | columnIndex |
Property Value
Type | Description |
---|---|
Single |
M11
Gets or sets the value at row 1, column 1 of this instance.
Declaration
public float M11 { get; set; }
Property Value
Type | Description |
---|---|
Single |
M12
Gets or sets the value at row 1, column 2 of this instance.
Declaration
public float M12 { get; set; }
Property Value
Type | Description |
---|---|
Single |
M13
Gets or sets the value at row 1, column 3 of this instance.
Declaration
public float M13 { get; set; }
Property Value
Type | Description |
---|---|
Single |
M21
Gets or sets the value at row 2, column 1 of this instance.
Declaration
public float M21 { get; set; }
Property Value
Type | Description |
---|---|
Single |
M22
Gets or sets the value at row 2, column 2 of this instance.
Declaration
public float M22 { get; set; }
Property Value
Type | Description |
---|---|
Single |
M23
Gets or sets the value at row 2, column 3 of this instance.
Declaration
public float M23 { get; set; }
Property Value
Type | Description |
---|---|
Single |
M31
Gets or sets the value at row 3, column 1 of this instance.
Declaration
public float M31 { get; set; }
Property Value
Type | Description |
---|---|
Single |
M32
Gets or sets the value at row 3, column 2 of this instance.
Declaration
public float M32 { get; set; }
Property Value
Type | Description |
---|---|
Single |
M33
Gets or sets the value at row 3, column 3 of this instance.
Declaration
public float M33 { get; set; }
Property Value
Type | Description |
---|---|
Single |
M41
Gets or sets the value at row 4, column 1 of this instance.
Declaration
public float M41 { get; set; }
Property Value
Type | Description |
---|---|
Single |
M42
Gets or sets the value at row 4, column 2 of this instance.
Declaration
public float M42 { get; set; }
Property Value
Type | Description |
---|---|
Single |
M43
Gets or sets the value at row 4, column 3 of this instance.
Declaration
public float M43 { get; set; }
Property Value
Type | Description |
---|---|
Single |
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 |
---|---|
Single |
Methods
Add(Matrix4x3, Matrix4x3)
Adds two instances.
Declaration
public static Matrix4x3 Add(Matrix4x3 left, Matrix4x3 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | left | The left operand of the addition. |
Matrix4x3 | right | The right operand of the addition. |
Returns
Type | Description |
---|---|
Matrix4x3 | A new instance that is the result of the addition. |
Add(ref Matrix4x3, ref Matrix4x3, out Matrix4x3)
Adds two instances.
Declaration
public static void Add(ref Matrix4x3 left, ref Matrix4x3 right, out Matrix4x3 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | left | The left operand of the addition. |
Matrix4x3 | right | The right operand of the addition. |
Matrix4x3 | result | A new instance that is the result of the addition. |
CreateFromAxisAngle(Vector3, Single)
Build a rotation matrix from the specified axis/angle rotation.
Declaration
public static Matrix4x3 CreateFromAxisAngle(Vector3 axis, float angle)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | axis | The axis to rotate about. |
Single | angle | Angle in radians to rotate counter-clockwise (looking in the direction of the given axis). |
Returns
Type | Description |
---|---|
Matrix4x3 | A matrix instance. |
CreateFromAxisAngle(Vector3, Single, out Matrix4x3)
Build a rotation matrix from the specified axis/angle rotation.
Declaration
public static void CreateFromAxisAngle(Vector3 axis, float angle, out Matrix4x3 result)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | axis | The axis to rotate about. |
Single | angle | Angle in radians to rotate counter-clockwise (looking in the direction of the given axis). |
Matrix4x3 | result | A matrix instance. |
CreateFromQuaternion(Quaternion)
Builds a rotation matrix from a quaternion.
Declaration
public static Matrix4x3 CreateFromQuaternion(Quaternion q)
Parameters
Type | Name | Description |
---|---|---|
Quaternion | q | The quaternion to rotate by. |
Returns
Type | Description |
---|---|
Matrix4x3 | A matrix instance. |
CreateFromQuaternion(ref Quaternion, out Matrix4x3)
Builds a rotation matrix from a quaternion.
Declaration
public static void CreateFromQuaternion(ref Quaternion q, out Matrix4x3 result)
Parameters
Type | Name | Description |
---|---|---|
Quaternion | q | The quaternion to rotate by. |
Matrix4x3 | result | A matrix instance. |
CreateRotationX(Single)
Builds a rotation matrix for a rotation around the x-axis.
Declaration
public static Matrix4x3 CreateRotationX(float angle)
Parameters
Type | Name | Description |
---|---|---|
Single | angle | The counter-clockwise angle in radians. |
Returns
Type | Description |
---|---|
Matrix4x3 | The resulting Matrix4 instance. |
CreateRotationX(Single, out Matrix4x3)
Builds a rotation matrix for a rotation around the x-axis.
Declaration
public static void CreateRotationX(float angle, out Matrix4x3 result)
Parameters
Type | Name | Description |
---|---|---|
Single | angle | The counter-clockwise angle in radians. |
Matrix4x3 | result | The resulting Matrix4 instance. |
CreateRotationY(Single)
Builds a rotation matrix for a rotation around the y-axis.
Declaration
public static Matrix4x3 CreateRotationY(float angle)
Parameters
Type | Name | Description |
---|---|---|
Single | angle | The counter-clockwise angle in radians. |
Returns
Type | Description |
---|---|
Matrix4x3 | The resulting Matrix4 instance. |
CreateRotationY(Single, out Matrix4x3)
Builds a rotation matrix for a rotation around the y-axis.
Declaration
public static void CreateRotationY(float angle, out Matrix4x3 result)
Parameters
Type | Name | Description |
---|---|---|
Single | angle | The counter-clockwise angle in radians. |
Matrix4x3 | result | The resulting Matrix4 instance. |
CreateRotationZ(Single)
Builds a rotation matrix for a rotation around the z-axis.
Declaration
public static Matrix4x3 CreateRotationZ(float angle)
Parameters
Type | Name | Description |
---|---|---|
Single | angle | The counter-clockwise angle in radians. |
Returns
Type | Description |
---|---|
Matrix4x3 | The resulting Matrix4 instance. |
CreateRotationZ(Single, out Matrix4x3)
Builds a rotation matrix for a rotation around the z-axis.
Declaration
public static void CreateRotationZ(float angle, out Matrix4x3 result)
Parameters
Type | Name | Description |
---|---|---|
Single | angle | The counter-clockwise angle in radians. |
Matrix4x3 | result | The resulting Matrix4 instance. |
CreateScale(Vector3)
Build a scaling matrix
Declaration
public static Matrix4x3 CreateScale(Vector3 scale)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | scale | Scale factors for x,y and z axes |
Returns
Type | Description |
---|---|
Matrix4x3 | A scaling matrix |
CreateScale(Single)
Build a scaling matrix
Declaration
public static Matrix4x3 CreateScale(float scale)
Parameters
Type | Name | Description |
---|---|---|
Single | scale | Single scale factor for x,y and z axes |
Returns
Type | Description |
---|---|
Matrix4x3 | A scaling matrix |
CreateScale(Single, Single, Single)
Build a scaling matrix
Declaration
public static Matrix4x3 CreateScale(float x, float y, float z)
Parameters
Type | Name | Description |
---|---|---|
Single | x | Scale factor for x-axis |
Single | y | Scale factor for y-axis |
Single | z | Scale factor for z-axis |
Returns
Type | Description |
---|---|
Matrix4x3 | A scaling matrix |
CreateTranslation(Vector3)
Creates a translation matrix.
Declaration
public static Matrix4x3 CreateTranslation(Vector3 vector)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | vector | The translation vector. |
Returns
Type | Description |
---|---|
Matrix4x3 | The resulting Matrix4 instance. |
CreateTranslation(ref Vector3, out Matrix4x3)
Creates a translation matrix.
Declaration
public static void CreateTranslation(ref Vector3 vector, out Matrix4x3 result)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | vector | The translation vector. |
Matrix4x3 | result | The resulting Matrix4 instance. |
CreateTranslation(Single, Single, Single)
Creates a translation matrix.
Declaration
public static Matrix4x3 CreateTranslation(float x, float y, float z)
Parameters
Type | Name | Description |
---|---|---|
Single | x | X translation. |
Single | y | Y translation. |
Single | z | Z translation. |
Returns
Type | Description |
---|---|
Matrix4x3 | The resulting Matrix4 instance. |
CreateTranslation(Single, Single, Single, out Matrix4x3)
Creates a translation matrix.
Declaration
public static void CreateTranslation(float x, float y, float z, out Matrix4x3 result)
Parameters
Type | Name | Description |
---|---|---|
Single | x | X translation. |
Single | y | Y translation. |
Single | z | Z translation. |
Matrix4x3 | result | The resulting Matrix4 instance. |
Equals(Matrix4x3)
Indicates whether the current matrix is equal to another matrix.
Declaration
public bool Equals(Matrix4x3 other)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | other | An matrix to compare with this matrix. |
Returns
Type | Description |
---|---|
Boolean | 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
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object to compare tresult. |
Returns
Type | Description |
---|---|
Boolean | True if the instances are equal; false otherwise. |
Overrides
GetHashCode()
Returns the hashcode for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A System.Int32 containing the unique hashcode for this instance. |
Overrides
Invert()
Converts this instance into it's inverse by inverting the upper-left 3x3 and replacing Row3.
Declaration
public void Invert()
Invert(Matrix4x3)
Calculate the inverse of the given matrix
Declaration
public static Matrix4x3 Invert(Matrix4x3 mat)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | mat | The matrix to invert |
Returns
Type | Description |
---|---|
Matrix4x3 | 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. |
Invert(ref Matrix4x3, out Matrix4x3)
Calculate the inverse of the given matrix
Declaration
public static void Invert(ref Matrix4x3 mat, out Matrix4x3 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | mat | The matrix to invert |
Matrix4x3 | 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(Matrix4x3, Matrix3x4)
This isn't quite a multiply, but the result may be useful in some situations. Multiplies two instances.
Declaration
public static Matrix4 Mult(Matrix4x3 left, Matrix3x4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | left | The left operand of the multiplication. |
Matrix3x4 | right | The right operand of the multiplication. |
Returns
Type | Description |
---|---|
Matrix4 | A new instance that is the result of the multiplication |
Mult(Matrix4x3, Matrix4x3)
Multiplies two instances.
Declaration
public static Matrix4x3 Mult(Matrix4x3 left, Matrix4x3 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | left | The left operand of the multiplication. |
Matrix4x3 | right | The right operand of the multiplication. |
Returns
Type | Description |
---|---|
Matrix4x3 | A new instance that is the result of the multiplication |
Mult(Matrix4x3, Single)
Multiplies an instance by a scalar.
Declaration
public static Matrix4x3 Mult(Matrix4x3 left, float right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | left | The left operand of the multiplication. |
Single | right | The right operand of the multiplication. |
Returns
Type | Description |
---|---|
Matrix4x3 | A new instance that is the result of the multiplication |
Mult(ref Matrix4x3, ref Matrix3x4, out Matrix4)
This isn't quite a multiply, but the result may be useful in some situations. Multiplies two instances.
Declaration
public static void Mult(ref Matrix4x3 left, ref Matrix3x4 right, out Matrix4 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | left | The left operand of the multiplication. |
Matrix3x4 | right | The right operand of the multiplication. |
Matrix4 | result | A new instance that is the result of the multiplication |
Mult(ref Matrix4x3, ref Matrix4x3, out Matrix4x3)
This isn't quite a multiply, but the result may be useful in some situations. Multiplies two instances.
Declaration
public static void Mult(ref Matrix4x3 left, ref Matrix4x3 right, out Matrix4x3 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | left | The left operand of the multiplication. |
Matrix4x3 | right | The right operand of the multiplication. |
Matrix4x3 | result | A new instance that is the result of the multiplication |
Mult(ref Matrix4x3, Single, out Matrix4x3)
Multiplies an instance by a scalar.
Declaration
public static void Mult(ref Matrix4x3 left, float right, out Matrix4x3 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | left | The left operand of the multiplication. |
Single | right | The right operand of the multiplication. |
Matrix4x3 | result | A new instance that is the result of the multiplication |
Subtract(Matrix4x3, Matrix4x3)
Subtracts one instance from another.
Declaration
public static Matrix4x3 Subtract(Matrix4x3 left, Matrix4x3 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | left | The left operand of the subraction. |
Matrix4x3 | right | The right operand of the subraction. |
Returns
Type | Description |
---|---|
Matrix4x3 | A new instance that is the result of the subraction. |
Subtract(ref Matrix4x3, ref Matrix4x3, out Matrix4x3)
Subtracts one instance from another.
Declaration
public static void Subtract(ref Matrix4x3 left, ref Matrix4x3 right, out Matrix4x3 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | left | The left operand of the subraction. |
Matrix4x3 | right | The right operand of the subraction. |
Matrix4x3 | result | A new instance that is the result of the subraction. |
ToString()
Returns a System.String that represents the current Matrix4x3.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | The string representation of the matrix. |
Overrides
Transpose(Matrix4x3)
Calculate the transpose of the given matrix
Declaration
public static Matrix3x4 Transpose(Matrix4x3 mat)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | mat | The matrix to transpose |
Returns
Type | Description |
---|---|
Matrix3x4 | The transpose of the given matrix |
Transpose(ref Matrix4x3, out Matrix3x4)
Calculate the transpose of the given matrix
Declaration
public static void Transpose(ref Matrix4x3 mat, out Matrix3x4 result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | mat | The matrix to transpose |
Matrix3x4 | result | The result of the calculation |
Operators
Addition(Matrix4x3, Matrix4x3)
Matrix addition
Declaration
public static Matrix4x3 operator +(Matrix4x3 left, Matrix4x3 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | left | left-hand operand |
Matrix4x3 | right | right-hand operand |
Returns
Type | Description |
---|---|
Matrix4x3 | A new Matrix4x3 which holds the result of the addition |
Equality(Matrix4x3, Matrix4x3)
Compares two instances for equality.
Declaration
public static bool operator ==(Matrix4x3 left, Matrix4x3 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | left | The first instance. |
Matrix4x3 | right | The second instance. |
Returns
Type | Description |
---|---|
Boolean | True, if left equals right; false otherwise. |
Inequality(Matrix4x3, Matrix4x3)
Compares two instances for inequality.
Declaration
public static bool operator !=(Matrix4x3 left, Matrix4x3 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | left | The first instance. |
Matrix4x3 | right | The second instance. |
Returns
Type | Description |
---|---|
Boolean | True, if left does not equal right; false otherwise. |
Multiply(Matrix4x3, Matrix3x4)
Matrix multiplication
Declaration
public static Matrix4 operator *(Matrix4x3 left, Matrix3x4 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | left | left-hand operand |
Matrix3x4 | right | right-hand operand |
Returns
Type | Description |
---|---|
Matrix4 | A new Matrix4 which holds the result of the multiplication |
Multiply(Matrix4x3, Matrix4x3)
Matrix multiplication
Declaration
public static Matrix4x3 operator *(Matrix4x3 left, Matrix4x3 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | left | left-hand operand |
Matrix4x3 | right | right-hand operand |
Returns
Type | Description |
---|---|
Matrix4x3 | A new Matrix4x3 which holds the result of the multiplication |
Multiply(Matrix4x3, Single)
Matrix-scalar multiplication
Declaration
public static Matrix4x3 operator *(Matrix4x3 left, float right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | left | left-hand operand |
Single | right | right-hand operand |
Returns
Type | Description |
---|---|
Matrix4x3 | A new Matrix4x3 which holds the result of the multiplication |
Subtraction(Matrix4x3, Matrix4x3)
Matrix subtraction
Declaration
public static Matrix4x3 operator -(Matrix4x3 left, Matrix4x3 right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x3 | left | left-hand operand |
Matrix4x3 | right | right-hand operand |
Returns
Type | Description |
---|---|
Matrix4x3 | A new Matrix4x3 which holds the result of the subtraction |