Quaternions – How to Interpolate Rotation Quaternions

quaternions

Suppose I've got two quaternions that each represent an angle. I need to interpolate between these two angles (from 0% to one side to 100% to another side).

Since I work a lot with complex numbers, I'd thought about getting the "arg" of these quaternions, averaging them, and creating a new quaternion. But then I don't think quaternions have "args" or anything like that..

How does one go around getting an interpolation between two quaternions?

I come from a computer programming background, so all I have is a quaternion class I "inherited" from some tutorial on the web somewhere.

Best Answer

Usually (unit) quaternions represent rotations in 3D. Is that what you mean when you say they "represent an angle"? If you have two (unit) quaternions that each represent a rotation, they're both represented by unit vectors on the hypersphere. There are basically two ways to interpolate between them, a simpler way and a more complicated way that might have preferable properties, depending on what you need this for.

The simpler way is to take convex combinations of the two unit vectors ($\lambda$ times one and $1-\lambda$ times the other, with $\lambda\in[0,1]$) and then normalize them to obtain a unit vector again.

The more complicated way is to find the 4D rotation that rotates the plane they lie in (e.g. by orthogonalizing one of them against the other) and then rotate by some fraction of the angle you need to rotate one into the other.

Both methods yield the same set of interpolation results, but with different parameterizations (the second method yielding a "smoother" and "more natural" parametrization).

Either way, in case your quaternions represent rotations about the same axis through different angles, the interpolated quaternions will also represent rotations about that same axis, through angles in between.