Mat3F

Description

struct Tinman.Core.Math.Vectors.Mat3F

A 3x3 matrix with 32-bit floating-point precision.

/                 \
|  M11  M12  M13  |
|  M21  M22  M23  |
|  M31  M32  M33  |
\                 /

Public / Constants

Identity


public static readonly attribute Identity → (Mat3F)

The identity matrix.

Zero


public static readonly attribute Zero → (Mat3F)

The zero matrix.

Public / Constructors

From​Columns


[Pure]
public static method FromColumns → (3)

col1 in : Vec3F

The first column vector.

col2 in : Vec3F

The second column vector.

col3 in : Vec3F

The third column vector.

returns → Mat3F

The matrix.

Creates a new instance of Mat3F.

From​Rows


[Pure]
public static method FromRows → (3)

row1 in : Vec3F

The first row vector.

row2 in : Vec3F

The second row vector.

row3 in : Vec3F

The third row vector.

returns → Mat3F

The matrix.

Creates a new instance of Mat3F.

Mat3​F


public constructor Mat3F → (9)

m11 in : float32

Matrix component in first row, first column.

m12 in : float32

Matrix component in first row, second column.

m13 in : float32

Matrix component in first row, third column.

m21 in : float32

Matrix component in second row, first column.

m22 in : float32

Matrix component in second row, second column.

m23 in : float32

Matrix component in second row, third column.

m31 opt : float32 = 0

Matrix component in third row, first column.

m32 opt : float32 = 0

Matrix component in third row, second column.

m33 opt : float32 = 1

Matrix component in third row, third column.

Creates a new instance of Mat3F.

Rotate

2 overloads


[Pure]
public static method Rotate1 → (2)

axis in : Vec3F

Unit-length rotation axis vector.

angle in : float32

The rotation angle, in radians.

returns → Mat3F

The resulting matrix.

Returns a rotation matrix (counter-clockwise around the given axis for right-handed coordinate system).


[Pure]
public static method Rotate2 → (4)

in : float32

X-component of unit-length rotation axis vector.

in : float32

Y-component of unit-length rotation axis vector.

in : float32

Z-component of unit-length rotation axis vector.

angle in : float32

The rotation angle, in radians.

returns → Mat3F

The resulting matrix.

Returns a rotation matrix (counter-clockwise around the given axis for right-handed coordinate system).

Rotate​X


[Pure]
public static method RotateX → (1)

angle in : float32

The rotation angle, in radians.

returns → Mat3F

The resulting matrix.

Returns a rotation matrix (counter-clockwise around X-axis for right-handed coordinate system).

Rotate​Y


[Pure]
public static method RotateY → (1)

angle in : float32

The rotation angle, in radians.

returns → Mat3F

The resulting matrix.

Returns a rotation matrix (counter-clockwise around Y-axis for right-handed coordinate system).

Rotate​Z


[Pure]
public static method RotateZ → (1)

angle in : float32

The rotation angle, in radians.

returns → Mat3F

The resulting matrix.

Returns a rotation matrix (counter-clockwise around Z-axis for right-handed coordinate system).

Scale

3 overloads


[Pure]
public static method Scale1 → (1)

in : float32

The scale factor.

returns → Mat3F

The resulting matrix.

Returns a scaling matrix.


[Pure]
public static method Scale2 → (1)

in : Vec3F

The scale factors.

returns → Mat3F

The resulting matrix.

Returns a scaling matrix.


[Pure]
public static method Scale3 → (3)

fx in : float32

The scale factor along the X-axis.

fy in : float32

The scale factor along the Y-axis.

fz in : float32

The scale factor along the Z-axis.

returns → Mat3F

The resulting matrix.

Returns a scaling matrix.

Tangent​Space


[Pure]
public static method TangentSpace → (4)

in : Vec3F

The vector in object space to map to the tangent space X-axis.

in : Vec3F

The vector in object space to map to the tangent space Y-axis.

in : Vec3F

The vector in object space to map to the tangent space Z-axis.

orthogonalize opt : int32 = 0

Depicts how to orthogonalize the tangent space vectors:

  • 0: Skip orthogonalization, only normalize to unit-length.

  • 1: in, in, in

  • 2: in, in, in

  • 3: in, in, in

  • 4: in, in, in

  • 5: in, in, in

  • 6: in, in, in

The first tangent space basis vector will be normalized to unit-length. The second and third tangent space basis vectors will be orthogonalized using the Gram-Schmidt algorithm and then normalized to unit-length (except 0 is given).

returns → Mat3F

The resulting matrix:

    / x'.x  y'.x  z'.x \
M = | x'.y  y'.y  z'.y |
    \ x'.z  y'.z  z'.z /

