Struct Matrix4d
Represents a 4x4 matrix containing 3D rotation, scale, transform, and projection with double-precision components.
Inherited Members
Namespace: OpenTK.Mathematics
Assembly: OpenTK.Mathematics.dll
Syntax
[Serializable]
public struct Matrix4d : IEquatable<Matrix4d>, IFormattable
Constructors
Matrix4d(Matrix3d)
Initializes a new instance of the Matrix4d struct.
Declaration
public Matrix4d(Matrix3d topLeft)
Parameters
Type | Name | Description |
---|---|---|
Matrix3d | topLeft | The top left 3x3 of the matrix. |
See Also
Matrix4d(Vector4d, Vector4d, Vector4d, Vector4d)
Initializes a new instance of the Matrix4d struct.
Declaration
public Matrix4d(Vector4d row0, Vector4d row1, Vector4d row2, Vector4d row3)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | row0 | Top row of the matrix. |
Vector4d | row1 | Second row of the matrix. |
Vector4d | row2 | Third row of the matrix. |
Vector4d | row3 | Bottom row of the matrix. |
See Also
Matrix4d(double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double)
Initializes a new instance of the Matrix4d struct.
Declaration
public Matrix4d(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)
Parameters
Type | Name | Description |
---|---|---|
double | m00 | First item of the first row. |
double | m01 | Second item of the first row. |
double | m02 | Third item of the first row. |
double | m03 | Fourth item of the first row. |
double | m10 | First item of the second row. |
double | m11 | Second item of the second row. |
double | m12 | Third item of the second row. |
double | m13 | Fourth item of the second row. |
double | m20 | First item of the third row. |
double | m21 | Second item of the third row. |
double | m22 | Third item of the third row. |
double | m23 | Fourth item of the third row. |
double | m30 | First item of the fourth row. |
double | m31 | Second item of the fourth row. |
double | m32 | Third item of the fourth row. |
double | m33 | Fourth item of the fourth row. |
See Also
Fields
Identity
The identity matrix.
Declaration
public static Matrix4d Identity
Field Value
Type | Description |
---|---|
Matrix4d |
See Also
Row0
Top row of the matrix.
Declaration
public Vector4d Row0
Field Value
Type | Description |
---|---|
Vector4d |
See Also
Row1
2nd row of the matrix.
Declaration
public Vector4d Row1
Field Value
Type | Description |
---|---|
Vector4d |
See Also
Row2
3rd row of the matrix.
Declaration
public Vector4d Row2
Field Value
Type | Description |
---|---|
Vector4d |
See Also
Row3
Bottom row of the matrix.
Declaration
public Vector4d Row3
Field Value
Type | Description |
---|---|
Vector4d |
See Also
Properties
Column0
Gets or sets the first column of this matrix.
Declaration
public Vector4d Column0 { get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
See Also
Column1
Gets or sets the second column of this matrix.
Declaration
public Vector4d Column1 { get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
See Also
Column2
Gets or sets the third column of this matrix.
Declaration
public Vector4d Column2 { get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
See Also
Column3
Gets or sets the fourth column of this matrix.
Declaration
public Vector4d Column3 { get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
See Also
Determinant
Gets the determinant of this matrix.
Declaration
public double Determinant { get; }
Property Value
Type | Description |
---|---|
double |
See Also
Diagonal
Gets or sets the values along the main diagonal of the matrix.
Declaration
public Vector4d Diagonal { get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
See Also
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. |
See Also
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 |
See Also
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 |
See Also
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 |
See Also
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 |
See Also
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 |
See Also
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 |
See Also
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 |
See Also
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 |
See Also
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 |
See Also
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 |
See Also
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 |
See Also
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 |
See Also
M41
Gets or sets the value at row 4, column 1 of this instance.
Declaration
public double M41 { get; set; }
Property Value
Type | Description |
---|---|
double |
See Also
M42
Gets or sets the value at row 4, column 2 of this instance.
Declaration
public double M42 { get; set; }
Property Value
Type | Description |
---|---|
double |
See Also
M43
Gets or sets the value at row 4, column 3 of this instance.
Declaration
public double M43 { get; set; }
Property Value
Type | Description |
---|---|
double |
See Also
M44
Gets or sets the value at row 4, column 4 of this instance.
Declaration
public double M44 { get; set; }
Property Value
Type | Description |
---|---|
double |
See Also
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 |
See Also
Methods
Add(Matrix4d, Matrix4d)
Adds two instances.
Declaration
[Pure]
public static Matrix4d Add(Matrix4d left, Matrix4d right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | left | The left operand of the addition. |
Matrix4d | right | The right operand of the addition. |
Returns
Type | Description |
---|---|
Matrix4d | A new instance that is the result of the addition. |
See Also
Add(in Matrix4d, in Matrix4d, out Matrix4d)
Adds two instances.
Declaration
public static void Add(in Matrix4d left, in Matrix4d right, out Matrix4d result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | left | The left operand of the addition. |
Matrix4d | right | The right operand of the addition. |
Matrix4d | result | A new instance that is the result of the addition. |
See Also
ClearProjection()
Returns a copy of this Matrix4d without projection.
Declaration
public Matrix4d ClearProjection()
Returns
Type | Description |
---|---|
Matrix4d | The matrix without projection. |
See Also
ClearRotation()
Returns a copy of this Matrix4d without rotation.
Declaration
public Matrix4d ClearRotation()
Returns
Type | Description |
---|---|
Matrix4d | The matrix without rotation. |
See Also
ClearScale()
Returns a copy of this Matrix4d without scale.
Declaration
public Matrix4d ClearScale()
Returns
Type | Description |
---|---|
Matrix4d | The matrix without scaling. |
See Also
ClearTranslation()
Returns a copy of this Matrix4d without translation.
Declaration
public Matrix4d ClearTranslation()
Returns
Type | Description |
---|---|
Matrix4d | The matrix without translation. |
See Also
CreateFromAxisAngle(Vector3d, double, out Matrix4d)
Build a rotation matrix from the specified axis/angle rotation.
Declaration
public static void CreateFromAxisAngle(Vector3d axis, double angle, out Matrix4d 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). |
Matrix4d | result | A matrix instance. |
See Also
CreateFromAxisAngle(Vector3d, double)
Build a rotation matrix from the specified axis/angle rotation.
Declaration
[Pure]
public static Matrix4d 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 |
---|---|
Matrix4d | A matrix instance. |
See Also
CreateFromQuaternion(Quaterniond)
Builds a rotation matrix from a quaternion.
Declaration
[Pure]
public static Matrix4d CreateFromQuaternion(Quaterniond q)
Parameters
Type | Name | Description |
---|---|---|
Quaterniond | q | The quaternion to rotate by. |
Returns
Type | Description |
---|---|
Matrix4d | A matrix instance. |
See Also
CreateFromQuaternion(in Quaterniond, out Matrix4d)
Build a rotation matrix from the specified quaternion.
Declaration
public static void CreateFromQuaternion(in Quaterniond q, out Matrix4d result)
Parameters
Type | Name | Description |
---|---|---|
Quaterniond | q | Quaternion to translate. |
Matrix4d | result | Matrix result. |
See Also
CreateOrthographic(double, double, double, double, out Matrix4d)
Creates an orthographic projection matrix.
Declaration
public static void CreateOrthographic(double width, double height, double depthNear, double depthFar, out Matrix4d result)
Parameters
Type | Name | Description |
---|---|---|
double | width | The width of the projection volume. |
double | height | The height of the projection volume. |
double | depthNear | The near edge of the projection volume. |
double | depthFar | The far edge of the projection volume. |
Matrix4d | result | The resulting Matrix4d instance. |
See Also
CreateOrthographic(double, double, double, double)
Creates an orthographic projection matrix.
Declaration
[Pure]
public static Matrix4d CreateOrthographic(double width, double height, double depthNear, double depthFar)
Parameters
Type | Name | Description |
---|---|---|
double | width | The width of the projection volume. |
double | height | The height of the projection volume. |
double | depthNear | The near edge of the projection volume. |
double | depthFar | The far edge of the projection volume. |
Returns
Type | Description |
---|---|
Matrix4d | The resulting Matrix4d instance. |
See Also
CreateOrthographicOffCenter(double, double, double, double, double, double, out Matrix4d)
Creates an orthographic projection matrix.
Declaration
public static void CreateOrthographicOffCenter(double left, double right, double bottom, double top, double depthNear, double depthFar, out Matrix4d result)
Parameters
Type | Name | Description |
---|---|---|
double | left | The left edge of the projection volume. |
double | right | The right edge of the projection volume. |
double | bottom | The bottom edge of the projection volume. |
double | top | The top edge of the projection volume. |
double | depthNear | The near edge of the projection volume. |
double | depthFar | The far edge of the projection volume. |
Matrix4d | result | The resulting Matrix4d instance. |
See Also
CreateOrthographicOffCenter(double, double, double, double, double, double)
Creates an orthographic projection matrix.
Declaration
[Pure]
public static Matrix4d CreateOrthographicOffCenter(double left, double right, double bottom, double top, double depthNear, double depthFar)
Parameters
Type | Name | Description |
---|---|---|
double | left | The left edge of the projection volume. |
double | right | The right edge of the projection volume. |
double | bottom | The bottom edge of the projection volume. |
double | top | The top edge of the projection volume. |
double | depthNear | The near edge of the projection volume. |
double | depthFar | The far edge of the projection volume. |
Returns
Type | Description |
---|---|
Matrix4d | The resulting Matrix4d instance. |
See Also
CreatePerspectiveFieldOfView(double, double, double, double, out Matrix4d)
Creates a perspective projection matrix.
Declaration
public static void CreatePerspectiveFieldOfView(double fovy, double aspect, double depthNear, double depthFar, out Matrix4d result)
Parameters
Type | Name | Description |
---|---|---|
double | fovy | Angle of the field of view in the y direction (in radians). |
double | aspect | Aspect ratio of the view (width / height). |
double | depthNear | Distance to the near clip plane. |
double | depthFar | Distance to the far clip plane. |
Matrix4d | result | A projection matrix that transforms camera space to raster space. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown under the following conditions:
|
See Also
CreatePerspectiveFieldOfView(double, double, double, double)
Creates a perspective projection matrix.
Declaration
[Pure]
public static Matrix4d CreatePerspectiveFieldOfView(double fovy, double aspect, double depthNear, double depthFar)
Parameters
Type | Name | Description |
---|---|---|
double | fovy | Angle of the field of view in the y direction (in radians). |
double | aspect | Aspect ratio of the view (width / height). |
double | depthNear | Distance to the near clip plane. |
double | depthFar | Distance to the far clip plane. |
Returns
Type | Description |
---|---|
Matrix4d | A projection matrix that transforms camera space to raster space. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown under the following conditions:
|
See Also
CreatePerspectiveOffCenter(double, double, double, double, double, double, out Matrix4d)
Creates an perspective projection matrix.
Declaration
public static void CreatePerspectiveOffCenter(double left, double right, double bottom, double top, double depthNear, double depthFar, out Matrix4d result)
Parameters
Type | Name | Description |
---|---|---|
double | left | Left edge of the view frustum. |
double | right | Right edge of the view frustum. |
double | bottom | Bottom edge of the view frustum. |
double | top | Top edge of the view frustum. |
double | depthNear | Distance to the near clip plane. |
double | depthFar | Distance to the far clip plane. |
Matrix4d | result | A projection matrix that transforms camera space to raster space. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown under the following conditions:
|
See Also
CreatePerspectiveOffCenter(double, double, double, double, double, double)
Creates an perspective projection matrix.
Declaration
[Pure]
public static Matrix4d CreatePerspectiveOffCenter(double left, double right, double bottom, double top, double depthNear, double depthFar)
Parameters
Type | Name | Description |
---|---|---|
double | left | Left edge of the view frustum. |
double | right | Right edge of the view frustum. |
double | bottom | Bottom edge of the view frustum. |
double | top | Top edge of the view frustum. |
double | depthNear | Distance to the near clip plane. |
double | depthFar | Distance to the far clip plane. |
Returns
Type | Description |
---|---|
Matrix4d | A projection matrix that transforms camera space to raster space. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown under the following conditions:
|
See Also
CreateRotationX(double, out Matrix4d)
Builds a rotation matrix for a rotation around the x-axis.
Declaration
public static void CreateRotationX(double angle, out Matrix4d result)
Parameters
Type | Name | Description |
---|---|---|
double | angle | The counter-clockwise angle in radians. |
Matrix4d | result | The resulting Matrix4d instance. |
See Also
CreateRotationX(double)
Builds a rotation matrix for a rotation around the x-axis.
Declaration
[Pure]
public static Matrix4d CreateRotationX(double angle)
Parameters
Type | Name | Description |
---|---|---|
double | angle | The counter-clockwise angle in radians. |
Returns
Type | Description |
---|---|
Matrix4d | The resulting Matrix4d instance. |
See Also
CreateRotationY(double, out Matrix4d)
Builds a rotation matrix for a rotation around the y-axis.
Declaration
public static void CreateRotationY(double angle, out Matrix4d result)
Parameters
Type | Name | Description |
---|---|---|
double | angle | The counter-clockwise angle in radians. |
Matrix4d | result | The resulting Matrix4d instance. |
See Also
CreateRotationY(double)
Builds a rotation matrix for a rotation around the y-axis.
Declaration
[Pure]
public static Matrix4d CreateRotationY(double angle)
Parameters
Type | Name | Description |
---|---|---|
double | angle | The counter-clockwise angle in radians. |
Returns
Type | Description |
---|---|
Matrix4d | The resulting Matrix4d instance. |
See Also
CreateRotationZ(double, out Matrix4d)
Builds a rotation matrix for a rotation around the z-axis.
Declaration
public static void CreateRotationZ(double angle, out Matrix4d result)
Parameters
Type | Name | Description |
---|---|---|
double | angle | The counter-clockwise angle in radians. |
Matrix4d | result | The resulting Matrix4d instance. |
See Also
CreateRotationZ(double)
Builds a rotation matrix for a rotation around the z-axis.
Declaration
[Pure]
public static Matrix4d CreateRotationZ(double angle)
Parameters
Type | Name | Description |
---|---|---|
double | angle | The counter-clockwise angle in radians. |
Returns
Type | Description |
---|---|
Matrix4d | The resulting Matrix4d instance. |
See Also
CreateTranslation(Vector3d)
Creates a translation matrix.
Declaration
[Pure]
public static Matrix4d CreateTranslation(Vector3d vector)
Parameters
Type | Name | Description |
---|---|---|
Vector3d | vector | The translation vector. |
Returns
Type | Description |
---|---|
Matrix4d | The resulting Matrix4d instance. |
See Also
CreateTranslation(in Vector3d, out Matrix4d)
Creates a translation matrix.
Declaration
public static void CreateTranslation(in Vector3d vector, out Matrix4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector3d | vector | The translation vector. |
Matrix4d | result | The resulting Matrix4d instance. |
See Also
CreateTranslation(double, double, double, out Matrix4d)
Creates a translation matrix.
Declaration
public static void CreateTranslation(double x, double y, double z, out Matrix4d result)
Parameters
Type | Name | Description |
---|---|---|
double | x | X translation. |
double | y | Y translation. |
double | z | Z translation. |
Matrix4d | result | The resulting Matrix4d instance. |
See Also
CreateTranslation(double, double, double)
Creates a translation matrix.
Declaration
[Pure]
public static Matrix4d 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 |
---|---|
Matrix4d | The resulting Matrix4d instance. |
See Also
Equals(Matrix4d)
Indicates whether the current matrix is equal to another matrix.
Declaration
[Pure]
public bool Equals(Matrix4d other)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | other | A matrix to compare with this matrix. |
Returns
Type | Description |
---|---|
bool | true if the current matrix is equal to the matrix parameter; otherwise, false. |
See Also
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
See Also
ExtractProjection()
Returns the projection component of this instance.
Declaration
public Vector4d ExtractProjection()
Returns
Type | Description |
---|---|
Vector4d | The projection. |
See Also
ExtractRotation(bool)
Returns the rotation component of this instance. Quite slow.
Declaration
[Pure]
public Quaterniond ExtractRotation(bool rowNormalize = true)
Parameters
Type | Name | Description |
---|---|---|
bool | rowNormalize | Whether the method should row-normalize (i.e. remove scale from) the Matrix. Pass false if you know it's already normalized. |
Returns
Type | Description |
---|---|
Quaterniond | The rotation. |
See Also
ExtractScale()
Returns the scale component of this instance.
Declaration
public Vector3d ExtractScale()
Returns
Type | Description |
---|---|
Vector3d | The scale. |
See Also
ExtractTranslation()
Returns the translation component of this instance.
Declaration
public Vector3d ExtractTranslation()
Returns
Type | Description |
---|---|
Vector3d | The translation. |
See Also
Frustum(double, double, double, double, double, double)
Build a projection matrix.
Declaration
[Pure]
public static Matrix4d Frustum(double left, double right, double bottom, double top, double depthNear, double depthFar)
Parameters
Type | Name | Description |
---|---|---|
double | left | Left edge of the view frustum. |
double | right | Right edge of the view frustum. |
double | bottom | Bottom edge of the view frustum. |
double | top | Top edge of the view frustum. |
double | depthNear | Distance to the near clip plane. |
double | depthFar | Distance to the far clip plane. |
Returns
Type | Description |
---|---|
Matrix4d | A projection matrix that transforms camera space to raster space. |
See Also
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
See Also
Invert()
Converts this instance into its inverse.
Declaration
public void Invert()
See Also
Invert(in Matrix4d, out Matrix4d)
Calculate the inverse of the given matrix.
Declaration
[Pure]
public static void Invert(in Matrix4d mat, out Matrix4d result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | mat | The matrix to invert. |
Matrix4d | result | The inverted matrix. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if the Matrix4d is singular. |
See Also
Invert(in Matrix4d)
Calculate the inverse of the given matrix.
Declaration
[Pure]
public static Matrix4d Invert(in Matrix4d mat)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | mat | The matrix to invert. |
Returns
Type | Description |
---|---|
Matrix4d | The inverse of the given matrix. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if the Matrix4d is singular. |
See Also
Inverted()
Returns an inverted copy of this instance.
Declaration
public Matrix4d Inverted()
Returns
Type | Description |
---|---|
Matrix4d | The inverted copy. |
See Also
LookAt(Vector3d, Vector3d, Vector3d)
Build a world space to camera space matrix.
Declaration
[Pure]
public static Matrix4d LookAt(Vector3d eye, Vector3d target, Vector3d up)
Parameters
Type | Name | Description |
---|---|---|
Vector3d | eye | Eye (camera) position in world space. |
Vector3d | target | Target position in world space. |
Vector3d | up | Up vector in world space (should not be parallel to the camera direction, that is target - eye). |
Returns
Type | Description |
---|---|
Matrix4d | A Matrix that transforms world space to camera space. |
See Also
LookAt(double, double, double, double, double, double, double, double, double)
Build a world space to camera space matrix.
Declaration
[Pure]
public static Matrix4d LookAt(double eyeX, double eyeY, double eyeZ, double targetX, double targetY, double targetZ, double upX, double upY, double upZ)
Parameters
Type | Name | Description |
---|---|---|
double | eyeX | Eye (camera) X-position in world space. |
double | eyeY | Eye (camera) Y-position in world space. |
double | eyeZ | Eye (camera) Z-position in world space. |
double | targetX | Target X-position in world space. |
double | targetY | Target Y-position in world space. |
double | targetZ | Target Z-position in world space. |
double | upX | X of the up vector in world space (should not be parallel to the camera direction, that is target - eye). |
double | upY | Y of the up vector in world space (should not be parallel to the camera direction, that is target - eye). |
double | upZ | Z of the up vector in world space (should not be parallel to the camera direction, that is target - eye). |
Returns
Type | Description |
---|---|
Matrix4d | A Matrix4 that transforms world space to camera space. |
See Also
Mult(Matrix4d, Matrix4d)
Multiplies two instances.
Declaration
[Pure]
public static Matrix4d Mult(Matrix4d left, Matrix4d right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | left | The left operand of the multiplication. |
Matrix4d | right | The right operand of the multiplication. |
Returns
Type | Description |
---|---|
Matrix4d | A new instance that is the result of the multiplication. |
See Also
Mult(Matrix4d, double)
Multiplies an instance by a scalar.
Declaration
[Pure]
public static Matrix4d Mult(Matrix4d left, double right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | left | The left operand of the multiplication. |
double | right | The right operand of the multiplication. |
Returns
Type | Description |
---|---|
Matrix4d | A new instance that is the result of the multiplication. |
See Also
Mult(in Matrix4d, in Matrix4d, out Matrix4d)
Multiplies two instances.
Declaration
public static void Mult(in Matrix4d left, in Matrix4d right, out Matrix4d result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | left | The left operand of the multiplication. |
Matrix4d | right | The right operand of the multiplication. |
Matrix4d | result | A new instance that is the result of the multiplication. |
See Also
Mult(in Matrix4d, double, out Matrix4d)
Multiplies an instance by a scalar.
Declaration
public static void Mult(in Matrix4d left, double right, out Matrix4d result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | left | The left operand of the multiplication. |
double | right | The right operand of the multiplication. |
Matrix4d | result | A new instance that is the result of the multiplication. |
See Also
Normalize()
Divides each element in the Matrix by the Determinant.
Declaration
public void Normalize()
See Also
Normalized()
Returns a normalized copy of this instance.
Declaration
public Matrix4d Normalized()
Returns
Type | Description |
---|---|
Matrix4d | The normalized copy. |
See Also
Perspective(double, double, double, double)
Build a projection matrix.
Declaration
[Pure]
public static Matrix4d Perspective(double fovy, double aspect, double depthNear, double depthFar)
Parameters
Type | Name | Description |
---|---|---|
double | fovy | Angle of the field of view in the y direction (in radians). |
double | aspect | Aspect ratio of the view (width / height). |
double | depthNear | Distance to the near clip plane. |
double | depthFar | Distance to the far clip plane. |
Returns
Type | Description |
---|---|
Matrix4d | A projection matrix that transforms camera space to raster space. |
See Also
Rotate(Quaterniond)
Build a rotation matrix from a quaternion.
Declaration
[Pure]
public static Matrix4d Rotate(Quaterniond q)
Parameters
Type | Name | Description |
---|---|---|
Quaterniond | q | The quaternion. |
Returns
Type | Description |
---|---|
Matrix4d | A rotation matrix. |
See Also
Rotate(Vector3d, double)
Build a rotation matrix to rotate about the given axis.
Declaration
[Pure]
public static Matrix4d Rotate(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 |
---|---|
Matrix4d | A rotation matrix. |
See Also
RotateX(double)
Build a rotation matrix that rotates about the x-axis.
Declaration
[Pure]
public static Matrix4d RotateX(double angle)
Parameters
Type | Name | Description |
---|---|---|
double | angle | The angle in radians to rotate counter-clockwise around the x-axis. |
Returns
Type | Description |
---|---|
Matrix4d | A rotation matrix. |
See Also
RotateY(double)
Build a rotation matrix that rotates about the y-axis.
Declaration
[Pure]
public static Matrix4d RotateY(double angle)
Parameters
Type | Name | Description |
---|---|---|
double | angle | The angle in radians to rotate counter-clockwise around the y-axis. |
Returns
Type | Description |
---|---|
Matrix4d | A rotation matrix. |
See Also
RotateZ(double)
Build a rotation matrix that rotates about the z-axis.
Declaration
[Pure]
public static Matrix4d RotateZ(double angle)
Parameters
Type | Name | Description |
---|---|---|
double | angle | The angle in radians to rotate counter-clockwise around the z-axis. |
Returns
Type | Description |
---|---|
Matrix4d | A rotation matrix. |
See Also
Scale(Vector3d)
Build a scaling matrix.
Declaration
[Pure]
public static Matrix4d Scale(Vector3d scale)
Parameters
Type | Name | Description |
---|---|---|
Vector3d | scale | Scale factors for x,y and z axes. |
Returns
Type | Description |
---|---|
Matrix4d | A scaling matrix. |
See Also
Scale(double, double, double)
Build a scaling matrix.
Declaration
[Pure]
public static Matrix4d Scale(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 |
---|---|
Matrix4d | A scaling matrix. |
See Also
Scale(double)
Build a scaling matrix.
Declaration
[Pure]
public static Matrix4d Scale(double scale)
Parameters
Type | Name | Description |
---|---|---|
double | scale | Single scale factor for x,y and z axes. |
Returns
Type | Description |
---|---|
Matrix4d | A scaling matrix. |
See Also
Subtract(Matrix4d, Matrix4d)
Subtracts one instance from another.
Declaration
[Pure]
public static Matrix4d Subtract(Matrix4d left, Matrix4d right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | left | The left operand of the subraction. |
Matrix4d | right | The right operand of the subraction. |
Returns
Type | Description |
---|---|
Matrix4d | A new instance that is the result of the subraction. |
See Also
Subtract(in Matrix4d, in Matrix4d, out Matrix4d)
Subtracts one instance from another.
Declaration
public static void Subtract(in Matrix4d left, in Matrix4d right, out Matrix4d result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | left | The left operand of the subraction. |
Matrix4d | right | The right operand of the subraction. |
Matrix4d | result | A new instance that is the result of the subraction. |
See Also
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |
Overrides
See Also
ToString(IFormatProvider)
Declaration
public string ToString(IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | formatProvider |
Returns
Type | Description |
---|---|
string |
See Also
ToString(string, IFormatProvider)
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
string | format | |
IFormatProvider | formatProvider |
Returns
Type | Description |
---|---|
string |
See Also
ToString(string)
Declaration
public string ToString(string format)
Parameters
Type | Name | Description |
---|---|---|
string | format |
Returns
Type | Description |
---|---|
string |
See Also
Transpose()
Converts this instance into its transpose.
Declaration
public void Transpose()
See Also
Transpose(Matrix4d)
Calculate the transpose of the given matrix.
Declaration
[Pure]
public static Matrix4d Transpose(Matrix4d mat)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | mat | The matrix to transpose. |
Returns
Type | Description |
---|---|
Matrix4d | The transpose of the given matrix. |
See Also
Transpose(in Matrix4d, out Matrix4d)
Calculate the transpose of the given matrix.
Declaration
public static void Transpose(in Matrix4d mat, out Matrix4d result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | mat | The matrix to transpose. |
Matrix4d | result | The result of the calculation. |
See Also
Operators
operator +(Matrix4d, Matrix4d)
Matrix addition.
Declaration
[Pure]
public static Matrix4d operator +(Matrix4d left, Matrix4d right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | left | left-hand operand. |
Matrix4d | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix4d | A new Matrix4d which holds the result of the addition. |
See Also
operator ==(Matrix4d, Matrix4d)
Compares two instances for equality.
Declaration
[Pure]
public static bool operator ==(Matrix4d left, Matrix4d right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | left | The first instance. |
Matrix4d | right | The second instance. |
Returns
Type | Description |
---|---|
bool | True, if left equals right; false otherwise. |
See Also
operator !=(Matrix4d, Matrix4d)
Compares two instances for inequality.
Declaration
[Pure]
public static bool operator !=(Matrix4d left, Matrix4d right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | left | The first instance. |
Matrix4d | right | The second instance. |
Returns
Type | Description |
---|---|
bool | True, if left does not equal right; false otherwise. |
See Also
operator *(Matrix4d, Matrix4d)
Matrix multiplication.
Declaration
[Pure]
public static Matrix4d operator *(Matrix4d left, Matrix4d right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | left | left-hand operand. |
Matrix4d | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix4d | A new Matrix4d which holds the result of the multiplication. |
See Also
operator *(Matrix4d, double)
Matrix-scalar multiplication.
Declaration
[Pure]
public static Matrix4d operator *(Matrix4d left, double right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | left | left-hand operand. |
double | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix4d | A new Matrix4d which holds the result of the multiplication. |
See Also
operator -(Matrix4d, Matrix4d)
Matrix subtraction.
Declaration
[Pure]
public static Matrix4d operator -(Matrix4d left, Matrix4d right)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | left | left-hand operand. |
Matrix4d | right | right-hand operand. |
Returns
Type | Description |
---|---|
Matrix4d | A new Matrix4d which holds the result of the subtraction. |