Class: Rotator

PD. Rotator


new Rotator()

A static quaternion-based class for accumulating multiple rotations.

Author:
  • drajmarsh

Methods


addAxisRotation(axis, angle) <static>

Applies an additional rotation.

This method adds an additional rotation to the quaternion. Call this method only after you have first called the PD.Rotator.setAxisRotation method to initialise it with a base rotation.

Parameters:
Name Type Description
axis THREE.Vector3

The normalised direction vector.

angle number

The angle to rotate about the given axis, in radians.

Returns:

Returns this instance to support method chaining.

Type
PD.Rotation

applyToPoint(out [, about]) <static>

Applies the accumulated rotation to the given point NOTE: This method changes values within the out parameter.

Parameters:
Name Type Argument Description
out THREE.Vector3

The point to rotate.

about THREE.Vector3 <optional>

An optional point about which to do the rotation.

Returns:

Returns the out argument.

Type
THREE.Vector3

getQuaternion() <static>

Get the quaternion for rotation.

Returns:
Type
THREE.Quaternion

setAxisRotation(axis, angle) <static>

Sets the initial rotation.

Always call this method first to initialise the rotation, then call PD.Rotator.addAxisRotation for each additional rotation.

Parameters:
Name Type Description
axis THREE.Vector3

The normalised direction vector.

angle number

The angle to rotate about the given axis, in radians.

Returns:

Returns this instance to support method chaining.

Type
PD.Rotation

setFromUnitVectors(from, to) <static>

Sets the initial rotation.

Always call this method first to initialise the rotation, then call PD.Rotator.addAxisRotation for each additional rotation.

Parameters:
Name Type Description
from THREE.Vector3

The reference axis.

to THREE.Vector3

The new vector for the reference axis.

Returns:

Returns this instance to support method chaining.

Type
PD.Rotation