|
![](/i/fill.gif) |
Slerp is a very simple algorithm, once you've understood the basics. To
slerp-interpolate, you still use a linear parameter t, just that it is used
as a multiplier for an angle inside a sine-evaluation.
So, you could still just go ahead and interpolate t cubic instead of linear,
and there you go: cubic slerp interpolation.
The formula for the slerp is this:
q1 and q2 are two quaternions, alpha is the angle between the two,
calculated like this:
alpha = acos( s1*s2+vdot(v1,v2)) , where s1 and s2 are the real parts of the
quaternion, and v1 and v2 are the imaginary vector parts.
So q(t) = (sin((1-t)*alpha)/sin(alpha))*q1 + (sin(t*alpha)/sin(alpha))*q2
With a little googling and some math you should be able to get this working
properly.
Regards,
Tim
PS: I'm planning to implement quaternions and interpolations etc myself at
some point, but am currently occupied with some exams and my hair-macros...
;-)
--
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>
Post a reply to this message
|
![](/i/fill.gif) |