Transform

Transform

A transform representing an orientation, position, and scale.

Constructor

new Transform()

Instantiates a Transform object.
Source:

Methods

(static) identity() → {Transform}

Returns an identity transform.
Source:
Returns:
An identity transform.
Type
Transform

(static) random() → {Transform}

Returns a transform with a random translation, orientation, and scale.
Source:
Returns:
The random transform.
Type
Transform

axes() → {Object}

Returns the axes of the transform.
Source:
Returns:
The axes of the transform.
Type
Object

equals(that, epsilon) → {boolean}

Returns true if the all components match those of a provided transform. An optional epsilon value may be provided.
Parameters:
Name Type Description
that Transform The matrix to test equality with.
epsilon number The epsilon value. Optional.
Source:
Returns:
Whether or not the transform components match.
Type
boolean

inverseMatrix() → {Mat44}

Returns the inverse of the transform's affine-transformation matrix.
Source:
Returns:
The inverse affine-transformation matrix.
Type
Mat44

inverseRotationMatrix() → {Mat44}

Returns the inverse of the transform's rotation matrix.
Source:
Returns:
The inverse rotation matrix.
Type
Mat44

inverseScaleMatrix() → {Mat44}

Returns the inverse of the transform's scale matrix.
Source:
Returns:
The inverse scale matrix.
Type
Mat44

inverseTranslationMatrix() → {Mat44}

Returns the inverse of the transform's translation matrix.
Source:
Returns:
The inverse translation matrix.
Type
Mat44

localToWorld(vec) → {Transform}

Transforms the vector or matrix argument from the transforms local space to the world space.
Parameters:
Name Type Description
vec Vec3 | Vec4 The vector argument to transform.
Source:
Returns:
The transform for chaining.
Type
Transform

matrix() → {Mat44}

Returns the transform's affine-transformation matrix.
Source:
Returns:
The affine-transformation matrix.
Type
Mat44

rotateLocal(angle, axis) → {Transform}

Rotates the transform by an angle around an axis in local space.
Parameters:
Name Type Description
angle number The angle of the rotation, in radians.
axis Vec3 The axis of the rotation.
Source:
Returns:
The transform for chaining.
Type
Transform

rotateWorld(angle, axis) → {Transform}

Rotates the transform by an angle around an axis in world space.
Parameters:
Name Type Description
angle number The angle of the rotation, in radians.
axis Vec3 The axis of the rotation.
Source:
Returns:
The transform for chaining.
Type
Transform

rotateXTo(x) → {Transform}

Rotates the transform such that x-axis matches the provided vector.
Parameters:
Name Type Description
x Vec3 | Array The x-axis to rotate to.
Source:
Returns:
The transform object, for chaining.
Type
Transform

rotateYTo(y) → {Transform}

Rotates the transform such that y-axis matches the provided vector.
Parameters:
Name Type Description
y Vec3 | Array The y-axis to rotate to.
Source:
Returns:
The transform object, for chaining.
Type
Transform

rotateZTo(z) → {Transform}

Rotates the transform such that z-axis matches the provided vector.
Parameters:
Name Type Description
z Vec3 | Array The z-axis to rotate to.
Source:
Returns:
The transform object, for chaining.
Type
Transform

rotationMatrix() → {Mat44}

Returns the transform's rotation matrix.
Source:
Returns:
The rotation matrix.
Type
Mat44

scaleMatrix() → {Mat44}

Returns the transform's scale matrix.
Source:
Returns:
The scale matrix.
Type
Mat44

toString() → {String}

Returns a string representation of the transform.
Source:
Returns:
The string representation of the transform.
Type
String

translateLocal(translation) → {Transform}

Translates the transform in local space.
Parameters:
Name Type Description
translation Vec3 The translation vector.
Source:
Returns:
The transform for chaining.
Type
Transform

translateWorld(translation) → {Transform}

Translates the transform in world space.
Parameters:
Name Type Description
translation Vec3 The translation vector.
Source:
Returns:
The transform for chaining.
Type
Transform

translationMatrix() → {Mat44}

Returns the transform's translation matrix.
Source:
Returns:
The translation matrix.
Type
Mat44

viewMatrix() → {Mat44}

Returns the transform's view matrix.
Source:
Returns:
The view matrix.
Type
Mat44

worldToLocal(vec) → {Transform}

Transforms the vector or matrix argument from world space to the transforms local space.
Parameters:
Name Type Description
vec Vec3 | Vec4 The vector argument to transform.
Source:
Returns:
The transform for chaining.
Type
Transform

xAxis() → {Vec3}

Returns the x-axis of the transform.
Source:
Returns:
The x-axis of the transform.
Type
Vec3

yAxis() → {Vec3}

Returns the y-axis of the transform.
Source:
Returns:
The y-axis of the transform.
Type
Vec3

zAxis() → {Vec3}

Returns the z-axis of the transform.
Source:
Returns:
The z-axis of the transform.
Type
Vec3