Final Project - Math 155B - Student: ERIK HILL

Comments

I did my final project on Quaternions.
I wanted to model a plane to fly smoothly though 3 dimensions. 

The first task was smooth interpolation of positions in 3 dimensions. 
I took the center positions of the objects in the scene and calculated a 
Catmull-Rom curve to interpolate their positions.  I updated the curve 
when a position was changed.  To move along the curve I implemented De Casteljau's
method to grab point positions along the curve.  
 
The next task was to interpolate the rotations that are represented as quaternions. 
In the last project we slerped between two orientations, so I did this for each pair
of successive objects, but then in some situations the rotations were not smooth, since 
slerping gives us the shortest rotation and sometimes this is not what we want for 
smooth motion.  

So, I implemented Ken Shoemake's[1] suggestions for smoothly interpolating multiple 
quaternions in a procedure very similar to catmull-rom interpolation of positions 
and a procedure based on De Casteljau's method, but using slerping to grab the 
intermediate orientations. 
I ran into some problems with this technique, I hope it was not just my implementation. 
I definitely noticed smoother interpolation of rotations, but sometimes it couldn't decide 
whether to rotate the shorter or longer distance and would flip when it got to the q(n)+ 
quaternion and then flip back when it got to the q(n+1)- quaternion(when interpolating between 
quaternions q(n) and q(n+1)).
To fix this, I found if the section between q(n) and q(n)+ was using the longer or shorter rotation
and then forced the sections between q(n)+ and q(n+1)- and between q(n+1)- and q(n+1) to use the
same. 
I also noticed that sometimes there were unnecessary flips inbetween objects.  
Both of these issues can probably be resolved by just adding more intermediate 
objects to get the desired smooth rotation. 

I thought it would be fun to interpolate between colors as well so I implemented that as well. .  

I kept the teapots from the last project around and I modeled a paper airplane and a basic toy like
airplane.  I wanted to spend more time modeling a plane to make it look nice and throw some textures 
on it, but I hit the 25 hour mark. :( 




Here is the first image of a bunch of teapots in different positions in 3 space and 
with different orientations
    


Here are the same teapots with the catmull-rom curve drawn to show how the positions
will be interpolated and they all have different colors. 

    


Here are more starting positions ready for animation
    

Here is the animation...
   	 


Here are some paper airplanes flying around in the clouds. 

   	 

Here are some planes flying in Alaska
   	 

Here are some more planes ready to be interpolated
   	 

Here is an animation of that interpolation. 
Unfortunately, it jumps around a lot, it needs some more screenshots.  You should 
download the executable to get a better animation.
   	 



Get the executable: 
Executable
Zip File - has backgrounds with it

Usage: 

Moving Orientations: 
Left Mouse Button: click and drag to rotate the object
Right Mouse Button: click and drag to move in the x-y plane
Middle Mouse Button: click and drag up and down to move in the z direction
(For those of us without middle buttons, or think it is easier): 
z: Press and hold to move objects closer 
Z: Press and hold to move objects further away

Motion: 
i: interpolates the objects
d: decreases the speed of the motion, for the next i press
D: increases the speed of the motion, for the next i press
.: Toggles between shoemake's method and my first one

Adding Objects: 
+: adds another object
-: deletes the last object that was added

Different Objects and Backgrounds: 
o: changes all objects in the scene to a new type
t: changes the background

Viewing: 
l(letter L): draws the path of the motion(a catmull-rom curve)
             press again to delete curve
x: removes all objects from view
   press again to get them back
r: make the object you are manipulating more red
g: make the object you are manipulating more green
b: make the object you are manipulating more blue
0(Zero): makes the object you are manipulating white again
s: makes all objects bigger
S: makes all objects smaller

Alternate Manipulation: 
Once the position, especially in the z direction changes, 
it becomes hard to select an object to move it.  
Instead of doing a lot of work to figure out the new bounding box for the mouse
I implemented the following. 
n: Press this to control which object to manipulate by pressing numbers. 
Now...
1: Press this and mouse controls anywhere will affect the 1st object. 
2-9: work similarly for objects 2 thru 9. 

Press n again and the mouse will only move objects it is over. 


Paper's Read: 
[1] K. Shoemake, Animating rotation with quaternion curves, Computer Graphics, 19(1985), pp. 245-254.
    SIGGRAPH'85