# how to extrapolate quaternions?

var rot = q2 * Quaternion.Inverse(q1); // rot is the rotation from t1 to t2
var dt = (t3 - t1)/(t2 - t1); // dt = extrapolation factor
var ang: float;
var axis: Vector3;
rot.ToAngleAxis(ang, axis); // find axis-angle representation
if (ang > 180) ang -= 360; // assume the shortest path
ang = ang * dt % 360; // multiply angle by the factor
q3 = Quaternion.AngleAxis(ang, axis) * q1; // combine with first rotation


is this the right way to extrapolate quaternions to q3 from q2 using q1?

-

## 1 Answer

There is no right way to extrapolate (or interpolate!) quaternions. It seems you are interested in rotations. Start to look into the simpler question of how to define "means" of rotations. There is a lot of work on this ( and similar) problems lately, you will find some good papers by searching for "means of rotation matrices" (type that into google, without the quotes. Then the first paper showing, by Moakher, is quite interesting) What is the relationship between interpolation and means? If you want to linearly interpolate a function $f(x)$ between $x_1$ and $x_2$, then the linear interpolator is simply a weghted mean $$w_1 x_1 + w_2 x_2$$ where the weight are differnt for each interpolation point. How can we define means outside of vector spaces, say in metric spaces or Riemannian manifolds?

By using Fréchet means (look it up in Wikipedia I wrote most of that wiki page).

There are some problems --- While the arithmetic mean on a vector space is unique, Fréchet means on manifolds might not be unique (and they will not be for rotation matrices or quaternions!) But in the non-unique cases, if the total variance of the data is not too large, there will still be some unicity. To look on an extreme case of non-unicity, take the circle, with two data points, the north and the south pole. Then, following Winnie Pooh, there are two minimizers, namely the east and the west pole!

But in the case the data space is a Hadamard manifold, meaning it has everywhere non-positive curvature, the Frechet mean will be unique. The circle of course has positive curvature.

-