A 3x3 matrix with 64-bit floating-point precision.
struct
|
Mat3D
|
implements
|
IEquatable<Mat3D>
|
/ \ | M11 M12 M13 | | M21 M22 M23 | | M31 M32 M33 | \ /
The serialization helper object for values of Mat3D.
public
static
readonly
field
|
Serializer
|
||
type
|
ITypeSerializer<Mat3D>
|
The identity matrix.
public
static
readonly
field
|
Identity
|
||
type
|
Mat3D
|
The zero matrix.
public
static
readonly
field
|
Zero
|
||
type
|
Mat3D
|
Returns the determinant of this matrix.
public
property
|
Determinant
{
get
}
|
||
type
|
float64
|
||
value
|
The determinant value. |
Returns the inverse of this matrix.
public
property
|
Inverse
{
get
}
|
||
type
|
Mat3D
|
||
value
|
The inverse matrix. |
Matrix component in first row, first column.
public
readonly
field
|
M11
|
||
type
|
float64
|
Matrix component in first row, second column.
public
readonly
field
|
M12
|
||
type
|
float64
|
Matrix component in first row, third column.
public
readonly
field
|
M13
|
||
type
|
float64
|
Matrix component in second row, first column.
public
readonly
field
|
M21
|
||
type
|
float64
|
Matrix component in second row, second column.
public
readonly
field
|
M22
|
||
type
|
float64
|
Matrix component in second row, third column.
public
readonly
field
|
M23
|
||
type
|
float64
|
Matrix component in third row, first column.
public
readonly
field
|
M31
|
||
type
|
float64
|
Matrix component in third row, second column.
public
readonly
field
|
M32
|
||
type
|
float64
|
Matrix component in third row, third column.
public
readonly
field
|
M33
|
||
type
|
float64
|
Returns the transpose of this matrix.
public
property
|
Transpose
{
get
}
|
||
type
|
Mat3D
|
||
value
|
The transposed matrix. |
Creates a new instance of Mat3D.
public
constructor
|
Mat3D
(float64 m11,
float64 m12,
float64 m13,
float64 m21,
float64 m22,
float64 m23,
float64 m31,
float64 m32,
float64 m33)
|
||
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. | ||
m21
|
Matrix component in second row, first column. | ||
m22
|
Matrix component in second row, second column. | ||
m23
|
Matrix component in second row, third 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. |
public
method
|
Equals
(Mat3D other)
|
||
type
|
bool
|
||
params
|
other
|
public
method
|
EqualsAlmost
(Mat3D other)
|
||
type
|
bool
|
||
params
|
other
|
Multiplies
this
matrix
(left-side)
with
the
given
one
(right-side):
result
=
this
*
m
.
[Pure]
|
||||
public
method
|
Mul
(Mat3D m)
|
|||
type
|
Mat3D
|
|||
params
|
m
|
The matrix. | ||
returns
|
The resulting matrix. |
Multiplies
this
matrix
(left-side)
with
the
given
homogeneous
2D
vector
(right-side):
result
=
this
*
v
.
[Pure]
|
||||
public
method
|
Mul2
(Vec2D v,
float64 w)
|
|||
type
|
Vec2D
|
|||
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
homogeneous
2D
vector
(right-side):
result
=
this
*
v
.
[Pure]
|
||||
public
method
|
Mul2
(float64 x,
float64 y,
float64 w)
|
|||
type
|
Vec2D
|
|||
params
|
x
|
X-component of vector. | ||
y
|
Y-component of vector. | |||
w
|
The W-component to assume. | |||
returns
|
The
resulting
vector,
scaled
by
1/result.W . |
Multiplies
this
matrix
(left-side)
with
the
given
vector
(right-side):
result
=
this
*
v
.
[Pure]
|
||||
public
method
|
Mul3
(Vec3D v)
|
|||
type
|
Vec3D
|
|||
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
|
Mul3
(float64 x,
float64 y,
float64 z)
|
|||
type
|
Vec3D
|
|||
params
|
x
|
X-component of vector. | ||
y
|
Y-component of vector. | |||
z
|
Z-component of vector. | |||
returns
|
The resulting vector. |
Orthogonalizes the given vectors using the Gram-Schmidt algorithm.
public
static
method
|
Orthogonalize
(ref Vec3D normal,
ref Vec3D tangent,
ref Vec3D bitangent)
|
||
params
|
normal
|
Normal vector (will be normalized only). | |
tangent
|
Tangent vector. | ||
bitangent
|
Bitangent vector. |
Returns a rotation matrix (counter-clockwise around given axis).
[Pure]
|
||||
public
static
method
|
Rotate
(Vec3D axis,
float64 angle)
|
|||
type
|
Mat3D
|
|||
params
|
axis
|
The rotation axis vector. | ||
angle
|
The rotation angle, in radians. | |||
returns
|
The resulting matrix. |
Returns a rotation matrix (counter-clockwise around given axis).
[Pure]
|
||||
public
static
method
|
Rotate
(float64 x,
float64 y,
float64 z,
float64 angle)
|
|||
type
|
Mat3D
|
|||
params
|
x
|
X-component of rotation axis vector. | ||
y
|
Y-component of rotation axis vector. | |||
z
|
Z-component of rotation axis vector. | |||
angle
|
The rotation angle, in radians. | |||
returns
|
The resulting matrix. |
Returns a rotation matrix (counter-clockwise around X-axis for right-handed coordinate system).
[Pure]
|
||||
public
static
method
|
RotateX
(float64 angle)
|
|||
type
|
Mat3D
|
|||
params
|
angle
|
The rotation angle, in radians. | ||
returns
|
The resulting matrix. |
Returns a rotation matrix (counter-clockwise around Y-axis for right-handed coordinate system).
[Pure]
|
||||
public
static
method
|
RotateY
(float64 angle)
|
|||
type
|
Mat3D
|
|||
params
|
angle
|
The rotation angle, in radians. | ||
returns
|
The resulting matrix. |
Returns a rotation matrix (counter-clockwise around Z-axis for right-handed coordinate system).
[Pure]
|
||||
public
static
method
|
RotateZ
(float64 angle)
|
|||
type
|
Mat3D
|
|||
params
|
angle
|
The rotation angle, in radians. | ||
returns
|
The resulting matrix. |
Returns a scaling matrix.
[Pure]
|
||||
public
static
method
|
Scale
(float64 f)
|
|||
type
|
Mat3D
|
|||
params
|
f
|
The scale factor. | ||
returns
|
The resulting matrix. |
Returns a scaling matrix.
[Pure]
|
||||
public
static
method
|
Scale
(Vec3D f)
|
|||
type
|
Mat3D
|
|||
params
|
f
|
The scale factors. | ||
returns
|
The resulting matrix. |
Returns a scaling matrix.
[Pure]
|
||||
public
static
method
|
Scale
(float64 fx,
float64 fy,
float64 fz)
|
|||
type
|
Mat3D
|
|||
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. | |||
returns
|
The resulting matrix. |
Returns a matrix that transforms from tangent space to object space.
[Pure]
|
||||
public
static
method
|
TangentSpace
(Vec3D x,
Vec3D y,
Vec3D z,
int32 orthogonalize = 0)
|
|||
type
|
Mat3D
|
|||
params
|
x
|
The vector in object space to map to the tangent space X-axis. | ||
y
|
The vector in object space to map to the tangent space Y-axis. | |||
z
|
The vector in object space to map to the tangent space Z-axis. | |||
orthogonalize
|
Depicts
how
to
orthogonalize
the
tangent
space
vectors:
0
is
given).
Defaults
to
0 .
|
|||
returns
|
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'
and
the
normalized
and
orthogonalized
tangent
space
basis
vectors.
|
Copies matrix elements to the given array.
[Pure]
|
||||
public
method
|
ToArray
([]
float64[] values,
int32 offset = 0,
int32 strideRow = 3,
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
).
Returns a homogeneous 2D translation matrix.
[Pure]
|
||||
public
static
method
|
Translate
(Vec2D v)
|
|||
type
|
Mat3D
|
|||
params
|
v
|
The 2D translation vector. | ||
returns
|
The resulting matrix. |
Returns a homogeneous 2D translation matrix.
[Pure]
|
||||
public
static
method
|
Translate
(float64 x,
float64 y)
|
|||
type
|
Mat3D
|
|||
params
|
x
|
X-component of translation vector. | ||
y
|
Y-component of translation vector. | |||
returns
|
The resulting matrix. |
Computes a 2D homogeneous warp matrix that transforms the unit square into a convex quadrilateral.
[Pure]
|
||||
public
static
method
|
Warp
(Vec2D a,
Vec2D b,
Vec2D c,
Vec2D d)
|
|||
type
|
Mat3D
|
|||
params
|
a
|
First vertex of convex quadrilateral. | ||
b
|
Second vertex of convex quadrilateral. | |||
c
|
Third vertex of convex quadrilateral. | |||
d
|
Fourth vertex of convex quadrilateral. | |||
returns
|
The homogeneous 2D warp matrix. |
Remarks:
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.