Class: Matrix3
3*3 Matrix
Constructors
Properties
Methods
- clone
- concat
- copyFrom
- identity
- invert
- rotate
- scale
- setTo
- transformPoint
- setTranslate
- translate
- mul
- equals
- prepend
- append
- deltaTransformPoint
- toString
- createBox
- createGradientBox
Constructors
constructor
• new Matrix3(a?
, b?
, c?
, d?
, tx?
, ty?
): Matrix3
Create a Matrix3
Parameters
Name | Type | Default value | Description |
---|---|---|---|
a | number | 1 | The width of x |
b | number | 0 | The slope of y |
c | number | 0 | The slope of x |
d | number | 1 | The height of y |
tx | number | 0 | The position of the x coordinate |
ty | number | 0 | The position of the y coordinate |
Returns
Defined in
Properties
a
• a: number
The width of x
Defined in
b
• b: number
The slope of y
Defined in
c
• c: number
The slope of x
Defined in
d
• d: number
The height of y
Defined in
tx
• tx: number
The position of the x coordinate
Defined in
ty
• ty: number
The position of the y coordinate
Defined in
Methods
clone
▸ clone(): Matrix3
Clone an Matrix3 object
Returns
New Matrix3 object
Defined in
concat
▸ concat(matrix
): void
Merges the current matrix with the target matrix
Parameters
Name | Type | Description |
---|---|---|
matrix | Matrix3 | target matrix |
Returns
void
Defined in
copyFrom
▸ copyFrom(other
): Matrix3
The current matrix value is overwritten by the target matrix value
Parameters
Name | Type | Description |
---|---|---|
other | Matrix3 | target matrix value |
Returns
current matrix
Defined in
identity
▸ identity(): this
Reset to the identity matrix
Returns
this
Defined in
invert
▸ invert(): void
Invert this matrix
Returns
void
Defined in
rotate
▸ rotate(angle
): void
Rotate according to Angle
Parameters
Name | Type | Description |
---|---|---|
angle | number | rotation angle |
Returns
void
Defined in
scale
▸ scale(sx
, sy
): void
Scale by offset
Parameters
Name | Type | Description |
---|---|---|
sx | number | x axis scaling |
sy | number | y axis scaling |
Returns
void
Defined in
setTo
▸ setTo(a
, b
, c
, d
, tx
, ty
): Matrix3
Reset the matrix value
Parameters
Name | Type | Description |
---|---|---|
a | number | Matrix element a |
b | number | Matrix element b |
c | number | Matrix element c |
d | number | Matrix element d |
tx | number | Matrix element tx |
ty | number | Matrix element ty |
Returns
The modified matrix
Defined in
transformPoint
▸ transformPoint(pointX
, pointY
, resultPoint?
): Vector3
transformation of coordinates
Parameters
Name | Type | Description |
---|---|---|
pointX | number | x coordinate |
pointY | number | y coordinate |
resultPoint? | Vector3 | Vector of results |
Returns
Vector of results
Defined in
setTranslate
▸ setTranslate(x
, y
): void
translation
Parameters
Name | Type | Description |
---|---|---|
x | number | x coordinate |
y | number | y coordinate |
Returns
void
Defined in
translate
▸ translate(dx
, dy
): void
Translates the specified offset
Parameters
Name | Type | Description |
---|---|---|
dx | number | The x-coordinate offset |
dy | number | The y-coordinate offset |
Returns
void
Defined in
mul
▸ mul(t
): void
multiply
Parameters
Name | Type | Description |
---|---|---|
t | Matrix3 | target matrix |
Returns
void
Defined in
equals
▸ equals(other
): boolean
Is equal to the given matrix
Parameters
Name | Type | Description |
---|---|---|
other | Matrix3 | matrix |
Returns
boolean
Defined in
prepend
▸ prepend(a
, b
, c
, d
, tx
, ty
): Matrix3
get a front matrix by multiplication
Parameters
Name | Type | Description |
---|---|---|
a | number | Multiply by a |
b | number | Multiply by b |
c | number | Multiply by c |
d | number | Multiply by d |
tx | number | Multiply by tx |
ty | number | Multiply by ty |
Returns
prematrix
Defined in
append
▸ append(mat
): Matrix3
Obtain a post-multiplication matrix by multiplication.
Parameters
Name | Type | Description |
---|---|---|
mat | Matrix3 | Matrix |
Returns
result
Defined in
deltaTransformPoint
▸ deltaTransformPoint(point
): Vector3
Use the given point for the transformation, ignoring the x, y coordinates
Parameters
Name | Type | Description |
---|---|---|
point | Vector3 | A given point |
Returns
Defined in
toString
▸ toString(): string
Converts the current matrix to string form
Returns
string
Defined in
createBox
▸ createBox(scaleX
, scaleY
, rotation?
, tx?
, ty?
): void
Set the matrix scaling, rotation, and conversion parameters
Parameters
Name | Type | Default value | Description |
---|---|---|---|
scaleX | number | undefined | x axis scaling |
scaleY | number | undefined | y axis scaling |
rotation | number | 0 | rotation |
tx | number | 0 | x-coordinate |
ty | number | 0 | y-coordinate |
Returns
void
Defined in
createGradientBox
▸ createGradientBox(width
, height
, rotation?
, tx?
, ty?
): void
Create a gradient box
Parameters
Name | Type | Default value | Description |
---|---|---|---|
width | number | undefined | width |
height | number | undefined | height |
rotation | number | 0 | rotation |
tx | number | 0 | x-coordinate |
ty | number | 0 | y-coordinate |
Returns
void