Class: Quaternion

Quaternion

new Quaternion()

Quaternion type.
Source:

Extends

Methods

(static) conjugate(quaternion, outopt) → {Quaternion}

Parameters:
Name Type Attributes Description
quaternion Quaternion The Quaterion.
out Quaternion <optional>
The Quaternion to store the conjugate in. If undefined, a new Quaternion is created.
Source:
Returns:
The out Quaternion.
Type
Quaternion

(static) invert(quaternion, outopt) → {Quaternion}

Parameters:
Name Type Attributes Description
quaternion Quaternion The Quaternion to invert.
out Quaternion <optional>
The Quaternion to store the result of the inversion. If undefined, a new Quaternion is created.
Source:
Returns:
The out Quaternion.
Type
Quaternion

(static) mul(q1, q2, outopt) → {Quaternion}

Parameters:
Name Type Attributes Description
q1 Quaternion The left multiplicand.
q2 Quaternion The right multiplicand.
out Quaternion <optional>
The Quaternion to store the result of the multiplication. If undefined, a new Quaternion is created.
Source:
Returns:
The out Quaternion.
Type
Quaternion

conjugate() → {Quaternion}

Conjugates this Quaternion.
Source:
Returns:
This Quaternion.
Type
Quaternion

equals(array) → {boolean}

Parameters:
Name Type Description
array Array The array to compare this Dimensional to.
Inherited From:
Source:
Returns:
True if all entries are equal, false otherwise.
Type
boolean

invert() → {Quaternion}

Inverts this Quaternion.
Source:
Returns:
This Quaternion.
Type
Quaternion

length() → {number}

Source:
Returns:
The length (magnitude) of this Quaternion.
Type
number

mul(quaternion) → {Quaternion}

Rotates this Quaternion by quaternion.
Parameters:
Name Type Description
quaternion Quaternion The right-side multiplicand.
Source:
Returns:
This Quaternion.
Type
Quaternion

normalize() → {Quaternion}

Normalizes this Quaternion.
Source:
Returns:
This Quaternion
Type
Quaternion

quadrance() → {number}

Source:
Returns:
The quadrance of this Quaternion.
Type
number

rotate(vector) → {Vector}

Rotates a Vector by this Quaternion.
Parameters:
Name Type Description
vector Vector The Vector to rotate by this Quaternion.
Source:
Returns:
The rotated Vector.
Type
Vector

setAxisAngle(axis, angle) → {Quaternion}

Sets the orientation of this Quaternion to a rotation of angle around axis.
Parameters:
Name Type Description
axis Array The axis of rotation.
angle number The angle of rotation.
Source:
Throws:
if axis is not an instance of Array or if angle is not of type number.
Type
TypeError
Returns:
This Quaternion.
Type
Quaternion

toMatrix(matrixopt) → {Matrix}

Parameters:
Name Type Attributes Description
matrix Matrix <optional>
The matrix to be set as a rotation-matrix representation of this Quaternion. If undefined, a new Matrix is created.
Source:
Throws:
if matrix is not a 3x3 matrix, 4x4 matrix, or undefined.
Type
DimensionError
Returns:
The Matrix.
Type
Matrix

toString() → {string}

Source:
Returns:
A string representation of this Quaternion.
Type
string

toTVArray() → {Array}

Source:
Returns:
An array representation of this Quaternion with coordinates in the folling order: [w, x, y, z].
Type
Array

toVTArray() → {Array}

Source:
Returns:
An array representation of this Quaternion with coordinates in the following order: [x, y, z, w].
Type
Array