News for hackers. Stuff that matters.
Re:Rotations with quaternions by darkstarsys on Tuesday June 01, 2021 @09:57AM (#27354552)
This is good, thanks. But a much more interesting problem I haven't seen a good writeup for is how to interpolate smoothly between quaternions at different times. Quaternion slerp has jerks (C_0 but not C_1 or C_2) at the keyframes.
Re:Rotations with quaternions by dahart on Tuesday June 01, 2021 @10:49AM (#27355246)
Ken Shoemake’s 1985 Siggraph paper “Animation Rotation with Quaternion Curves”, that brought quaternions to computer graphics, covered this. The idea is to use quaternions as control points in a spline the same way you would use 3d points in a spline. You could have a series of quaternion orientations, and connect them with C_2 continuity by using a connected series of piecewise cubic Bezier splines.

The abstract mentions it: “This paper gives one answer by presenting a new kind of spline curve, created on a sphere, suitable for smoothly in-hetweening (i.e. interpolating) sequences of arbitrary rotations.” And the final punch line is section 4.3, then you can work through the details in the earlier sections.

https://www.cs.cmu.edu/~kiranb/animation/p245-shoemake.pdf

Re:Rotations with quaternions by xaedes on Thursday June 03, 2021 @01:25PM (#27384532)
You can use bezier splines (https://ibiblio.org/e-notes/Splines/bezier.html). These just use linear interpolation, multiple times. In the case of quaternions replace the linear interpolations with quaternion slerps and you get quadratic bezier splines over orientations.
Re:Rotations with quaternions by chombier on Tuesday June 01, 2021 @01:09PM (#27357857)
I've used "A General Construction Scheme for Unit Quaternion Curveswith Simple High Order Derivatives" in the past, and while not perfect it was generally good enough and fairly easy to implement.

Basically it extends Hermite splines to Quaternion splines using the Lie group operations.

Re:Rotations with quaternions by gilbetron on Tuesday June 01, 2021 @10:27AM (#27354991)
It's been a while for me, but iirc, there's two ways you can slerp between two quaternions, and by using the shortest path, you can avoid the jerk.