Skip to content

Class: Matrix3

3*3 Matrix

Constructors

Properties

Methods

Constructors

constructor

new Matrix3(a?, b?, c?, d?, tx?, ty?): Matrix3

Create a Matrix3

Parameters

NameTypeDefault valueDescription
anumber1The width of x
bnumber0The slope of y
cnumber0The slope of x
dnumber1The height of y
txnumber0The position of the x coordinate
tynumber0The position of the y coordinate

Returns

Matrix3

Defined in

src/math/Matrix3.ts:67

Properties

a

a: number

The width of x

Defined in

src/math/Matrix3.ts:31


b

b: number

The slope of y

Defined in

src/math/Matrix3.ts:36


c

c: number

The slope of x

Defined in

src/math/Matrix3.ts:41


d

d: number

The height of y

Defined in

src/math/Matrix3.ts:46


tx

tx: number

The position of the x coordinate

Defined in

src/math/Matrix3.ts:51


ty

ty: number

The position of the y coordinate

Defined in

src/math/Matrix3.ts:56

Methods

clone

clone(): Matrix3

Clone an Matrix3 object

Returns

Matrix3

New Matrix3 object

Defined in

src/math/Matrix3.ts:80


concat

concat(matrix): void

Merges the current matrix with the target matrix

Parameters

NameTypeDescription
matrixMatrix3target matrix

Returns

void

Defined in

src/math/Matrix3.ts:88


copyFrom

copyFrom(other): Matrix3

The current matrix value is overwritten by the target matrix value

Parameters

NameTypeDescription
otherMatrix3target matrix value

Returns

Matrix3

current matrix

Defined in

src/math/Matrix3.ts:105


identity

identity(): this

Reset to the identity matrix

Returns

this

Defined in

src/math/Matrix3.ts:118


invert

invert(): void

Invert this matrix

Returns

void

Defined in

src/math/Matrix3.ts:127


rotate

rotate(angle): void

Rotate according to Angle

Parameters

NameTypeDescription
anglenumberrotation angle

Returns

void

Defined in

src/math/Matrix3.ts:135


scale

scale(sx, sy): void

Scale by offset

Parameters

NameTypeDescription
sxnumberx axis scaling
synumbery axis scaling

Returns

void

Defined in

src/math/Matrix3.ts:161


setTo

setTo(a, b, c, d, tx, ty): Matrix3

Reset the matrix value

Parameters

NameTypeDescription
anumberMatrix element a
bnumberMatrix element b
cnumberMatrix element c
dnumberMatrix element d
txnumberMatrix element tx
tynumberMatrix element ty

Returns

Matrix3

The modified matrix

Defined in

src/math/Matrix3.ts:184


transformPoint

transformPoint(pointX, pointY, resultPoint?): Vector3

transformation of coordinates

Parameters

NameTypeDescription
pointXnumberx coordinate
pointYnumbery coordinate
resultPoint?Vector3Vector of results

Returns

Vector3

Vector of results

Defined in

src/math/Matrix3.ts:201


setTranslate

setTranslate(x, y): void

translation

Parameters

NameTypeDescription
xnumberx coordinate
ynumbery coordinate

Returns

void

Defined in

src/math/Matrix3.ts:216


translate

translate(dx, dy): void

Translates the specified offset

Parameters

NameTypeDescription
dxnumberThe x-coordinate offset
dynumberThe y-coordinate offset

Returns

void

Defined in

src/math/Matrix3.ts:226


mul

mul(t): void

multiply

Parameters

NameTypeDescription
tMatrix3target matrix

Returns

void

Defined in

src/math/Matrix3.ts:235


equals

equals(other): boolean

Is equal to the given matrix

Parameters

NameTypeDescription
otherMatrix3matrix

Returns

boolean

Defined in

src/math/Matrix3.ts:273


prepend

prepend(a, b, c, d, tx, ty): Matrix3

get a front matrix by multiplication

Parameters

NameTypeDescription
anumberMultiply by a
bnumberMultiply by b
cnumberMultiply by c
dnumberMultiply by d
txnumberMultiply by tx
tynumberMultiply by ty

Returns

Matrix3

prematrix

Defined in

src/math/Matrix3.ts:287


append

append(mat): Matrix3

Obtain a post-multiplication matrix by multiplication.

Parameters

NameTypeDescription
matMatrix3Matrix

Returns

Matrix3

result

Defined in

src/math/Matrix3.ts:307


deltaTransformPoint

deltaTransformPoint(point): Vector3

Use the given point for the transformation, ignoring the x, y coordinates

Parameters

NameTypeDescription
pointVector3A given point

Returns

Vector3

Defined in

src/math/Matrix3.ts:329


toString

toString(): string

Converts the current matrix to string form

Returns

string

Defined in

src/math/Matrix3.ts:340


createBox

createBox(scaleX, scaleY, rotation?, tx?, ty?): void

Set the matrix scaling, rotation, and conversion parameters

Parameters

NameTypeDefault valueDescription
scaleXnumberundefinedx axis scaling
scaleYnumberundefinedy axis scaling
rotationnumber0rotation
txnumber0x-coordinate
tynumber0y-coordinate

Returns

void

Defined in

src/math/Matrix3.ts:352


createGradientBox

createGradientBox(width, height, rotation?, tx?, ty?): void

Create a gradient box

Parameters

NameTypeDefault valueDescription
widthnumberundefinedwidth
heightnumberundefinedheight
rotationnumber0rotation
txnumber0x-coordinate
tynumber0y-coordinate

Returns

void

Defined in

src/math/Matrix3.ts:380