Skip to main content

Class: Transform3D

A 3D affine transformation. By default, Transform3D objects are initially created as identity transformations.

Constructors

constructor

new Transform3D(): Transform3D

Returns

Transform3D

Methods

addRotation

addRotation(theta, axisX, axisY, axisZ, order?): this

Adds a rotation about an arbitrary axis passing through the origin (0, 0, 0) to this transformation.

Parameters

NameTypeDescription
thetanumberThe rotation angle, in radians.
axisXnumberThe x component of the vector defining the direction of the rotation axis.
axisYnumberThe y component of the vector defining the direction of the rotation axis.
axisZnumberThe z component of the vector defining the direction of the rotation axis.
order?"after" | "before"The order in which to add the rotation, relative to this existing transformation, either 'before' or 'after'. Defaults to 'after'.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:705

addRotation(theta, axisX, axisY, axisZ, originX, originY, originZ, order?): this

Adds a rotation about an arbitrary axis passing through an arbitrary point to this transformation.

Parameters

NameTypeDescription
thetanumberThe rotation angle, in radians.
axisXnumberThe x component of the vector defining the direction of the rotation axis.
axisYnumberThe y component of the vector defining the direction of the rotation axis.
axisZnumberThe z component of the vector defining the direction of the rotation axis.
originXnumberThe x-coordinate of the rotation origin.
originYnumberThe y-coordinate of the rotation origin.
originZnumberThe z-coordinate of the rotation origin.
order?"after" | "before"The order in which to add the rotation, relative to this existing transformation, either 'before' or 'after'. Defaults to 'after'.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:719


addRotationX

addRotationX(theta, order?): this

Adds a rotation about an axis parallel to the x axis passing through the origin (0, 0, 0) to this transformation.

Parameters

NameTypeDescription
thetanumberThe rotation angle, in radians.
order?"after" | "before"The order in which to add the rotation, relative to this existing transformation, either 'before' or 'after'. Defaults to 'after'.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:573

addRotationX(theta, originX, originY, originZ, order?): this

Adds a rotation about an axis parallel to the x axis passing through an arbitrary point to this transformation.

Parameters

NameTypeDescription
thetanumberThe rotation angle, in radians.
originXnumberThe x-coordinate of the rotation origin.
originYnumberThe y-coordinate of the rotation origin.
originZnumberThe z-coordinate of the rotation origin.
order?"after" | "before"The order in which to add the rotation, relative to this existing transformation, either 'before' or 'after'. Defaults to 'after'.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:584


addRotationY

addRotationY(theta, order?): this

Adds a rotation about an axis parallel to the y axis passing through the origin (0, 0, 0) to this transformation.

Parameters

NameTypeDescription
thetanumberThe rotation angle, in radians.
order?"after" | "before"The order in which to add the rotation, relative to this existing transformation, either 'before' or 'after'. Defaults to 'after'.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:616

addRotationY(theta, originX, originY, originZ, order?): this

Adds a rotation about an axis parallel to the y axis passing through an arbitrary point to this transformation.

Parameters

NameTypeDescription
thetanumberThe rotation angle, in radians.
originXnumberThe x-coordinate of the rotation origin.
originYnumberThe y-coordinate of the rotation origin.
originZnumberThe z-coordinate of the rotation origin.
order?"after" | "before"The order in which to add the rotation, relative to this existing transformation, either 'before' or 'after'. Defaults to 'after'.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:627


addRotationZ

addRotationZ(theta, order?): this

Adds a rotation about an axis parallel to the z axis passing through the origin (0, 0, 0) to this transformation.

Parameters

NameTypeDescription
thetanumberThe rotation angle, in radians.
order?"after" | "before"The order in which to add the rotation, relative to this existing transformation, either 'before' or 'after'. Defaults to 'after'.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:659

addRotationZ(theta, originX, originY, originZ, order?): this

Adds a rotation about an axis parallel to the z axis passing through an arbitrary point to this transformation.

Parameters

NameTypeDescription
thetanumberThe rotation angle, in radians.
originXnumberThe x-coordinate of the rotation origin.
originYnumberThe y-coordinate of the rotation origin.
originZnumberThe z-coordinate of the rotation origin.
order?"after" | "before"The order in which to add the rotation, relative to this existing transformation, either 'before' or 'after'. Defaults to 'after'.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:670


addScale

addScale(x, y, z, order?): this

Adds a scaling about the origin (0, 0, 0) to this transformation.

Parameters

NameTypeDescription
xnumberThe x scaling factor.
ynumberThe y scaling factor.
znumberThe z scaling factor.
order?"after" | "before"The order in which to add the scaling, relative to this existing transformation, either 'before' or 'after'. Defaults to 'after'.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:528

addScale(x, y, z, originX, originY, originZ, order?): this

Adds a scaling about an arbitrary origin to this transformation.

Parameters

