FINAL PROJECT: the Jello Cube Spring
Winter 2003 CMPS 161: Computer Animation
by  Joel Petersen

For my final project I constructed a physics model of a Jello cube.  The basics of it was entirely physics equations such as spring force = -k x and gravitational force -9.8 m/s.  Each node was connected with all the nodes around it through a series of springs, a maximum of 25 springs could attach to each node (those nodes on the outside of the cube, were connected to less nodes).


 

Of those features that I proposed for the project, I was able to complete almost all of them.

COMPONENT/FEATURES:
X-I will probably have a slider to allow the user to decide the tension and dampening of the springs.
X-I will probably have a slider that will allow the user to decide how many nodes are in a cube.
X-I will allow the cube to interact with the ground, if I have more than one cube I will allow them
    to interact.  These things mean I will be enforcing collision detection.
X-Since I will be allowing the cube to interact with the ground I will probably be implementing
     some form of psuedo-gravity (if I have time I will implement a more sophisticated model of
     gravity).
_-I will probably allow the user to effect (pull, push, pick up) cube, hopefully through the use
    of the mouse.
X-I will attempt to make the cubes have the option of being transparent/translucent, as well as
    an option to show the interconnected nodes and the lines that connect them.
X -If I have time I was hoping to possibly change the colors depending on the amount of force being
   exerted on that node, thus implementing some type of visualization of the forces.
X -Most importantly I intend to make sure that the Jello Cube wiggles.

Design Cycle: (listed in order of implementation)
X-Make a spring simulator (probably linear)
X-Make slider to vary the spring tension and dampening for testing and for presentation value
X-Make a matrix of nodes interconnected with springs simulators (make sure to make it dynamic).
X-Display matrix as nodes with lines to represent springs.
X-Make slider that will change number of nodes in a cube.
X-Make collision detection.
X-Make fake gravity.
_-Make way for user to nudge cube, pick up cube, drop cube.
_-Implement replacement of lines representing springs with linear representation of spring
   used earlier for testing purposes.
X-Implement Transparency option/Translucency option, Probably pretty hard but should look
    good, if I can do it, otherwise will only go with non-transparent color changing cube option.
X-Implement color dependency on force.
_-Implement Multiple Cubes.

User Interface:
           World Manipulation:
                  Rotate world sliders:
                                        Allow the user to rotate world.
                            x: slider from -360 to +360, rotates world in x axis
                            y:  "                                                                " y axis
                            z:  "                                                                " z axis
                  Zoom slider: translates in the z direction -200 to 50
            Light Manipulation: (caution: light source not at sphere's location light off screen, sphere just
                                           for user approximation of light location )
                    Light location sliders: Allow the user to maneuver the light arround shark/3D Model
                            x: slider from -100 to +100, moves light along x axis
                            y:          "                                                           " y axis
                            z:          "                                                           " z axis
                    Using mouse cursor and z slider:
                                          Not 100% exact and will return to origin of axis if click anywhere but on
                                          sphere. Allows more intuitive manipulation of light location by allowing
                                          user to drag sphere and light arround screen: The flaw is that if sphere at
                                          origin must click and hold mouse key down to move sphere and cursor
                                          overlapping.
             Properties Sliders:
                      NumOPoints: Manipulates the number of nodes in the cube, for each move, 3 nodes will be added to the
                                          Cube.
                      Levitate:         Moves the Jello upwards in the Y direction.
                      Thickness:      Manipulates each nodes mass or weight, while symultaneously increasing or decreasing the cube's alpha values.
                      Spring Dampening:  Manipulates the amount of damping that occurs within each spring.
             Colors Buttons: Using the standard blue to red color mapping
                       Velocity:   Maps the color according to magnitude of the velocity vector of each node.
                        Mass   :    Really very uninteresting except that when manipulating the Thickness slider with this option on
                                         it becomes obvious how much the color is changing.
                        Forces:    Color maps the magnitude of the force being applied to each node.
              Save Pic:          Used to begin the cycle of saving frames to files which can be combined using a special program of Professor Pang's.

Algorithms:
            -In order to get animation to work, I had to work off of a fellow student's main.cxx. I cited them in the file.
            - I spent many a hour trying to get my cube to exist within a stable environment, I had to find the perfect balance of dampening
                as well as the spring constant.  I also had a great deal of problems implementing a satisfactory dampening method.
            - For the coloring I took that directly from class.
            - Most of the physics I worked out using a physics book, a Nehe demo and www.myphysicslab.com
 
People I would like to thank:
    Clint, Nate Lieby, Sean Cosgrave, Yue Xu, and anonomous student with whom I discussed the sin wave swim.
And Rachel Whiting for kind tolerance of my working long hours.