Constructor
new Quaternion(x, y, z, w)
- Source:
Properties:
Name | Type | Description |
---|---|---|
components |
Float32Array | A typed array storing the components of this quaternion. |
Creates an instance of Quaternion.
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | The x component of the quaternion. |
y |
Number | The y component of the quaternion. |
z |
Number | The z component of the quaternion. |
w |
Number | The w component of the quaternion. |
Methods
(static) add(q, p) → {Lore.Quaternion}
- Source:
Sum two quaternions.
Parameters:
Name | Type | Description |
---|---|---|
q |
Lore.Quaternion | A quaternion. |
p |
Lore.Quaternion | A quaternion. |
Returns:
The resulting quaternion.
- Type
- Lore.Quaternion
(static) conjugate(q) → {Lore.Quaternion}
- Source:
Conjugate (* -1) a quaternion.
Parameters:
Name | Type | Description |
---|---|---|
q |
Lore.Quaternion | A quaternion. |
Returns:
The resulting quaternion.
- Type
- Lore.Quaternion
(static) dot(q, p) → {Number}
- Source:
Calculate the dot product of two quaternions.
Parameters:
Name | Type | Description |
---|---|---|
q |
Lore.Quaternion | A quaternion. |
p |
Lore.Quaternion | A quaternion. |
Returns:
The dot product.
- Type
- Number
(static) fromMatrix(m) → {Lore.Quaternion}
- Source:
Create a quaternion from a matrix.
Parameters:
Name | Type | Description |
---|---|---|
m |
Lore.Matrix4f | A matrix. |
Returns:
The resulting quaternion.
- Type
- Lore.Quaternion
(static) inverse(q) → {Lore.Quaternion}
- Source:
Inverse a quaternion.
Parameters:
Name | Type | Description |
---|---|---|
q |
Lore.Quaternion | A quaternion. |
Returns:
The resulting quaternion.
- Type
- Lore.Quaternion
(static) multiply(a, b) → {Lore.Quaternion}
- Source:
Multiply (cross product) two quaternions.
Parameters:
Name | Type | Description |
---|---|---|
a |
Lore.Quaternion | A quaternion. |
b |
Lore.Quaternion | A quaternion. |
Returns:
The cross product quaternion.
- Type
- Lore.Quaternion
(static) multiplyScalar(q, s) → {Lore.Quaternion}
- Source:
Multiplies a quaternion with a scalar.
Parameters:
Name | Type | Description |
---|---|---|
q |
Lore.Quaternion | A quaternion. |
s |
Number | A scalar. |
Returns:
The resulting quaternion.
- Type
- Lore.Quaternion
(static) normalize(q) → {Lore.Quaternion}
- Source:
Normalize a quaternion.
Parameters:
Name | Type | Description |
---|---|---|
q |
Lore.Quaternion | A quaternion. |
Returns:
The resulting quaternion.
- Type
- Lore.Quaternion
(static) slerp(q, p, t) → {Lore.Quaternion}
- Source:
Interpolate between two quaternions (t is between 0 and 1).
Parameters:
Name | Type | Description |
---|---|---|
q |
Lore.Quaternion | The source quaternion. |
p |
Lore.Quaternion | The target quaternion. |
t |
Number | The interpolation value / percentage (between 0 an 1). |
Returns:
The resulting quaternion.
- Type
- Lore.Quaternion
(static) subtract(q, p) → {Lore.Quaternion}
- Source:
Subtract a quaternion from another (q - p).
Parameters:
Name | Type | Description |
---|---|---|
q |
Lore.Quaternion | A quaternion. |
p |
Lore.Quaternion | A quaternion. |
Returns:
The resulting quaternion.
- Type
- Lore.Quaternion
add(q) → {Lore.Quaternion}
- Source:
Add another quaternion to this one.
Parameters:
Name | Type | Description |
---|---|---|
q |
Lore.Quaternion | A quaternion. |
Returns:
Returns itself.
- Type
- Lore.Quaternion
clone() → {Lore.Quaternion}
- Source:
Clone this quaternion.
Returns:
A clone of this quaternion.
- Type
- Lore.Quaternion
conjugate() → {Lore.Quaternion}
- Source:
Conjugate (* -1) this quaternion.
Returns:
Returns itself.
- Type
- Lore.Quaternion
dot(q) → {Number}
- Source:
Get the dot product of this and another quaternion.
Parameters:
Name | Type | Description |
---|---|---|
q |
Lore.Quaternion | A quaternion. |
Returns:
The dot product.
- Type
- Number
equals(q) → {Boolean}
- Source:
Checks whether the entries of this quaternion match another one.
Parameters:
Name | Type | Description |
---|---|---|
q |
Lore.Quaternion | A quaternion. |
Returns:
A boolean representing whether the entries of the two quaternions match.
- Type
- Boolean
getW() → {Number}
- Source:
Get the w component of this quaternion.
Returns:
The w component of this quaternion.
- Type
- Number
getX() → {Number}
- Source:
Get the x component of this quaternion.
Returns:
The x component of this quaternion.
- Type
- Number
getY() → {Number}
- Source:
Get the y component of this quaternion.
Returns:
The y component of this quaternion.
- Type
- Number
getZ() → {Number}
- Source:
Get the z component of this quaternion.
Returns:
The z component of this quaternion.
- Type
- Number
inverse() → {Lore.Quaternion}
- Source:
Get the inverse of this quaternion.
Returns:
Returns itself.
- Type
- Lore.Quaternion
length() → {Number}
- Source:
Get the length of this quaternion.
Returns:
The length.
- Type
- Number
lengthSq() → {Number}
- Source:
Get the square length of the quaternion.
Returns:
The square of the length.
- Type
- Number
lookAt(source, dest, up) → {Lore.Quaternion}
- Source:
Set the quaternion based facing in a destionation direction.
Parameters:
Name | Type | Description |
---|---|---|
source |
Lore.Vector3f | The source vector (the position). |
dest |
Lore.Vector3f | The destination vector. |
up |
Lore.Vector3f | The up vector of the source. |
Returns:
Returns itself.
- Type
- Lore.Quaternion
multiplyA(b) → {Lore.Quaternion}
- Source:
Multiply this quaternion with another (a * b).
Parameters:
Name | Type | Description |
---|---|---|
b |
Lore.Quaternion | Another quaternion. |
Returns:
Returns itself.
- Type
- Lore.Quaternion
multiplyB(a) → {Lore.Quaternion}
- Source:
Multiply another with this quaternion (a * b).
Parameters:
Name | Type | Description |
---|---|---|
a |
Lore.Quaternion | Another quaternion. |
Returns:
Returns itself.
- Type
- Lore.Quaternion
multiplyScalar(s) → {Lore.Quaternion}
- Source:
Multiply this quaternion with a scalar.
Parameters:
Name | Type | Description |
---|---|---|
s |
Number | A scalar. |
Returns:
Returns itself.
- Type
- Lore.Quaternion
normalize() → {Lore.Quaternion}
- Source:
Normalizes this quaternion.
Returns:
Returns itself.
- Type
- Lore.Quaternion
rotateX(angle) → {Lore.Quaternion}
- Source:
Rotate this quaternion around the x axis.
Parameters:
Name | Type | Description |
---|---|---|
angle |
Number | An angle in radians. |
Returns:
Returns itself.
- Type
- Lore.Quaternion
rotateY(angle) → {Lore.Quaternion}
- Source:
Rotate this quaternion around the y axis.
Parameters:
Name | Type | Description |
---|---|---|
angle |
Number | An angle in radians. |
Returns:
Returns itself.
- Type
- Lore.Quaternion
rotateZ(angle) → {Lore.Quaternion}
- Source:
Rotate this quaternion around the y axis.
Parameters:
Name | Type | Description |
---|---|---|
angle |
Number | An angle in radians. |
Returns:
Returns itself.
- Type
- Lore.Quaternion
set(x, y, z, w) → {Lore.Quaternion}
- Source:
Set the components of this quaternion.
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | The x component of this quaternion. |
y |
Number | The y component of this quaternion. |
z |
Number | The z component of this quaternion. |
w |
Number | The w component of this quaternion. |
Returns:
Returns itself.
- Type
- Lore.Quaternion
setFromAxisAngle(axis, angle) → {Lore.Quaternion}
- Source:
Sets the quaternion from the axis angle representation.
Parameters:
Name | Type | Description |
---|---|---|
axis |
Lore.Vector3f | The axis component. |
angle |
Number | The angle component. |
Returns:
Returns itself.
- Type
- Lore.Quaternion
setFromMatrix(m) → {Lore.Quaternion}
- Source:
Set this quaternion from a (rotation) matrix.
Parameters:
Name | Type | Description |
---|---|---|
m |
Lore.Matrix4f |
Returns:
Returns itself.
- Type
- Lore.Quaternion
setFromUnitVectors(from, to) → {Lore.Quaternion}
- Source:
Sets the quaternion from unit vectors.
Parameters:
Name | Type | Description |
---|---|---|
from |
Lore.Vector3f | The from vector. |
to |
Lore.Vector3f | The to vector. |
Returns:
Returns itself.
- Type
- Lore.Quaternion
setW(w) → {Lore.Quaternion}
- Source:
Set the w component of this quaternion.
Parameters:
Name | Type | Description |
---|---|---|
w |
Number | The w component of this quaternion. |
Returns:
Returns itself.
- Type
- Lore.Quaternion
setX(x) → {Quaternion}
- Source:
Set the x component of this quaternion.
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | The x component of this quaternion. |
Returns:
Returns itself.
- Type
- Quaternion
setY(y) → {Lore.Quaternion}
- Source:
Set the y component of this quaternion.
Parameters:
Name | Type | Description |
---|---|---|
y |
Number | The y component of this quaternion. |
Returns:
Returns itself.
- Type
- Lore.Quaternion
setZ(z) → {Lore.Quaternion}
- Source:
Set the z component of this quaternion.
Parameters:
Name | Type | Description |
---|---|---|
z |
Number | The z component of this quaternion. |
Returns:
Returns itself.
- Type
- Lore.Quaternion
subtract(q) → {Lore.Quaternion}
- Source:
Subtract another quaternion from this one.
Parameters:
Name | Type | Description |
---|---|---|
q |
Lore.Quaternion | A quaternion. |
Returns:
Returns itself.
- Type
- Lore.Quaternion
toRotationMatrix() → {Lore.Matrix4f}
- Source:
Create a rotation matrix from this quaternion.
Returns:
A rotation matrix representation of this quaternion.
- Type
- Lore.Matrix4f
toString() → {String}
- Source:
Returns a string representation of this quaternion.
Returns:
A string representing this quaternion.
- Type
- String