Mat2D

Description

struct Tinman.Core.Math.Vectors.Mat2D

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

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

Public / Constants

Identity


public static readonly attribute Identity → (Mat2D)

The identity matrix.

Zero


public static readonly attribute Zero → (Mat2D)

The zero matrix.

Public / Constructors

FromColumns


[Pure]
public static method FromColumns → (2)

col1 in : Vec2D

The first column vector.

col2 in : Vec2D

The second column vector.

returns → Mat2D

The matrix.

Creates a new instance of Mat2D.

FromRows


[Pure]
public static method FromRows → (2)

row1 in : Vec2D

The first row vector.

row2 in : Vec2D

The second row vector.

returns → Mat2D

The matrix.

Creates a new instance of Mat2D.

Mat2D


public constructor Mat2D → (4)

m11 in : float64

Matrix component in first row, first column.

m12 in : float64

Matrix component in first row, second column.

m21 in : float64

Matrix component in second row, first column.

m22 in : float64

Matrix component in second row, second column.

Creates a new instance of Mat2D.

Rotate


[Pure]
public static method Rotate → (1)

angle in : float64

The rotation angle, in radians.

returns → Mat2D

The resulting matrix.

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

Scale

3 overloads


[Pure]
public static method Scale1 → (1)

in : float64

The scale factor.

returns → Mat2D

The resulting matrix.

Returns a scaling matrix.


[Pure]
public static method Scale2 → (1)

in : Vec2D

The scale factors.

returns → Mat2D

The resulting matrix.

Returns a scaling matrix.


[Pure]
public static method Scale3 → (2)

fx in : float64

The scale factor along the X-axis.

fy in : float64

The scale factor along the Y-axis.

returns → Mat2D

The resulting matrix.

Returns a scaling matrix.

Public / Methods

EqualsAlmost


[Pure]
public method EqualsAlmost → (1)

other in : Mat2D

The other matrix.

returns → bool

true if both matrices are similar, false if they are not.

Checks if this matrix and the given one are similar but necessarily equal.

See also

Maths.Similar2

GetColumn


[Pure]
public method GetColumn → (1)

index in : int32

The zero-based column index.

returns → Vec2D

The column vector.

Returns a column vector.

GetRow


[Pure]
public method GetRow → (1)

index in : int32

The zero-based row index.

returns → Vec2D

The row vector.

Returns a row vector.

Mul


[Pure]
public method Mul → (1)

in : Mat2D

The matrix.

returns → Mat2D

The resulting matrix.

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

Mul1


[Pure]
public method Mul1 → (2)

in : float64

X-component of vector.

in : float64

The W-component to assume.

returns → float64

The resulting vector, scaled by 1/W if W is non-zero.

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

Mul2

2 overloads


[Pure]
public method Mul21 → (1)

in : Vec2D

The vector.

returns → Vec2D

The resulting vector.

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


[Pure]
public method Mul22 → (2)

in : float64

X-component of vector.

in : float64

Y-component of vector.

returns → Vec2D

The resulting vector.

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

ToArray


public method ToArray → (4)

values in : float64 [ ]

[not-null]
The output array.

offset opt : int32 = 0

Offset into values in to top-left matrix element.

strideRow opt : int32 = 2

Array index distance between matrix rows.

strideCol opt : int32 = 1

Array index distance between matrix columns.

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

Public / Attributes

Determinant


public attribute Determinant → (get)

value : float64

The determinant value.

Returns the determinant of this matrix.

Inverse


public attribute Inverse → (get)

value : Mat2D

The inverse matrix.

Returns the inverse of this matrix.

M11


public readonly attribute M11 → (float64)

Matrix component in first row, first column.

M12


public readonly attribute M12 → (float64)

Matrix component in first row, second column.

M21


public readonly attribute M21 → (float64)

Matrix component in second row, first column.

M22


public readonly attribute M22 → (float64)

Matrix component in second row, second column.

Transpose


public attribute Transpose → (get)

value : Mat2D

The transposed matrix.

Returns the transpose of this matrix.

Serialization

Serializer


public static readonly attribute Serializer → (ITypeSerializer<Mat2D>)

The serialization helper object for values of Mat2D.