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