vector part, X
vector part, Y
vector part, Z
scalar part; the identity rotation is (0, 0, 0, 1)
scalar part; the identity rotation is (0, 0, 0, 1)
vector part, X
vector part, Y
vector part, Z
the four-dimensional dot product; 1 for two equal unit quaternions
Reset to the identity rotation (0, 0, 0, 1)
Replace by the inverse rotation. For a unit quaternion that is the
conjugate (-x, -y, -z, w); a non-unit quaternion is also divided by
its squared length.
this = this × other: apply other first, then this rotation
Scale to unit length. The zero quaternion becomes the identity.
this = other × this: apply this rotation first, then other
Set to the rotation by angle radians around axis.
a unit vector
in radians, counter-clockwise when looking down the axis
Set from Euler angles in radians, applied in XYZ order: the same
rotation as Mat4.compose(position, rotation, scale) builds.
Spherical linear interpolation: move this rotation towards other
along the shortest arc, at constant angular speed.
the rotation at t = 1
interpolation factor from 0 (this) to 1 (other)
[x, y, z, w]
Staticfrom[x, y, z, w], as stored in a glTF node
index of x in values
Staticfromthe rotation by angle radians around a unit axis
Staticfromthe rotation given by Euler angles in radians, XYZ order
StaticfromStaticidentitythe identity rotation
A rotation as a unit quaternion
(x, y, z, w): the rotation byanglearound a unitaxisis(axis * sin(angle / 2), cos(angle / 2)).Multiplying two quaternions composes their rotations in the same order as matrices (
a.multiply(b)appliesbfirst), andslerpinterpolates between two rotations along the shortest arc. Operations work in place and returnthis; useclone()first if the original is still needed.The methods that produce a rotation (
setFromAxisAngle,setFromEuler,setFromRotationMatrix,slerp) return a unit quaternion for unit inputs. After manymultiplycalls,normalize()removes accumulated rounding error.