where x', y' and z' are the normalized and orthogonalized tangent space basis vectors.

Returns a matrix that transforms from tangent space to object space.

Translate

2 overloads


[Pure]
public static method Translate1 → (1)

in : Vec2F

The 2D translation vector.

returns → Mat3F

The resulting matrix.

Returns a homogeneous 2D translation matrix.


[Pure]
public static method Translate2 → (2)

in : float32

X-component of translation vector.

in : float32

Y-component of translation vector.

returns → Mat3F

The resulting matrix.

Returns a homogeneous 2D translation matrix.

Warp


[Pure]
public static method Warp → (4)

in : Vec2F

First vertex of convex quadrilateral.

in : Vec2F

Second vertex of convex quadrilateral.

in : Vec2F

Third vertex of convex quadrilateral.

in : Vec2F

Fourth vertex of convex quadrilateral.

returns → Mat3F

The homogeneous 2D warp matrix.

Computes a 2D homogeneous warp matrix that transforms the unit square into a convex quadrilateral.

The unit square is defined as follows:

A ---- B     A := (0|0)
|      |     B := (1|0)
|      |     C := (1|1)
D ---- C     D := (0|1)

Use the inverse warp matrix to transform vertices to the unit square. Combine two warp matrices to transform from one quadrilateral to another.

Public / Methods

Equals​Almost


[Pure]
public method EqualsAlmost → (1)

other in : Mat3F

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

Get​Column


[Pure]
public method GetColumn → (1)

index in : int32

The zero-based column index.

returns → Vec3F

The column vector.

Returns a column vector.

Get​Row


[Pure]
public method GetRow → (1)

index in : int32

The zero-based row index.

returns → Vec3F

The row vector.

Returns a row vector.

Mul


[Pure]
public method Mul → (1)

in : Mat3F

The matrix.

returns → Mat3F

The resulting matrix.

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

Mul2

3 overloads


[Pure]
public method Mul21 → (2)

in : Vec2F

The vector.

in : float32

The W-component to assume.

returns → Vec2F

The resulting vector, scaled by 1/result.W.

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


[Pure]
public method Mul22 → (3)

in : float32

X-component of vector.

in : float32

Y-component of vector.

in : float32

The W-component to assume.

returns → Vec2F

The resulting vector, scaled by 1/result.W.

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


[Pure]
public method Mul23 → (4)

in : float32

X-component of vector.

in : float32

Y-component of vector.

dx out : Vec2F

The partial derivative vector along the X-axis.

dy out : Vec2F

The partial derivative vector along the Y-axis.

returns → Vec2F

The resulting point.

Multiplies this matrix (left-side) with the given 2D point (right-side), assuming a homogeneous W-coordinate of 1 and computes the partial derivatives: result = this * v.

Mul3

2 overloads


[Pure]
public method Mul31 → (1)

in : Vec3F

The vector.

returns → Vec3F

The resulting vector.

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


[Pure]
public method Mul32 → (3)

in : float32

X-component of vector.

in : float32

Y-component of vector.

in : float32

Z-component of vector.

returns → Vec3F

The resulting vector.

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

Orthogonalize


public static method Orthogonalize → (3)

normal ref : Vec3F

Normal vector (will be normalized only).

tangent ref : Vec3F

Tangent vector.

bitangent ref : Vec3F

Bitangent vector.

Orthogonalizes the given vectors using the Gram-Schmidt algorithm.

To​Array


public method ToArray → (4)

values in : float32 [ ]

[not-null]
The output array.

offset opt : int32 = 0

Offset into values in to top-left matrix element.

strideRow opt : int32 = 3

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 : float32

The determinant value.

Returns the determinant of this matrix.

Inverse


public attribute Inverse → (get)

value : Mat3F

The inverse matrix.

Returns the inverse of this matrix.

M11


public readonly attribute M11 → (float32)

Matrix component in first row, first column.

M12


public readonly attribute M12 → (float32)

Matrix component in first row, second column.

M13


public readonly attribute M13 → (float32)

Matrix component in first row, third column.

M21


public readonly attribute M21 → (float32)

Matrix component in second row, first column.

M22


public readonly attribute M22 → (float32)

Matrix component in second row, second column.

M23


public readonly attribute M23 → (float32)

Matrix component in second row, third column.

M31


public readonly attribute M31 → (float32)

Matrix component in third row, first column.

M32


public readonly attribute M32 → (float32)

Matrix component in third row, second column.

M33


public readonly attribute M33 → (float32)

Matrix component in third row, third column.

Transpose


public attribute Transpose → (get)

value : Mat3F

The transposed matrix.

Returns the transpose of this matrix.

Serialization

Serializer


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

The serialization helper object for values of Mat3F.