NameTypeDescription
xnumberThe x scaling factor.
ynumberThe y scaling factor.
znumberThe z scaling factor.
originXnumberThe x-coordinate of the scaling origin.
originYnumberThe y-coordinate of the scaling origin.
originZnumberThe z-coordinate of the scaling origin.
order?"after" | "before"The order in which to add the scaling, relative to this existing transformation, either 'before' or 'after'. Defaults to 'after'.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:541


addTranslation

addTranslation(x, y, z, order?): this

Adds a translation to this transformation.

Parameters

NameTypeDefault valueDescription
xnumberundefinedThe x translation.
ynumberundefinedThe y translation.
znumberundefinedThe z translation.
order"after" | "before"'after'The order in which to add the translation, relative to this existing transformation, either 'before' or 'after'. Defaults to 'after'.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:507


apply

apply(vec, out): Float64Array

Applies this transformation to a 3D vector.

Parameters

NameTypeDescription
vecReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>A 3D vector.
outFloat64ArrayThe vector to which to write the result.

Returns

Float64Array

The result of applying this transformation to vec.

Defined in

src/sdk/math/Transform3D.ts:294


copy

copy(): Transform3D

Copies this transformation.

Returns

Transform3D

A copy of this transformation.

Defined in

src/sdk/math/Transform3D.ts:284


getParameters

getParameters(): Readonly<Float64Array>

Gets the parameters of this transformation as a 12-tuple: [scaleX, skewX(Y), skewX(Z), translateX, skewY(X), scaleY, skewY(Z), translateY, skewZ(X), skewZ(Y), scaleZ, translateZ].

Returns

Readonly<Float64Array>

The parameters of this transformation.

Defined in

src/sdk/math/Transform3D.ts:21


invert

invert(): this

Inverts this transformation.

Returns

this

This transformation, after it has been inverted.

Throws

Error if this transformation cannot be inverted.

Defined in

src/sdk/math/Transform3D.ts:225


offsetOrigin

offsetOrigin(x, y, z): this

Changes this transformation to the one that is the result of offsetting this transformation's origin.

Parameters

NameTypeDescription
xnumberThe x-coordinate of the offset origin.
ynumberThe y-coordinate of the offset origin.
znumberThe z-coordinate of the offset origin.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:312


set

set(scaleX, skewXY, skewXZ, translateX, skewYX, scaleY, skewYZ, translateY, skewZX, skewZY, scaleZ, translateZ): this

Sets the parameters of this transformation.

Parameters

NameTypeDescription
scaleXnumberThe x scaling factor.
skewXYnumberThe x skew factor along the y axis.
skewXZnumberThe x skew factor along the z axis.
translateXnumberThe x translation.
skewYXnumberThe y skew factor along the x axis.
scaleYnumberThe y scaling factor.
skewYZnumberThe y skew factor along the z axis.
translateYnumberThe y translation.
skewZXnumberThe z skew factor along the x axis.
skewZYnumberThe z skew factor along the y axis.
scaleZnumberThe z scaling factor.
translateZnumberThe z translation.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:41

set(transform): this

Sets the parameters of this transformation from another transformation.

Parameters

NameTypeDescription
transformReadonlyTransform3DThe transformation from which to take parameters.

Returns

this

Defined in

src/sdk/math/Transform3D.ts:59


setScale

setScale(x, y, z): this

Sets the x and y scaling factors of this transformation.

Parameters

NameTypeDescription
xnumberThe new x scaling factor.
ynumberThe new y scaling factor.
znumberThe new z scaling factor.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:133


setScaleX

setScaleX(value): this

Sets the x scaling factor of this transformation.

Parameters

NameTypeDescription
valuenumberThe new x scaling factor.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:101


setScaleY

setScaleY(value): this

Sets the y scaling factor of this transformation.

Parameters

NameTypeDescription
valuenumberThe new y scaling factor.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:111


setScaleZ

setScaleZ(value): this

Sets the z scaling factor of this transformation.

Parameters

NameTypeDescription
valuenumberThe new z scaling factor.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:121


setSkewX

setSkewX(y, z): this

Sets the x skew factor of this transformation.

Parameters

NameTypeDescription
ynumberThe new x skew factor along the y axis.
znumberThe new x skew factor along the z axis.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:146


setSkewY

setSkewY(x, z): this

Sets the y skew factor of this transformation.

Parameters

NameTypeDescription
xnumberThe new y skew factor along the x axis.
znumberThe new y skew factor along the z axis.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:158


setSkewZ

setSkewZ(x, y): this

Sets the z skew factor of this transformation.

Parameters

NameTypeDescription
xnumberThe new z skew factor along the x axis.
ynumberThe new z skew factor along the y axis.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:170


setTranslate

setTranslate(x, y, z): this

Sets the x and y translations of this transformation.

Parameters

NameTypeDescription
xnumberThe new x translation.
ynumberThe new y translation.
znumberThe new z translation.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:213


setTranslateX

setTranslateX(value): this

Sets the x translation of this transformation.

Parameters

NameTypeDescription
valuenumberThe new x translation.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:181


setTranslateY

setTranslateY(value): this

