5

As I understand slerp interpolates between two quaternions and returns an unit quaternion. So if I want to average 3 quaternions could I do(Assuming they all are close to each other):

Eigen::Quaterniond t4;
Eigen::Quaterniond u4;
Eigen::Quaterniond v4;
Eigen::Quaterniond average1 = t4.slerp(0.5, u4);
Eigen::Quaterniond average2 = average1.slerp(0.5, v4);

Intuitively it makes sense to me, but then again its quaternions we're talking about.

Hakaishin
  • 2,550
  • 3
  • 27
  • 45
  • Yes you can. But be carefull to used weights . Provided code average rotations with weights t4 - 0.25 u4 - 0.25 v4 - 0.5 – minorlogic Jul 25 '18 at 07:01
  • I don't understand your comment, looking at the formula on wikipedia it seems that t 0.5 would interpolate the middle back, right? – Hakaishin Jul 25 '18 at 07:45
  • assume 3 values a1 = 1, a2 = 2, a3 = 3, lets average it (1+2+3)/3 = 2 but t1 = a1*0.5 +a2*0.5 = 1*0.5 + 2*0.5 = 1.5 result = t1*.05 + a3*0.5 = 1.5*0.5 + 3*0.5 = 1.25 + 1.5 = 2.75 – minorlogic Jul 25 '18 at 08:26
  • Now I see your point, but this is not a big problem if all 3 are close to each other, right? Or how would I go about finding better weights? – Hakaishin Jul 25 '18 at 08:36
  • It can change interpolated trajectory and speed of interpolated object (in saddle points). For quaternions that are close , can be used linear interpolation LERP. Don't forget to flip signs of lerped quaternions , if their dot product negative. And use normalization after LERP – minorlogic Jul 25 '18 at 09:23

0 Answers0