Interpolation using Squad

Started by
0 comments, last by Pokemonster 19 years, 7 months ago
Hi! I'm trying to smoothly interpolate some camera orientations. It works fine so far using slerp, but unfortunately it's a little jaggy... So I'm trying to use a cubic interpolation aproach now. The thing is, to calculate the in between points, I need the key orientations before and after my keys I wish to interpolate. That is interpolating from q1 to q2 I need q0 and q3. So my question is, I'm not quite sure what to do at the start and end points. Interpolating a spline, I would just stretch the first and last points and use those. But how is this done using quaternions? Is it ok if I just use the start and end point again? I'm trying that now and I get some pretty weird results.
Advertisement
Ok, I figured out how to get the additional points.
One article stated to use slerp with a factor of 2.0 between q[first+1] and q[first] (to get q[first-1]). Same goes for the last quaternion in the path.
But I'm still not getting correct results. There is no smooth path between my control points (e.g. the camera orientation at t=0.5 is nowhere near where it's supposed to be).
Im using the following code to get the in between points. (calling with (q-1, q0, q+1) and (q0, q+1, q+2) for an interpolation from q0 to q+1.

Quaternion Quaternion::innerQuadPoint( Quaternion& q0, Quaternion& q1, Quaternion& q2 ){    vector3f vTemp, vTemp1, vTemp2;    Quaternion qIntermediate1, qIntermediate2, qResult;    vTemp1 = Quaternion::log( q1.inverse() * q0 );    vTemp2 = Quaternion::log( q1.inverse() * q2 );    vTemp = (vTemp1 + vTemp2) * (-0.25f);    qIntermediate1 = q1 * Quaternion::exp( vTemp );    return qResult;}


Any hints?

This topic is closed to new replies.

Advertisement