TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

struct Mat4F in Tinman.Core.Math.Vectors

A 4x4 matrix with 64-bit floating-point precision.

struct Mat4F implements IEquatable<Mat4F>

Remarks

/                      \
|  M11  M12  M13  M14  |
|  M21  M22  M23  M24  |
|  M31  M32  M33  M34  |
|  M41  M42  M43  M44  |
\                      /

Serialization

Serializer

The serialization helper object for values of Mat4F.

public static readonly field Serializer
type ITypeSerializer<Mat4F>

Public / Constants

Identity

The identity matrix.

public static readonly field Identity
type Mat4F

Zero

The zero matrix.

public static readonly field Zero
type Mat4F

Public / Attributes

Determinant

Returns the determinant of this matrix.

public property Determinant { get }
type float32
value The determinant value.

Inverse

Returns the inverse of this matrix.

public property Inverse { get }
type Mat4F
value The inverse matrix.

M11

Matrix component in first row, first column.

public readonly field M11
type float32

M12

Matrix component in first row, second column.

public readonly field M12
type float32

M13

Matrix component in first row, third column.

public readonly field M13
type float32

M14

Matrix component in first row, fourth column.

public readonly field M14
type float32

M21

Matrix component in second row, first column.

public readonly field M21
type float32

M22

Matrix component in second row, second column.

public readonly field M22
type float32

M23

Matrix component in second row, third column.

public readonly field M23
type float32

M24

Matrix component in second row, fourth column.

public readonly field M24
type float32

M31

Matrix component in third row, first column.

public readonly field M31
type float32

M32

Matrix component in third row, second column.

public readonly field M32
type float32

M33

Matrix component in third row, third column.

public readonly field M33
type float32

M34

Matrix component in third row, fourth column.

public readonly field M34
type float32

M41

Matrix component in fourth row, first column.

public readonly field M41
type float32

M42

Matrix component in fourth row, second column.

public readonly field M42
type float32

M43

Matrix component in fourth row, third column.

public readonly field M43
type float32

M44

Matrix component in fourth row, fourth column.

public readonly field M44
type float32

Transpose

Returns the transpose of this matrix.

public property Transpose { get }
type Mat4F
value The transposed matrix.

Public / Constructors

Mat4F

Creates a new instance of Mat4F.

public constructor Mat4F (float32 m11, float32 m12, float32 m13, float32 m14, float32 m21, float32 m22, float32 m23, float32 m24, float32 m31, float32 m32, float32 m33, float32 m34, float32 m41, float32 m42, float32 m43, float32 m44)
params m11 Matrix component in first row, first column.
  m12 Matrix component in first row, second column.
  m13 Matrix component in first row, third column.
  m14 Matrix component in first row, fourth column.
  m21 Matrix component in second row, first column.
  m22 Matrix component in second row, second column.
  m23 Matrix component in second row, third column.
  m24 Matrix component in second row, fourth column.
  m31 Matrix component in third row, first column.
  m32 Matrix component in third row, second column.
  m33 Matrix component in third row, third column.
  m34 Matrix component in third row, fourth column.
  m41 Matrix component in fourth row, first column.
  m42 Matrix component in fourth row, second column.
  m43 Matrix component in fourth row, third column.
  m44 Matrix component in fourth row, fourth column.

Public / Methods

Equals

public method Equals (Mat4F other)
type bool
params other

EqualsAlmost

public method EqualsAlmost (Mat4F other)
type bool
params other

Lerp

Performs a component-wise linear interpolation between this matrix and the given one.

[Pure]
public method Lerp (Mat4F other, float32 factor)
type Mat4F
params other The other matrix.
  factor The interpolation factor (0: this, 1: other).
returns The resulting matrix.

Mul

Multiplies this matrix (left-side) with the given one (right-side): result = this * m.

[Pure]
public method Mul (Mat4F m)
type Mat4F
params m The matrix.
returns The resulting matrix.

Mul3

Multiplies this matrix (left-side) with the given 3D vector (right-side): result = this * v.

[Pure]
public method Mul3 (Vec3F v, float32 w)
type Vec3F
params v The vector.
  w The W-component to assume.
returns The resulting vector, scaled by 1/result.W.

Multiplies this matrix (left-side) with the given 3D vector (right-side): result = this * v.

[Pure]
public method Mul3 (float32 x, float32 y, float32 z, float32 w)
type Vec3F
params x X-component of vector.
  y Y-component of vector.
  z Z-component of vector.
  w The W-component to assume.
returns The resulting vector, scaled by 1/result.W.

Mul4

Multiplies this matrix (left-side) with the given 4F vector (right-side): result = this * v.

[Pure]
public method Mul4 (Vec4F v)
type Vec4F
params v The vector.
returns The resulting vector.

Multiplies this matrix (left-side) with the given 4F vector (right-side): result = this * v.

[Pure]
public method Mul4 (float32 x, float32 y, float32 z, float32 w)
type Vec4F
params x X-component of vector.
  y Y-component of vector.
  z Z-component of vector.
  w W-component of vector.
returns The resulting vector.

Rotate

public static method Rotate (Vec3F axis, float32 angle)
type Mat4F
params axis
  angle

public static method Rotate (float32 x, float32 y, float32 z, float32 angle)
type Mat4F
params x
  y
  z
  angle

RotateX

Returns a rotation matrix (counter-clockwise around X-axis).

public static method RotateX (float32 angle)
type Mat4F
params angle The rotation angle, in radians.
returns The resulting matrix.

RotateY

Returns a rotation matrix (counter-clockwise around Y-axis).

public static method RotateY (float32 angle)
type Mat4F
params angle The rotation angle, in radians.
returns The resulting matrix.

RotateZ

Returns a rotation matrix (counter-clockwise around Z-axis).

public static method RotateZ (float32 angle)
type Mat4F
params angle The rotation angle, in radians.
returns The resulting matrix.

Scale

Returns a scaling matrix.

public static method Scale (float32 f)
type Mat4F
params f The scale factor.
returns The resulting matrix.

Returns a scaling matrix.

public static method Scale (Vec4F f)
type Mat4F
params f The scale factors.
returns The resulting matrix.

Returns a scaling matrix.

public static method Scale (float32 fx, float32 fy, float32 fz, float32 fw)
type Mat4F
params fx The scale factor along the X-axis.
  fy The scale factor along the Y-axis.
  fz The scale factor along the Z-axis.
  fw The scale factor along the W-axis.
returns The resulting matrix.

ToArray

Copies matrix elements to the given array.

[Pure]
public method ToArray ([] float32[] values, int32 offset = 0, int32 strideRow = 4, int32 strideCol = 1)
params values [not-null] The output array.
  offset Offset into values to top-left matrix element. Defaults to 0.
  strideRow Array index distance between matrix rows. Defaults to 4.
  strideCol Array index distance between matrix columns. Defaults to 1.

Remarks:

The method uses the following indexing scheme to write values to values:

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).

Translate

Returns a translation matrix.

public static method Translate (Vec3F v)
type Mat4F
params v The translation vector.
returns The translation matrix.

Returns a translation matrix.

public static method Translate (float32 x, float32 y, float32 z)
type Mat4F
params x X-component of translation vector.
  y Y-component of translation vector.
  z Z-component of translation vector.
returns The translation matrix.