Quaternion
Defined in: client/api.d.ts:1735
Mutable quaternion exposed as Core.Quaternion for three-dimensional rotations. Components are scalar-first (w, x, y, z), matching GLM — not the x, y, z, w order some libraries use.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Quaternion(
w,x,y,z):Quaternion
Defined in: client/api.d.ts:1743
Creates a quaternion in scalar-first w, x, y, z component order. Watch the trap: the scalar w is the first argument, unlike the x, y, z, w order used by some other libraries.
Parameters
Section titled “Parameters”number
Initial scalar component (comes first — this is not x, y, z, w order).
number
Initial X imaginary component.
number
Initial Y imaginary component.
number
Initial Z imaginary component.
Returns
Section titled “Returns”Quaternion
Methods
Section titled “Methods”clone()
Section titled “clone()”clone():
Quaternion
Defined in: client/api.d.ts:1842
Creates an independent copy of this quaternion.
Returns
Section titled “Returns”Quaternion
New quaternion with the same components.
conjugate()
Section titled “conjugate()”conjugate():
Quaternion
Defined in: client/api.d.ts:1792
Computes the conjugate without changing this quaternion.
Returns
Section titled “Returns”Quaternion
New conjugated quaternion.
dot(
other):number
Defined in: client/api.d.ts:1813
Computes the quaternion dot product.
Parameters
Section titled “Parameters”Quaternion
Quaternion used for the dot product.
Returns
Section titled “Returns”number
Scalar dot product.
inverse()
Section titled “inverse()”inverse():
Quaternion
Defined in: client/api.d.ts:1798
Computes the inverse rotation without changing this quaternion.
Returns
Section titled “Returns”Quaternion
New inverse quaternion.
mul(
other):this
Defined in: client/api.d.ts:1780
Composes this rotation with another quaternion in place.
Parameters
Section titled “Parameters”Quaternion
Rotation composed after this quaternion.
Returns
Section titled “Returns”this
This mutated quaternion for chaining.
normalize()
Section titled “normalize()”normalize():
this
Defined in: client/api.d.ts:1786
Normalizes this quaternion in place; a zero quaternion becomes the identity rotation instead of NaN.
Returns
Section titled “Returns”this
This unit quaternion for chaining.
rotateVector()
Section titled “rotateVector()”rotateVector(
vector):Vector3
Defined in: client/api.d.ts:1820
Applies this rotation to a vector without mutating either value.
Parameters
Section titled “Parameters”vector
Section titled “vector”Vector to rotate.
Returns
Section titled “Returns”New rotated vector.
set(
w,x,y,z):this
Defined in: client/api.d.ts:1836
Replaces all quaternion components in place.
Parameters
Section titled “Parameters”number
Replacement scalar component.
number
Replacement X imaginary component.
number
Replacement Y imaginary component.
number
Replacement Z imaginary component.
Returns
Section titled “Returns”this
This mutated quaternion for chaining.
slerp()
Section titled “slerp()”slerp(
target,t):this
Defined in: client/api.d.ts:1806
Spherically interpolates this quaternion toward a target in place.
Parameters
Section titled “Parameters”target
Section titled “target”Quaternion
Destination rotation.
number
Interpolation factor; 0 keeps the current rotation and 1 reaches target.
Returns
Section titled “Returns”this
This mutated quaternion for chaining.
toEuler()
Section titled “toEuler()”toEuler():
Vector3
Defined in: client/api.d.ts:1826
Converts this rotation to Euler angles in radians.
Returns
Section titled “Returns”Pitch, yaw, and roll as a Vector3.
toJSON()
Section titled “toJSON()”toJSON():
object
Defined in: client/api.d.ts:1854
Converts this quaternion to a plain object for JSON.stringify.
Returns
Section titled “Returns”object
Object containing the current components.
w:
number
x:
number
y:
number
z:
number
toString()
Section titled “toString()”toString():
string
Defined in: client/api.d.ts:1848
Formats this quaternion for logging and debugging.
Returns
Section titled “Returns”string
Text in Quaternion(w, x, y, z) form.
fromAxisAngle()
Section titled “fromAxisAngle()”
staticfromAxisAngle(axis,angle):Quaternion
Defined in: client/api.d.ts:1877
Creates a rotation around an axis.
Parameters
Section titled “Parameters”Rotation axis; it is normalized internally.
number
Rotation angle in radians.
Returns
Section titled “Returns”Quaternion
New axis-angle rotation quaternion.
fromEuler()
Section titled “fromEuler()”
staticfromEuler(pitch,yaw,roll):Quaternion
Defined in: client/api.d.ts:1869
Creates a rotation from Euler angles.
Parameters
Section titled “Parameters”number
Pitch angle in radians.
number
Yaw angle in radians.
number
Roll angle in radians.
Returns
Section titled “Returns”Quaternion
New rotation quaternion.
identity()
Section titled “identity()”
staticidentity():Quaternion
Defined in: client/api.d.ts:1860
Creates the identity rotation.
Returns
Section titled “Returns”Quaternion
New Quaternion(1, 0, 0, 0).
Properties
Section titled “Properties”length
Section titled “length”
readonlylength:number
Defined in: client/api.d.ts:1768
Read-only magnitude (norm) of this quaternion; 1 for a unit rotation.
lengthSquared
Section titled “lengthSquared”
readonlylengthSquared:number
Defined in: client/api.d.ts:1773
Read-only squared magnitude, avoiding a square-root calculation.
w:
number
Defined in: client/api.d.ts:1748
Mutable scalar component.
x:
number
Defined in: client/api.d.ts:1753
Mutable X imaginary component.
y:
number
Defined in: client/api.d.ts:1758
Mutable Y imaginary component.
z:
number
Defined in: client/api.d.ts:1763
Mutable Z imaginary component.
