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. |
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. |
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. |
Returns:
The out Quaternion.
- Type
- Quaternion
conjugate() → {Quaternion}
Conjugates this Quaternion.
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.
Returns:
This Quaternion.
- Type
- Quaternion
length() → {number}
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. |
Returns:
This Quaternion.
- Type
- Quaternion
normalize() → {Quaternion}
Normalizes this Quaternion.
Returns:
This Quaternion
- Type
- Quaternion
quadrance() → {number}
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. |
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. |
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. |
Throws:
-
if matrix is not a 3x3 matrix, 4x4 matrix, or undefined.
- Type
- DimensionError
Returns:
The Matrix.
- Type
- Matrix
toString() → {string}
Returns:
A string representation of this Quaternion.
- Type
- string
toTVArray() → {Array}
Returns:
An array representation of this Quaternion with
coordinates in the folling order: [w, x, y, z].
- Type
- Array
toVTArray() → {Array}
Returns:
An array representation of this Quaternion with
coordinates in the following order: [x, y, z, w].
- Type
- Array