Skip to content

API / Matrix

Class: Matrix

Defined in: geom/Matrix.ts:31

2D Transform matrix.

Properties

a

ts
a: number;

Defined in: geom/Matrix.ts:40

The value that affects the positioning of pixels along the x axis when scaling or rotating an image.

Default

ts
1.0

b

ts
b: number;

Defined in: geom/Matrix.ts:49

The value that affects the positioning of pixels along the y axis when rotating or skewing an image.

Default

ts
0.0

c

ts
c: number;

Defined in: geom/Matrix.ts:58

The value that affects the positioning of pixels along the x axis when rotating or skewing an image.

Default

ts
0.0

d

ts
d: number;

Defined in: geom/Matrix.ts:67

The value that affects the positioning of pixels along the y axis when scaling or rotating an image.

Default

ts
1.0

tx

ts
tx: number;

Defined in: geom/Matrix.ts:76

The distance by which to translate each point along the x axis.

Default

ts
0.0

ty

ts
ty: number;

Defined in: geom/Matrix.ts:85

The distance by which to translate each point along the y axis.

Default

ts
0.0

Methods

concat()

ts
concat(value: Matrix): Matrix;

Defined in: geom/Matrix.ts:157

Multiplies the current matrix with another matrix.

Parameters

ParameterTypeDescription
valueMatrixThe matrix that needs to be multiplied.

Returns

Matrix


identity()

ts
identity(): Matrix;

Defined in: geom/Matrix.ts:140

Convert to unit matrix. The resulting matrix has the following properties: a=1, b=0, c=0, d=1, tx=0, ty=0.

Returns

Matrix


invert()

ts
invert(): Matrix;

Defined in: geom/Matrix.ts:195

Convert to inverse matrix.

Returns

Matrix


toString()

ts
toString(): string;

Defined in: geom/Matrix.ts:102

Returns

string


transformPoint()

ts
transformPoint(
   x: number, 
   y: number, 
   result: object, 
   delta: boolean): void;

Defined in: geom/Matrix.ts:256

Apply a matrix transformation to a specific point.

Parameters

ParameterTypeDefault valueDescription
xnumberundefinedX coordinate.
ynumberundefinedY coordinate.
result{ x: number; y: number; }undefinedThe point after the transformation is applied.
result.xnumberundefined-
result.ynumberundefined-
deltabooleanfalseWhether to ignore tx, ty's conversion to point.

Returns

void

Released under the MIT License.