# Method for interpolation between 3+ quaternions?

I'm currently using spherical linear interpolation (slerp) to interpolate between two quaterions with a weighted value. But, I'm having a difficult time coming up with a method to interpolate between 3, 4, 5, etc quaternions with normalized weights.

I.E. I want a final quaterion which is 60% of QuaterionA, 30% of QuaterionB and 10% of QuaterionC.

Thanks, Cameron

You could try slerping between A and B based on their relative weights, then slerping the result to C based on its weight.

For instance, in your example, A and B have a total weight of 90%. Use this to normalize their weights to get A' = 66.7% and B' = 33.3%, so slerp from A to B by 33.3% (or B to A by 66.7%, equivalently). Then slerp from that result to C by 10%.

For ordinary linear interpolation this is equivalent to adding up points weighted by barycentric coordinates (i.e. the usual method of interpolation for triangles). As you would expect, for linear interpolation it doesn't matter what order the points are in - you get the same answer regardless.

In the case of slerping, I don't know if you get the same answer regardless of the order of points, but you could try it and see.

For more than 3 points, you could extend this method to incorporate points one by one, using weights normalized by the sum of weights of all the points you've incorporated so far.

• Thank you for the swift reply. That makes a lot of sense (kind of reminds me of a animation blend tree). I've implemented your solution and it appears to work in my test cases! Sep 18, 2013 at 0:01
• Note that the math on this boils down to aA+bB+cC = (1-c)D+cC, where since 1-c=a+b (a+b+c=1), D=(a/(a+b))A+(b/(b+b))B. I believe there will be minor differences depending which direction you choose to slerp, but I haven't tried the experiments... Sep 18, 2013 at 0:19
• There will be differences -- potentially major ones -- depending on which order you do the interpolation. My advice is to avoid interpolating between >2 quaternions if you can possibly can do so. (For example, I commonly have camera behaviours specify a position, a target, and an 'up' direction, rather than just a position and an orientation, specifically so that I can reliably blend between more than two of them) Sep 18, 2013 at 2:16

A more generic approach is detailed on Wikipedia. Essentially, that article explains there's no non-iterative method to find the generalized combination of N quaternions with weigths w_i. Nevertheless, if you can supply an approximation of that quaternion "mean", you can iteratively refine it using these update equations:  So you could start with m_0 as Nathan Reed suggested and apply how many iterations you need.

More details on quaternion calculus can be found on Dave Eberly's site.

Special care must be given when juggling hypercomplex logarithms and exponentials as they're not entirely similar to their lower dimensional homologues. (I think the log, for example, isn't injective). More details on what applies and what doesn't are given here. (most nice properties are preserved for unit quats).

• Indeed. This is related to interpolating on the sphere Sep 18, 2013 at 9:54
• @PeterTaylor very valuable paper that you've linked there (esp the solid and elegant mathematical approach - might be too hard for a non-maths person to digest) Sep 18, 2013 at 10:48