Interpolates between two quaternions by blending their components and normalizing the result: cheap, with a non-constant angular speed. It does not take the shorter way around: if the two quaternions are more than 90 degrees apart (negative dot_product), negate one first, as slerp does.
a := Quaternion.{};
b: Quaternion;
set_from_axis_and_angle(*b, xyz(0, 0, 1), PI / 2);
m := nlerp(a, b, 0.5);
assert(abs(length(m) - 1) < 0.0001);
assert(nlerp(a, b, 0) == a);nlerp :: (p0: Quaternion, p1: Quaternion, fraction: float) -> Quaternion
Interpolates linearly, then normalizes the result.
Parameters
- p0: Quaternion
- the quaternion at
fraction0. - p1: Quaternion
- the quaternion at
fraction1. - fraction: float
- how far from
p0top1, from 0 to 1.