   Quaternion Key Compression
  Hi,I'm using quaternion squad method to interpolate my animation data.The original data is made in uniformly-intervaled quaternion keys.I've implemented a lossy quaternion data compression algorithm byeliminating the original keys in proper order until some error margincondition is met. ( just like general mesh simplification algorithm )After running this algorithm, I got non-uniform quaternion samplesand I realized the interpolation result inevitably should be weird because the squad algorithm is originally time-indepent.I was wondering if there is a high-order time-dependent quaternioninterpolation formula or there is an well-known algorithm to reduceuniform quaternion keys.Kyung   
  Hi Kyung,you could use spherical linear interpolation(slerp):– Let q1 und q2 be two unit quaternions and let parameter t €[0, 1]. Then is – s (q1, q2, t) = (q2q1^(-1))^(t)q1 = slerp(q1, q2, t) = q1 × sin(phi(1 –t)) / sin(phi) + q2*sin(phi*t) / sin(phi)– with cosj = w1w2 + x1x2 + y1y2 + z1z2 = q1*q2(inner product)– this should calculate for t = [0, 1] the shortest way between q1 and q2 on the four-dimensional unit sphere (->angle)I haven't had a look on the subject for quite a long time, but i think this should be correct. Hope I could help a bit. If you need more info, search gamedev or google for "Quaternions slerp" or "Quaternions spherical linear interpolation", or drop me a pm.Martin   ;  Just use "nlerp" (normalized lerp). You can't tell the difference, it's easier, and it's faster. It should also work with the original lossy compression scheme you mentioned.Given two quats, q0, q1, and some t value in [0,1]:q' = normalize( lerp( q0, q1, t ) )Before lerping, if you haven't already guaranteed your quats aren't anti-podal, you may want to do so by checking their dot product (if < 0, they are anti-podal, meaning you should negate one of them before lerping, else you'll interpolate the long-way around the s4 sphere, which ends up looking funny for animations).Surely someone will come along and disagree with me, but I've never seen nlerp fail in anything I've worked on. Just as a little backup, I believe I've read Tom Forsyth swearing by it as well (worked on/authored Granny animation package, etc.).   ;  Thanks for replies.But I really need the interpolation algorithm to be high-ordered rather than slerp or lerp for quality reason. When you connect two different animation data ( from attacking motion to running motion for example ), visual quality gap is so huge between slerp and squadthat anyone can tell the difference.Squad requires four different quaternions to interpolatemiddle two. But the problem is that the formula seemsto assume three delta t's to be equal.How can I resolve this?Kyung   ;  Can you post a link to your source(not sourcecode) for the squad interpolation, so that i can have a look at it? that way we are talking on the same basis.<edit> By the way: if you need such fine interpolation, why don't you use good old matrices for your animation? IMHO Quaternions are not always the universal solution </edit>   ;  http://www.theory.org/software/qfa/writeup/node12.htmlSquad is just a cascade of slerp.When you have four consecutive quaternions a, b, c, dand want to interpolate between b, c in betterquality than slerp, you can do the following :q = Slerp( Slerp( a, d, t ), Slerp( b, c, t ), 2t( 1 - t ) )It's just like Catmull-Rom produces better result thana linear interpolation for positions if you have two additionalpositions or tangents of the ends of the segment.As far as I know, squad is the only high-order interpolationmethod for rotation which also can be used in real-time.There's nothing wrong with using quaternions instead of matricsfor rotation because they are equivalent.Kyung;  If your 4 keys have times t0, t1, t2 and t3, you can find a smooth function F such that F(t0)=0, F(t1)=1, F(t2)=2 and F(t3)=3. Maybe you can define it with splines. Then use F to convert your time t into a "stretched time" that you can then use with the algorithm you linked to.Let me know if that gives you acceptable results.   