Skip to content

Shapemetry API


Shapemetry API / Transformation2d

Class: Transformation2d

Defined in: core2d/Transformation2D.ts:10

A 2D affine transformation. Rotation factories take radians.

Constructors

Constructor

new Transformation2d(elements): Transformation2d

Defined in: core2d/Transformation2D.ts:13

Parameters

elements

Transformation2dJSON

Returns

Transformation2d

Properties

elements

readonly elements: Transformation2dJSON

Defined in: core2d/Transformation2D.ts:11

Methods

toJSON()

toJSON(): Transformation2dJSON

Defined in: core2d/Transformation2D.ts:15

Returns

Transformation2dJSON


fromJSON()

static fromJSON(d): Transformation2d

Defined in: core2d/Transformation2D.ts:16

Parameters

d

Transformation2dJSON

Returns

Transformation2d


identity()

static identity(): Transformation2d

Defined in: core2d/Transformation2D.ts:18

Returns

Transformation2d


fromTranslation()

static fromTranslation(tx, ty): Transformation2d

Defined in: core2d/Transformation2D.ts:19

Parameters

tx

number

ty

number

Returns

Transformation2d


fromScaling()

static fromScaling(sx, sy): Transformation2d

Defined in: core2d/Transformation2D.ts:20

Parameters

sx

number

sy

number

Returns

Transformation2d


fromRotation()

static fromRotation(angle): Transformation2d

Defined in: core2d/Transformation2D.ts:21

Parameters

angle

number

Returns

Transformation2d


multiply()

multiply(other): Transformation2d

Defined in: core2d/Transformation2D.ts:26

Parameters

other

Transformation2d

Returns

Transformation2d


inverse()

inverse(): Transformation2d | undefined

Defined in: core2d/Transformation2D.ts:39

Inverse of this affine transformation, or undefined if the linear part is singular.

Returns

Transformation2d | undefined