A 2x2 matrix with 64-bit floating-point precision.
struct
|
Mat2D
|
implements
|
IEquatable<Mat2D>
|
/ \ | M11 M12 | | M21 M22 | \ /
The serialization helper object for values of Mat2D.
public
static
readonly
field
|
Serializer
|
||
type
|
ITypeSerializer<Mat2D>
|
The identity matrix.
public
static
readonly
field
|
Identity
|
||
type
|
Mat2D
|
The zero matrix.
public
static
readonly
field
|
Zero
|
||
type
|
Mat2D
|
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
|
Mat2D
|
||
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 second row, first column.
public
readonly
field
|
M21
|
||
type
|
float64
|
Matrix component in second row, second column.
public
readonly
field
|
M22
|
||
type
|
float64
|
Returns the transpose of this matrix.
public
property
|
Transpose
{
get
}
|
||
type
|
Mat2D
|
||
value
|
The transposed matrix. |
Creates a new instance of Mat2D.
public
constructor
|
Mat2D
(float64 m11,
float64 m12,
float64 m21,
float64 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
method
|
Equals
(Mat2D other)
|
||
type
|
bool
|
||
params
|
other
|
public
method
|
EqualsAlmost
(Mat2D other)
|
||
type
|
bool
|
||
params
|
other
|
Multiplies
this
matrix
(left-side)
with
the
given
one
(right-side):
result
=
this
*
m
.
[Pure]
|
||||
public
method
|
Mul
(Mat2D m)
|
|||
type
|
Mat2D
|
|||
params
|
m
|
The matrix. | ||
returns
|
The resulting matrix. |
Multiplies
this
matrix
(left-side)
with
the
given
homogeneous
1D
vector
(right-side):
result
=
this
*
v
.
[Pure]
|
||||
public
method
|
Mul1
(float64 x,
float64 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. |
Multiplies
this
matrix
(left-side)
with
the
given
vector
(right-side):
result
=
this
*
v
.
[Pure]
|
||||
public
method
|
Mul2
(Vec2D v)
|
|||
type
|
Vec2D
|
|||
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
(float64 x,
float64 y)
|
|||
type
|
Vec2D
|
|||
params
|
x
|
X-component of vector. | ||
y
|
Y-component of vector. | |||
returns
|
The resulting vector. |
Returns a rotation matrix (counter-clockwise around origin for standard Cartesian coordinate system).
[Pure]
|
||||
public
static
method
|
Rotate
(float64 angle)
|
|||
type
|
Mat2D
|
|||
params
|
angle
|
The rotation angle, in radians. | ||
returns
|
The resulting matrix. |
Returns a scaling matrix.
[Pure]
|
||||
public
static
method
|
Scale
(float64 f)
|
|||
type
|
Mat2D
|
|||
params
|
f
|
The scale factor. | ||
returns
|
The resulting matrix. |
Returns a scaling matrix.
[Pure]
|
||||
public
static
method
|
Scale
(Vec2D f)
|
|||
type
|
Mat2D
|
|||
params
|
f
|
The scale factors. | ||
returns
|
The resulting matrix. |
Returns a scaling matrix.
[Pure]
|
||||
public
static
method
|
Scale
(float64 fx,
float64 fy)
|
|||
type
|
Mat2D
|
|||
params
|
fx
|
The scale factor along the X-axis. | ||
fy
|
The scale factor along the Y-axis. | |||
returns
|
The resulting matrix. |
Copies matrix elements to the given array.
[Pure]
|
||||
public
method
|
ToArray
([]
float64[] 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
).