Members
(static) equals
Returns whether or not the quaternions have approximately the same elements in the same position.
(static) exactEquals
Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)
(static) rotationTo
Sets a quaternion to represent the shortest rotation from one
vector to another.
Both vectors are assumed to be unit length.
(static) setAxes
Sets the specified quaternion with values corresponding to the given
axes. Each axis is a vec3 and is expected to be unit length and
perpendicular to all other specified axes.
(static) sqlerp
Performs a spherical linear interpolation with two control points
Methods
(static) add(out, a, b) → {quat}
Adds two quat's
Parameters:
Name | Type | Description |
---|---|---|
out |
quat | the receiving quaternion |
a |
quat | the first operand |
b |
quat | the second operand |
Returns:
out
- Type
- quat
(static) clone(a) → {quat}
Creates a new quat initialized with values from an existing quaternion
Parameters:
Name | Type | Description |
---|---|---|
a |
quat | quaternion to clone |
Returns:
a new quaternion
- Type
- quat
(static) copy(out, a) → {quat}
Copy the values from one quat to another
Parameters:
Name | Type | Description |
---|---|---|
out |
quat | the receiving quaternion |
a |
quat | the source quaternion |
Returns:
out
- Type
- quat
(static) dot(a, b) → {Number}
Calculates the dot product of two quat's
Parameters:
Name | Type | Description |
---|---|---|
a |
quat | the first operand |
b |
quat | the second operand |
Returns:
dot product of a and b
- Type
- Number
(static) fromValues(x, y, z, w) → {quat}
Creates a new quat initialized with the given values
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | X component |
y |
Number | Y component |
z |
Number | Z component |
w |
Number | W component |
Returns:
a new quaternion
- Type
- quat
(static) length()
Alias for quat.len
(static) lerp(out, a, b, t) → {quat}
Performs a linear interpolation between two quat's
Parameters:
Name | Type | Description |
---|---|---|
out |
quat | the receiving quaternion |
a |
quat | the first operand |
b |
quat | the second operand |
t |
Number | interpolation amount between the two inputs |
Returns:
out
- Type
- quat
(static) mul()
Alias for quat.multiply
(static) normalize(out, a) → {quat}
Normalize a quat
Parameters:
Name | Type | Description |
---|---|---|
out |
quat | the receiving quaternion |
a |
quat | quaternion to normalize |
Returns:
out
- Type
- quat
(static) scale(out, a, b) → {quat}
Scales a quat by a scalar number
Parameters:
Name | Type | Description |
---|---|---|
out |
quat | the receiving vector |
a |
quat | the vector to scale |
b |
Number | amount to scale the vector by |
Returns:
out
- Type
- quat
(static) set(out, x, y, z, w) → {quat}
Set the components of a quat to the given values
Parameters:
Name | Type | Description |
---|---|---|
out |
quat | the receiving quaternion |
x |
Number | X component |
y |
Number | Y component |
z |
Number | Z component |
w |
Number | W component |
Returns:
out
- Type
- quat
(static) sqrLen()
Alias for quat.squaredLength
(static) squaredLength(a) → {Number}
Calculates the squared length of a quat
Parameters:
Name | Type | Description |
---|---|---|
a |
quat | vector to calculate squared length of |
Returns:
squared length of a
- Type
- Number