Given two unit quaternions q0 and q1 (each a list of four numbers ordered [w, x, y, z]) and an interpolation parameter t in the range [0, 1], write a function slerp(q0, q1, t) that returns the interpolated quaternion as a list of four floats. At t = 0 the result should match q0 and at t = 1 it should match q1, following the shortest rotational path between the two orientations.
slerp([1,0,0,0], [0,1,0,0], 0.5)
[0.707107, 0.707107, 0.0, 0.0]
The two quaternions are separated by a 90 degree angle in quaternion space. Interpolating halfway yields a unit quaternion equidistant from both, with equal weighting on the first two components.