Computer Graphics 266
Index |
Lab 0 |
Lab 1 |
Lab 2 |
Lab 3 |
Lab 4 |
Lab 5
Lab 1:
Implement a basic keyframing motion control system. Given an input set of key positions
and orientations of a rigid object, the system should generate an interpolated motion. The
system should accept positions and orientations given in Euler angles or quaternions. The
in-betweening should be done by Catmull-Rom or B-splines. Generate some animations to show
the difference between using Euler angles and quaternions and the two splines.
Splines:
Here are the same rotational and positional keyframes interpolated first linearly, then with
B-splines, then with Catmull-Rom splines. Note that the B-Spline approximates rather than
intersects the keyframes, with the path confined within the convex hull of the four nearest
keyframes. Also note that the motion of the Catmull-Rom spline is much smoother than that of
the linear interpolation.
None of the curves are parametrized with respect to arc length, so each segment takes the
same amount of time to traverse.
|
|
Linear Interpolation
|
|
Catmull-Rom Spline
|
|
B-Spline
|
Euler Angles and Quaternions:
Using quaternions to interpolate between two orientations always yields the shortest
possible path between the orientations. By contrast, different sets of Euler
angles can yield any number of of different paths between the same two orientations.
Here is a rotation of 200 degrees about the x-axis, 80 degrees about the y-axis,
and 30 degrees about the z-axis in the xyz rotate order. For this animation, I used
the bottom of the heart rather than the center as the pivot in order to better show the
keyframes.
As the quaternion interpolation shows, this set of Euler angles is clearly not the most
efficient way to get from the first orientation to the second. The reason is that the 80
degree rotation about the y-axis brings the system very close to gimbal lock. The closer
the y-rotation is to 90 degrees, the more the x-axis is aligned with the z-axis, and the
more the rotation about the x-axis resembles rotation about the z-axis. By the
end of the animation, it's as if the rotation about the x-axis had never happened, which
is why the quaternion interpolation effectively ignores it.
Here are the keyframes from my first set of animations, interpolated linearly first using
Euler angles, then using quaternions. The quaternion interpolation yields the shortest
path between orientations, but the Euler angle interpolation also yields fairly short paths.
So the difference between the two is obvious when the quaternion interpolation flips the
direction of rotation, but subtle otherwise.
|