quatSlerp
quatSlerp(
a,b,t):Quat
Defined in: src/modules/math/quat.ts:160
Spherical linear interpolation from a to b: the blend that turns at a
constant angular speed, so an eased camera sweep does not accelerate
through the middle the way a component-wise lerp does.
Takes the shortest path: when a·b < 0, b is negated first, so a
quarter turn stays a quarter turn instead of running the long way round —
and t = 1 then yields -b, the same rotation rather than the same
components. Nearly-parallel inputs (a·b ≥ 1 - 1e-6) leave the rotation axis
undefined, so that branch blends component-wise and renormalises rather than
dividing by sin(theta) ≈ 0.
t is unclamped (t = 2 is a legal extrapolation), matching lerp,
lerpAngle and vec3Lerp; compose with modules/math’s clamp01 for a
bounded blend.
Both inputs must be unit quaternions — normalise at the boundary. The result is unit for unit inputs, so it can be fed straight back in.
Parameters
Section titled “Parameters”number