new Rotator()
A static quaternion-based class for accumulating multiple rotations.
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.setAxisRotationmethod to initialise it with a base rotation.Parameters:
Name Type Description axisTHREE.Vector3 The normalised direction vector.
anglenumber 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
outparameter.Parameters:
Name Type Argument Description outTHREE.Vector3 The point to rotate.
aboutTHREE.Vector3 <optional>
An optional point about which to do the rotation.
Returns:
Returns the
outargument.- 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.addAxisRotationfor each additional rotation.Parameters:
Name Type Description axisTHREE.Vector3 The normalised direction vector.
anglenumber 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.addAxisRotationfor each additional rotation.Parameters:
Name Type Description fromTHREE.Vector3 The reference axis.
toTHREE.Vector3 The new vector for the reference axis.
Returns:
Returns this instance to support method chaining.
- Type
- PD.Rotation