Mat3D

Description

struct Tinman.Core.Math.Vectors.Mat3D

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

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

Public / Constants

Identity


public static readonly attribute Identity → (Mat3D)

The identity matrix.

Zero


public static readonly attribute Zero → (Mat3D)

The zero matrix.

Public / Constructors

From​Columns


[Pure]
public static method FromColumns → (3)

col1 in : Vec3D

The first column vector.

col2 in : Vec3D

The second column vector.

col3 in : Vec3D

The third column vector.

returns → Mat3D

The matrix.

Creates a new instance of Mat3D.

From​Rows


[Pure]
public static method FromRows → (3)

row1 in : Vec3D

The first row vector.

row2 in : Vec3D

The second row vector.

row3 in : Vec3D

The third row vector.

returns → Mat3D

The matrix.

Creates a new instance of Mat3D.

Mat3​D


public constructor Mat3D → (9)

m11 in : float64

Matrix component in first row, first column.

m12 in : float64

Matrix component in first row, second column.

m13 in : float64

Matrix component in first row, third column.

m21 in : float64

Matrix component in second row, first column.

m22 in : float64

Matrix component in second row, second column.

m23 in : float64

Matrix component in second row, third column.

m31 opt : float64 = 0

Matrix component in third row, first column.

m32 opt : float64 = 0

Matrix component in third row, second column.

m33 opt : float64 = 1

Matrix component in third row, third column.

Creates a new instance of Mat3D.

Rotate

2 overloads


[Pure]
public static method Rotate1 → (2)

axis in : Vec3D

Unit-length rotation axis vector.

angle in : float64

The rotation angle, in radians.

returns → Mat3D

The resulting matrix.

Returns a rotation matrix (counter-clockwise around the given axis for right-handed coordinate system when viewing from positive half-space).


[Pure]
public static method Rotate2 → (4)

in : float64

X-component of unit-length rotation axis vector.

in : float64

Y-component of unit-length rotation axis vector.

in : float64

Z-component of unit-length rotation axis vector.

angle in : float64

The rotation angle, in radians.

returns → Mat3D

The resulting matrix.

Returns a rotation matrix (counter-clockwise around the given axis for right-handed coordinate system when viewing from positive half-space).

Rotate​X


[Pure]
public static method RotateX → (1)

angle in : float64

The rotation angle, in radians.

returns → Mat3D

The resulting matrix.

Returns a rotation matrix (counter-clockwise around X-axis for right-handed coordinate system when viewing from positive half-space).

Rotate​Y


[Pure]
public static method RotateY → (1)

angle in : float64

The rotation angle, in radians.

returns → Mat3D

The resulting matrix.

Returns a rotation matrix (counter-clockwise around Y-axis for right-handed coordinate system when viewing from positive half-space).

Rotate​Z


[Pure]
public static method RotateZ → (1)

angle in : float64

The rotation angle, in radians.

returns → Mat3D

The resulting matrix.

Returns a rotation matrix (counter-clockwise around Z-axis for right-handed coordinate system when viewing from positive half-space).

Scale

3 overloads


[Pure]
public static method Scale1 → (1)

in : float64

The scale factor.

returns → Mat3D

The resulting matrix.

Returns a scaling matrix.


[Pure]
public static method Scale2 → (1)

in : Vec3D

The scale factors.

returns → Mat3D

The resulting matrix.

Returns a scaling matrix.


[Pure]
public static method Scale3 → (3)

fx in : float64

The scale factor along the X-axis.

fy in : float64

The scale factor along the Y-axis.

fz in : float64

The scale factor along the Z-axis.

returns → Mat3D

The resulting matrix.

Returns a scaling matrix.

Tangent​Space


[Pure]
public static method TangentSpace → (4)

in : Vec3D

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

in : Vec3D

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

in : Vec3D

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 → Mat3D

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

The 2D translation vector.

returns → Mat3D

The resulting matrix.

Returns a homogeneous 2D translation matrix.


[Pure]
public static method Translate2 → (2)

in : float64

X-component of translation vector.

in : float64

Y-component of translation vector.

returns → Mat3D

The resulting matrix.

Returns a homogeneous 2D translation matrix.

Warp


[Pure]
public static method Warp → (4)

in : Vec2D

First vertex of convex quadrilateral.

in : Vec2D

Second vertex of convex quadrilateral.

in : Vec2D

Third vertex of convex quadrilateral.

in : Vec2D

Fourth vertex of convex quadrilateral.

returns → Mat3D

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

Orthogonalize


public static method Orthogonalize → (3)

normal ref : Vec3D

Normal vector (will be normalized only).

tangent ref : Vec3D

Tangent vector.

bitangent ref : Vec3D

Bitangent vector.

Orthogonalizes the given vectors using the Gram-Schmidt algorithm.

Public / Attributes

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.

M13


public readonly attribute M13 → (float64)

Matrix component in first row, third 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.

M23


public readonly attribute M23 → (float64)

Matrix component in second row, third column.

M31


public readonly attribute M31 → (float64)

Matrix component in third row, first column.

M32


public readonly attribute M32 → (float64)

Matrix component in third row, second column.

M33


public readonly attribute M33 → (float64)

Matrix component in third row, third column.

Serialization

Serializer


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

The serialization helper object for values of Mat3D.