Sets the y translation of this transformation.

Parameters

NameTypeDescription
valuenumberThe new y translation.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:191


setTranslateZ

setTranslateZ(value): this

Sets the z translation of this transformation.

Parameters

NameTypeDescription
valuenumberThe new z translation.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:201


toIdentity

toIdentity(): this

Sets this transformation to the identity transformation.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:324


toRotation

toRotation(theta, axisX, axisY, axisZ): this

Sets this transformation to a rotation about an arbitrary axis passing through the origin (0, 0, 0).

Parameters

NameTypeDescription
thetanumberThe rotation angle, in radians.
axisXnumberThe x component of the vector defining the direction of the rotation axis.
axisYnumberThe y component of the vector defining the direction of the rotation axis.
axisZnumberThe z component of the vector defining the direction of the rotation axis.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:456

toRotation(theta, axisX, axisY, axisZ, originX, originY, originZ): this

Sets this transformation to a rotation about an arbitrary axis passing through an arbitrary point.

Parameters

NameTypeDescription
thetanumberThe rotation angle, in radians.
axisXnumberThe x component of the vector defining the direction of the rotation axis.
axisYnumberThe y component of the vector defining the direction of the rotation axis.
axisZnumberThe z component of the vector defining the direction of the rotation axis.
originXnumberThe x-coordinate of the rotation origin.
originYnumberThe y-coordinate of the rotation origin.
originZnumberThe z-coordinate of the rotation origin.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:468


toRotationX

toRotationX(theta): this

Sets this transformation to a rotation about an axis parallel to the x axis passing through the origin (0, 0, 0).

Parameters

NameTypeDescription
thetanumberThe rotation angle, in radians.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:372

toRotationX(theta, originX, originY, originZ): this

Sets this transformation to a rotation about an axis parallel to the x axis passing through an arbitrary point.

Parameters

NameTypeDescription
thetanumberThe rotation angle, in radians.
originXnumberThe x-coordinate of the rotation origin.
originYnumberThe y-coordinate of the rotation origin.
originZnumberThe z-coordinate of the rotation origin.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:381


toRotationY

toRotationY(theta): this

Sets this transformation to a rotation about an axis parallel to the y axis passing through the origin (0, 0, 0).

Parameters

NameTypeDescription
thetanumberThe rotation angle, in radians.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:399

toRotationY(theta, originX, originY, originZ): this

Sets this transformation to a rotation about an axis parallel to the y axis passing through an arbitrary point.

Parameters

NameTypeDescription
thetanumberThe rotation angle, in radians.
originXnumberThe x-coordinate of the rotation origin.
originYnumberThe y-coordinate of the rotation origin.
originZnumberThe z-coordinate of the rotation origin.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:408


toRotationZ

toRotationZ(theta): this

Sets this transformation to a rotation about an axis parallel to the z axis passing through the origin (0, 0, 0).

Parameters

NameTypeDescription
thetanumberThe rotation angle, in radians.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:426

toRotationZ(theta, originX, originY, originZ): this

Sets this transformation to a rotation about an axis parallel to the z axis passing through an arbitrary point.

Parameters

NameTypeDescription
thetanumberThe rotation angle, in radians.
originXnumberThe x-coordinate of the rotation origin.
originYnumberThe y-coordinate of the rotation origin.
originZnumberThe z-coordinate of the rotation origin.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:435


toScale

toScale(x, y, z): this

Sets this transformation to a scaling about the origin (0, 0, 0).

Parameters

NameTypeDescription
xnumberThe x scaling factor.
ynumberThe y scaling factor.
znumberThe z scaling factor.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:346

toScale(x, y, z, originX, originY, originZ): this

Sets this transformation to a scaling about an arbitrary origin.

Parameters

NameTypeDescription
xnumberThe x scaling factor.
ynumberThe y scaling factor.
znumberThe z scaling factor.
originXnumberThe x-coordinate of the scaling origin.
originYnumberThe y-coordinate of the scaling origin.
originZnumberThe z-coordinate of the scaling origin.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:357


toTranslation

toTranslation(x, y, z): this

Sets this transformation to a translation.

Parameters

NameTypeDescription
xnumberThe x translation.
ynumberThe y translation.
znumberThe z translation.

Returns

this

This transformation, after it has been changed.

Defined in

src/sdk/math/Transform3D.ts:335


concat

concat<T>(out, transforms): T

Concatenates one or more transformations and returns the result. Concatenating transformations [A, B, ...] results in a transformation that is equivalent to first applying A, then applying B, etc. Note that this order is the opposite of the one resulting from multiplying the individual transformation matrices M_A * M_B * ....

If the number of transformations to concatenate equals zero, the identity matrix is returned.

Type parameters

NameType
Textends Transform3D

Parameters

NameTypeDescription
outTThe transformation to which to write the result.
transformsreadonly ReadonlyTransform3D[]The transformations to concatenate, in order.

Returns

T

The result of concatenating all transformations in transforms.

Defined in

src/sdk/math/Transform3D.ts:761