Mat4D
Description
A 4x4 matrix with 64-bit floating-point precision.
/ \ | M11 M12 M13 M14 | | M21 M22 M23 M24 | | M31 M32 M33 M34 | | M41 M42 M43 M44 | \ /
Public / Constructors
Rotate
2 overloads
Returns a rotation matrix (counter-clockwise around the given axis for right-handed coordinate system).
Returns a rotation matrix (counter-clockwise around the given axis for right-handed coordinate system).
RotateX
Returns a rotation matrix (counter-clockwise around X-axis for right-handed coordinate system).
RotateY
Returns a rotation matrix (counter-clockwise around Y-axis for right-handed coordinate system).
RotateZ
Returns a rotation matrix (counter-clockwise around Z-axis for right-handed coordinate system).
Warp
Computes an invertible 3D homogeneous warp matrix that transforms the given source triangle onto the specified target triangle.
The fourth row of the returned matrix will always be (0,0,0,1)
, so it is not necessary to perform the homogeneous divide. Also all elements along the main diagonal will be 1
.
Public / Methods
Mul3
2 overloads
Multiplies this matrix (left-side) with the given homogeneous 3D vector (right-side): result = this * v
.
Multiplies this matrix (left-side) with the given homogeneous 3D vector (right-side): result = this * v
.
Mul4
2 overloads
Multiplies this matrix (left-side) with the given 4D vector (right-side): result = this * v
.
Multiplies this matrix (left-side) with the given 4D vector (right-side): result = this * v
.
PerspectiveRay
Computes a ray for a screen-pixel.
This matrix must be the inverse of a combined world-view-projection matrix (for example, PerspectiveFov). The pixel coordinates (0,0)
refer to the top-left corner of the top-left screen pixel. The pixel coordinates (w,h)
refer to the bottom-right corner of the bottom-right screen pixel (where w
and h
are the screen width resp. height). If you want to cast rays for pixel centers, you have to add an offset of 0.5
to the pixel coordinates.
ToArray
Copies matrix elements to the given array.
The method uses the following indexing scheme to write values to values in:
values[offset + (row - 1) * strideRow + (col - 1) * strideCol := matrix[row, col];
where row
and col
depict the matrix row and column number (starting at 1
).
ToString
2 overloads
Returns the string representation of this matrix.
The Mat4D.ToString1 method uses FormatFlags.Precision15.
- See also