## CS6555 Computer Animation – Lab 1 – Cubic Splines, Quaternions and Euler Angles

In this assignment I was tasked with developing a keyframe based animator capable of rendering a model following a cubic spline. Additionally, the requirements stated that the animator shall support both Uniform Non-Rational B-Splines and Catmull-Rom Splines and stated that the rotational movement calculations shall support both Euler Angle and Quaternion rotations.

The following videos are demonstrations of each of these requirements. The trajectory is that of a Double Immelmann flight maneuver. In each video and in the successive slides, the yellow arc traces the B-Spline trajectory and the red arc traces the Catmull-Rom trajectory.

The following video is a demonstration of the biplane actor following a Uniform Non-Rational B-Spline trajectory with rotations handled by Euler Angles:

This video is a demonstration of the biplane actor following a Catmull-Rom spline trajectory with rotations handled by Euler Angles:

This video is a demonstration of the biplane actor following a Uniform Non-Rational B-Spline trajectory with rotations handled by Quaternions:

This video is a demonstration of the biplane actor following a Catmull-Rom spline trajectory with rotations handled by Quaternions:

It is virtually impossible to distinguish between the euler angle rotations and the quaternion rotations. In fact YouTube kept rejecting the second video of the pair because the checksums reported the video was duplicate.

In the process of developing the Immelman trajectory and for general debugging, several more trajectories were implemented and tested.

The first test was to simply draw a straight line composed of only four control points and to verify that the linearly interpolated arclength matched the expected overall arclength. In both cases, the arclength matched the expected and the line was drawn properly. In the below render, only the Catmull-Rom is visible because the B-Spline was drawn first and overdrawn by Catmull-Rom.

The second test was to evaluate a circle curve where the arclength over the circle should be $2\pi$. In this case, Catmull-Rom approximated the circle better than B-Spline and the arclength of Catmull-Rom was less than 1% relative error of the expected value while B-Spline was closer to 13% relative error. In the visualization, it is clear that even though Catmull-Rom is a better approximate, it still has continuity problems at the ends and doesn't fully approximate the circle.

This example demonstrates a fundamental that will be consistently demonstrated in all following tests where Catmull-Rom is a better approximation of the curve than Uniform Non-Rational B-Spline; however, Catmull-Rom can demonstrate continuity problems at control points because it is not as relaxed as Uniform Non-Rational B-Spline.

The third test was to evaluate a sine curve. The sine curve was composed of six control points with four median points marking the curve and two end control points matching the coordinates of the medians at the ends of the curve. The arclength over the sine curve should be the the integral of sine over the interval $[0,2\pi]$. Catmull-Rom approximates the curve to less than 1% relative error while B-spline approximates to around 20% relative error.

To develop the Double Immelmann, first the Immelmann was defined...

Followed by developing the Double Immelmann...

The continuity problems of Catmull-Rom are better demonstrated in the following joined spline example. In this case, the frequency of the sine function is changed and because of this joint between the spliced splines, there is a clear and significant problem with the continuity at the joint.

In order to smooth out the spline, removing the control point in this case eliminates the continuity problem, but the spline is no longer approximating the same function. Conversely, the B-Spline was not significantly altered from the above example with or without the splice control point; however, on close inspection, it is clear that the function it is approximating is different once the splice control point is removed.

A final trajectory that was tested is the loop which is just an extension of the circle curve. It was expected that extending the trajectory beyond the bottom of the circle might allow Catmull-Rom to better approximate the circle; however, this expectation was not realized. It does however smooth the continuity problems demonstrated in the pure circle test above at the control points marking $(\frac{\pi}{4},-\frac{\pi}{4})$ and $(-\frac{\pi}{4},-\frac{\pi}{4})$.