Quaternion

Quaternion

A Quaternion is a geometric object which can be used to represent a three-dimensional rotation.

Constructor

new Quaternion(w, x, y, z) → {Quaternion}

Creates an instance of a Quaternion.

Parameters:
Name Type Description
w Number

first value

x Number

second value

y Number

third value

z Number

fourth value

Source:
Returns:

v - the new Quaternion

Type
Quaternion

Methods

conjugate() → {Quaternion}

conjugate the quaternion, in-place

Source:
Returns:

returns self

Type
Quaternion

copy(sourceObj) → {Quaternion}

copy values from another quaternion into this quaternion

Parameters:
Name Type Description
sourceObj Quaternion

the quaternion to copy from

Source:
Returns:

returns self

Type
Quaternion

multiply(other) → {Quaternion}

multiply this quaternion by another, in-place

Parameters:
Name Type Description
other Quaternion

The other quaternion

Source:
Returns:

returns self

Type
Quaternion

set(w, x, y, z) → {Quaternion}

set quaternion values

Parameters:
Name Type Description
w Number

w-value

x Number

x-value

y Number

y-value

z Number

z-value

Source:
Returns:

returns self

Type
Quaternion

setFromAxisAngle(axis, angle) → {Quaternion}

set the values of this quaternion from an axis/angle representation

Parameters:
Name Type Description
axis ThreeVector

The axis

angle Number

angle in radians

Source:
Returns:

returns self

Type
Quaternion

slerp(target, bending) → {Quaternion}

Apply in-place slerp (spherical linear interpolation) to this quaternion, towards another quaternion.

Parameters:
Name Type Description
target Quaternion

The target quaternion

bending Number

The percentage to interpolate

Source:
Returns:

returns self

Type
Quaternion

toAxisAngle() → {Object}

return an axis-angle representation of this quaternion

Source:
Returns:

contains two attributes: axis (ThreeVector) and angle.

Type
Object

toString() → {String}

Formatted textual description of the Quaternion.

Source:
Returns:

description

Type
String