Struct Matrix4d
Represents a 4x4 matrix containing 3D rotation, scale, transform, and projection with double-precision components.
Implements
Inherited Members
Namespace: OpenTK
Assembly: OpenTK.dll
Syntax
[Serializable]
public struct Matrix4d : IEquatable<Matrix4d>
Constructors
Matrix4d(Matrix3d)
Constructs a new instance.
Declaration
public Matrix4d(Matrix3d topLeft)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix3d | topLeft | The top left 3x3 of the matrix. |
Matrix4d(Vector4d, Vector4d, Vector4d, Vector4d)
Constructs a new instance.
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 |
Matrix4d(Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Double)
Constructs a new instance.
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 | First item of the third row. |
| Double | m30 | Fourth 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. |
Fields
Identity
The identity matrix
Declaration
public static Matrix4d Identity
Field Value
| Type | Description |
|---|---|
| Matrix4d |
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
3rd row of the matrix
Declaration
public Vector4d Row2
Field Value
| Type | Description |
|---|---|
| Vector4d |
Row3
Bottom row of the matrix
Declaration
public Vector4d Row3
Field Value
| Type | Description |
|---|---|
| Vector4d |
Properties
Column0
The first column of this matrix
Declaration
public Vector4d Column0 { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4d |
Column1
The second column of this matrix
Declaration
public Vector4d Column1 { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4d |
Column2
The third column of this matrix
Declaration
public Vector4d Column2 { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4d |
Column3
The fourth column of this matrix
Declaration
public Vector4d Column3 { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4d |
Determinant
The determinant of this matrix
Declaration
public readonly double Determinant { get; }
Property Value
| Type | Description |
|---|---|
| Double |
Diagonal
Gets or sets the values along the main diagonal of the matrix.
Declaration
public Vector4d Diagonal { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4d |
Item[Int32, Int32]
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 |
|---|---|---|
| Int32 | rowIndex | |
| Int32 | columnIndex |
Property Value
| Type | Description |
|---|---|
| Double |
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 |
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 |
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 |
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 |
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 |
Trace
Gets the trace of the matrix, the sum of the values along the diagonal.
Declaration
public readonly double Trace { get; }
Property Value
| Type | Description |
|---|---|
| Double |
Methods
Add(Matrix4d, Matrix4d)
Adds two instances.
Declaration
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. |
Add(ref Matrix4d, ref Matrix4d, out Matrix4d)
Adds two instances.
Declaration
public static void Add(ref Matrix4d left, ref 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. |
ClearProjection()
Returns a copy of this Matrix4d without projection.
Declaration
public Matrix4d ClearProjection()
Returns
| Type | Description |
|---|---|
| Matrix4d |
ClearRotation()
Returns a copy of this Matrix4d without rotation.
Declaration
public Matrix4d ClearRotation()
Returns
| Type | Description |
|---|---|
| Matrix4d |
ClearScale()
Returns a copy of this Matrix4d without scale.
Declaration
public Matrix4d ClearScale()
Returns
| Type | Description |
|---|---|
| Matrix4d |
ClearTranslation()
Returns a copy of this Matrix4d without translation.
Declaration
public Matrix4d ClearTranslation()
Returns
| Type | Description |
|---|---|
| Matrix4d |
CreateFromAxisAngle(Vector3d, Double)
Build a rotation matrix from the specified axis/angle rotation.
Declaration
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. |
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. |
CreateFromQuaternion(Quaterniond)
Builds a rotation matrix from a quaternion.
Declaration
public static Matrix4d CreateFromQuaternion(Quaterniond q)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaterniond | q | The quaternion to rotate by. |
Returns
| Type | Description |
|---|---|
| Matrix4d | A matrix instance. |
CreateFromQuaternion(ref Quaterniond, out Matrix4d)
Build a rotation matrix from the specified quaternion.
Declaration
public static void CreateFromQuaternion(ref Quaterniond q, out Matrix4d result)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaterniond | q | Quaternion to translate. |
| Matrix4d | result | Matrix result. |
CreateOrthographic(Double, Double, Double, Double)
Creates an orthographic projection matrix.
Declaration
public static Matrix4d CreateOrthographic(double width, double height, double zNear, double zFar)
Parameters
| Type | Name | Description |
|---|---|---|
| Double | width | The width of the projection volume. |
| Double | height | The height of the projection volume. |
| Double | zNear | The near edge of the projection volume. |
| Double | zFar | The far edge of the projection volume. |
Returns
| Type | Description |
|---|---|
| Matrix4d |
CreateOrthographic(Double, Double, Double, Double, out Matrix4d)
Creates an orthographic projection matrix.
Declaration
public static void CreateOrthographic(double width, double height, double zNear, double zFar, out Matrix4d result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double | width | The width of the projection volume. |
| Double | height | The height of the projection volume. |
| Double | zNear | The near edge of the projection volume. |
| Double | zFar | The far edge of the projection volume. |
| Matrix4d | result | The resulting Matrix4d instance. |
CreateOrthographicOffCenter(Double, Double, Double, Double, Double, Double)
Creates an orthographic projection matrix.
Declaration
public static Matrix4d CreateOrthographicOffCenter(double left, double right, double bottom, double top, double zNear, double zFar)
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 | zNear | The near edge of the projection volume. |
| Double | zFar | The far edge of the projection volume. |
Returns
| Type | Description |
|---|---|
| Matrix4d | The resulting Matrix4d instance. |
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 zNear, double zFar, 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 | zNear | The near edge of the projection volume. |
| Double | zFar | The far edge of the projection volume. |
| Matrix4d | result | The resulting Matrix4d instance. |
CreatePerspectiveFieldOfView(Double, Double, Double, Double)
Creates a perspective projection matrix.
Declaration
public static Matrix4d CreatePerspectiveFieldOfView(double fovy, double aspect, double zNear, double zFar)
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 | zNear | Distance to the near clip plane |
| Double | zFar | 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: |
CreatePerspectiveFieldOfView(Double, Double, Double, Double, out Matrix4d)
Creates a perspective projection matrix.
Declaration
public static void CreatePerspectiveFieldOfView(double fovy, double aspect, double zNear, double zFar, 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 | zNear | Distance to the near clip plane |
| Double | zFar | 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: |
CreatePerspectiveOffCenter(Double, Double, Double, Double, Double, Double)
Creates an perspective projection matrix.
Declaration
public static Matrix4d CreatePerspectiveOffCenter(double left, double right, double bottom, double top, double zNear, double zFar)
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 | zNear | Distance to the near clip plane |
| Double | zFar | 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: |
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 zNear, double zFar, 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 | zNear | Distance to the near clip plane |
| Double | zFar | 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: |
CreateRotationX(Double)
Builds a rotation matrix for a rotation around the x-axis.
Declaration
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. |
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. |
CreateRotationY(Double)
Builds a rotation matrix for a rotation around the y-axis.
Declaration
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. |
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. |
CreateRotationZ(Double)
Builds a rotation matrix for a rotation around the z-axis.
Declaration
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. |
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. |
CreateTranslation(Vector3d)
Creates a translation matrix.
Declaration
public static Matrix4d CreateTranslation(Vector3d vector)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3d | vector | The translation vector. |
Returns
| Type | Description |
|---|---|
| Matrix4d | The resulting Matrix4d instance. |
CreateTranslation(ref Vector3d, out Matrix4d)
Creates a translation matrix.
Declaration
public static void CreateTranslation(ref Vector3d vector, out Matrix4d result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3d | vector | The translation vector. |
| Matrix4d | result | The resulting Matrix4d instance. |
CreateTranslation(Double, Double, Double)
Creates a translation matrix.
Declaration
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. |
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. |
Equals(Matrix4d)
Indicates whether the current matrix is equal to another matrix.
Declaration
public bool Equals(Matrix4d other)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix4d | other | A 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 to. |
Returns
| Type | Description |
|---|---|
| Boolean | True if the instances are equal; false otherwise. |
Overrides
ExtractProjection()
Returns the projection component of this instance.
Declaration
public Vector4d ExtractProjection()
Returns
| Type | Description |
|---|---|
| Vector4d |
ExtractRotation(Boolean)
Returns the rotation component of this instance. Quite slow.
Declaration
public Quaterniond ExtractRotation(bool row_normalise = true)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | row_normalise | Whether the method should row-normalise (i.e. remove scale from) the Matrix. Pass false if you know it's already normalised. |
Returns
| Type | Description |
|---|---|
| Quaterniond |
ExtractScale()
Returns the scale component of this instance.
Declaration
public Vector3d ExtractScale()
Returns
| Type | Description |
|---|---|
| Vector3d |
ExtractTranslation()
Returns the translation component of this instance.
Declaration
public Vector3d ExtractTranslation()
Returns
| Type | Description |
|---|---|
| Vector3d |
Frustum(Double, Double, Double, Double, Double, Double)
Build a projection matrix
Declaration
public static Matrix4d Frustum(double left, double right, double bottom, double top, double near, double far)
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 | near | Distance to the near clip plane |
| Double | far | Distance to the far clip plane |
Returns
| Type | Description |
|---|---|
| Matrix4d | A projection matrix that transforms camera space to raster space |
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 its inverse.
Declaration
public void Invert()
Invert(Matrix4d)
Calculate the inverse of the given matrix
Declaration
public static Matrix4d Invert(Matrix4d mat)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix4d | mat | The matrix to invert |
Returns
| Type | Description |
|---|---|
| Matrix4d | The inverse of the given matrix if it has one, or the input if it is singular |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown if the Matrix4d is singular. |
Inverted()
Returns an inverted copy of this instance.
Declaration
public Matrix4d Inverted()
Returns
| Type | Description |
|---|---|
| Matrix4d |
LookAt(Vector3d, Vector3d, Vector3d)
Build a world space to camera space matrix
Declaration
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 |
LookAt(Double, Double, Double, Double, Double, Double, Double, Double, Double)
Build a world space to camera space matrix
Declaration
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) position in world space |
| Double | eyeY | Eye (camera) position in world space |
| Double | eyeZ | Eye (camera) position in world space |
| Double | targetX | Target position in world space |
| Double | targetY | Target position in world space |
| Double | targetZ | Target position in world space |
| Double | upX | Up vector in world space (should not be parallel to the camera direction, that is target - eye) |
| Double | upY | Up vector in world space (should not be parallel to the camera direction, that is target - eye) |
| Double | upZ | 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 |
Mult(Matrix4d, Matrix4d)
Multiplies two instances.
Declaration
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 |
Mult(Matrix4d, Double)
Multiplies an instance by a scalar.
Declaration
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 |
Mult(ref Matrix4d, ref Matrix4d, out Matrix4d)
Multiplies two instances.
Declaration
public static void Mult(ref Matrix4d left, ref 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 |
Mult(ref Matrix4d, Double, out Matrix4d)
Multiplies an instance by a scalar.
Declaration
public static void Mult(ref 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 |
Normalize()
Divides each element in the Matrix by the Determinant.
Declaration
public void Normalize()
Normalized()
Returns a normalised copy of this instance.
Declaration
public Matrix4d Normalized()
Returns
| Type | Description |
|---|---|
| Matrix4d |
Perspective(Double, Double, Double, Double)
Build a projection matrix
Declaration
public static Matrix4d Perspective(double fovy, double aspect, double near, double far)
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 | near | Distance to the near clip plane |
| Double | far | Distance to the far clip plane |
Returns
| Type | Description |
|---|---|
| Matrix4d | A projection matrix that transforms camera space to raster space |
Rotate(Quaterniond)
Build a rotation matrix from a quaternion
Declaration
public static Matrix4d Rotate(Quaterniond q)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaterniond | q | the quaternion |
Returns
| Type | Description |
|---|---|
| Matrix4d | A rotation matrix |
Rotate(Vector3d, Double)
Build a rotation matrix to rotate about the given axis
Declaration
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 |
RotateX(Double)
Build a rotation matrix that rotates about the x-axis
Declaration
public static Matrix4d RotateX(double angle)
Parameters
| Type | Name | Description |
|---|---|---|
| Double | angle | angle in radians to rotate counter-clockwise around the x-axis |
Returns
| Type | Description |
|---|---|
| Matrix4d | A rotation matrix |
RotateY(Double)
Build a rotation matrix that rotates about the y-axis
Declaration
public static Matrix4d RotateY(double angle)
Parameters
| Type | Name | Description |
|---|---|---|
| Double | angle | angle in radians to rotate counter-clockwise around the y-axis |
Returns
| Type | Description |
|---|---|
| Matrix4d | A rotation matrix |
RotateZ(Double)
Build a rotation matrix that rotates about the z-axis
Declaration
public static Matrix4d RotateZ(double angle)
Parameters
| Type | Name | Description |
|---|---|---|
| Double | angle | angle in radians to rotate counter-clockwise around the z-axis |
Returns
| Type | Description |
|---|---|
| Matrix4d | A rotation matrix |
Scale(Vector3d)
Build a scaling matrix
Declaration
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 |
Scale(Double)
Build a scaling matrix
Declaration
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 |
Scale(Double, Double, Double)
Build a scaling matrix
Declaration
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 |
Subtract(Matrix4d, Matrix4d)
Subtracts one instance from another.
Declaration
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. |
Subtract(ref Matrix4d, ref Matrix4d, out Matrix4d)
Subtracts one instance from another.
Declaration
public static void Subtract(ref Matrix4d left, ref 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. |
ToString()
Returns a System.String that represents the current Matrix44.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| String |
Overrides
Transpose()
Converts this instance into its transpose.
Declaration
public void Transpose()
Transpose(Matrix4d)
Calculate the transpose of the given matrix
Declaration
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 |
Transpose(ref Matrix4d, out Matrix4d)
Calculate the transpose of the given matrix
Declaration
public static void Transpose(ref Matrix4d mat, out Matrix4d result)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix4d | mat | The matrix to transpose |
| Matrix4d | result | The result of the calculation |
Operators
Addition(Matrix4d, Matrix4d)
Matrix addition
Declaration
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 |
Equality(Matrix4d, Matrix4d)
Compares two instances for equality.
Declaration
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 |
|---|---|
| Boolean | True, if left equals right; false otherwise. |
Inequality(Matrix4d, Matrix4d)
Compares two instances for inequality.
Declaration
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 |
|---|---|
| Boolean | True, if left does not equal right; false otherwise. |
Multiply(Matrix4d, Matrix4d)
Matrix multiplication
Declaration
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 |
Multiply(Matrix4d, Single)
Matrix-scalar multiplication
Declaration
public static Matrix4d operator *(Matrix4d left, float right)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix4d | left | left-hand operand |
| Single | right | right-hand operand |
Returns
| Type | Description |
|---|---|
| Matrix4d | A new Matrix4d which holds the result of the multiplication |
Subtraction(Matrix4d, Matrix4d)
Matrix subtraction
Declaration
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 |