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

struct Mat2F in Tinman.Core.Math.Vectors

A 2x2 matrix with 32-bit floating-point precision.

struct Mat2F implements IEquatable<Mat2F>

Remarks

/            \
|  M11  M12  |
|  M21  M22  |
\            /

Serialization

Serializer

The serialization helper object for values of Mat2F.

public static readonly field Serializer
type ITypeSerializer<Mat2F>

Public / Constants

Identity

The identity matrix.

public static readonly field Identity
type Mat2F

Zero

The zero matrix.

public static readonly field Zero
type Mat2F

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 Mat2F
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

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

Transpose

Returns the transpose of this matrix.

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

Public / Constructors

Mat2F

Creates a new instance of Mat2F.

public constructor Mat2F (float32 m11, float32 m12, float32 m21, float32 m22)
params m11 Matrix component in first row, first column.
  m12 Matrix component in first row, second column.
  m21 Matrix component in second row, first column.
  m22 Matrix component in second row, second column.

Public / Methods

Equals

public method Equals (Mat2F other)
type bool
params other

EqualsAlmost

public method EqualsAlmost (Mat2F other)
type bool
params other

Mul

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

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

Mul1

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

[Pure]
public method Mul1 (float32 x, float32 w)
type float64
params x X-component of vector.
  w The W-component to assume.
returns The resulting vector, scaled by 1/W if W is non-zero.

Mul2

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

[Pure]
public method Mul2 (Vec2F v)
type Vec2F
params v The vector.
returns The resulting vector.

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

[Pure]
public method Mul2 (float32 x, float32 y)
type Vec2F
params x X-component of vector.
  y Y-component of vector.
returns The resulting vector.

Rotate

Returns a rotation matrix (counter-clockwise around origin).

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

Scale

Returns a scaling matrix.

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

Returns a scaling matrix.

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

Returns a scaling matrix.

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

ToArray

Copies matrix elements to the given array.

[Pure]
public method ToArray ([] float32[] values, int32 offset = 0, int32 strideRow = 2, 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).