CS 5643 Assignment #1
 
Mass-Spring Particle Systems


Professor:
Doug James

Due date: Sun, Feb 15 (before midnight).


In this first assignment you will experiment with particle systems, modifying a skeleton interactive program to add new behavior.


Groups:
Work on your own, or in a group of at most two people. 


Starter Code (cs567.particles): This project has starter code (zip), primarily to support OpenGL rendering and a simple Swing GUI. Online Javadoc documentation here. In this assignment, you will modify this package as needed.

Videos: Please submit videos (described below) that demonstrate the requested (and any additional) functionality of your system. Details on video generation are here.  The current starter code allows you to use the 'e' key to toggle exporting of png frames to the "frames" subdirectory.

Software Dependencies:
  The starter code will compile and run using JDK 1.5 or later. I recommend you get Sun's latest JDK6 here. In addition to Java the starter code also uses two other libraries:

Assignments Steps: The starter code allows you to build particle systems, but you will quickly discover that some things are broken or just implemented poorly. Here are the steps you need to address:
1.  Implement Spring Forces:  Three spring forces currently do nothing:
and need to have their  apply_force()  function implemented.  The first two should use a damped Hookean spring (as in the Witkin course notes), whereas the second can use the bending force derived in class (here is a simple derivation of that bending force).  Following these implementations, your "Create Spring" and "Create Hair" tasks should have more meaningful results. 
Generate a video demonstrating a hair model with these force implementations.


2.  Implement Gravity and Viscous Damping Forces: Currently gravity and viscous damping are "hacked" into ParticleSystem.advanceTime(), and conflate integration and physical modeling. Implement some global Force objects,
and add these to the ParticleSystem (immediately after its construction) to properly apply these forces to all particles.
Generate a video demonstrating your gravity and viscous damping forces.  Suggestion: you can change the direction of gravity to be at an angle, or even be rotating to make the dynamics inside your box more interesting.

3.  Implement Numerical Integrators using Witkin's Interface: The current forward Euler implementation is flakey, and hard coded---it doesn't support proper abstractions to enable easy swapping in/out of different integrators. Implement an Integrator interface to provide support for both the following integrators:
As discussed in Witkin's course notes, you will want to have the ParticleSystem implement an interface (perhaps called DynamicalSystem) consisting of the get/setState(), derivEval(), getStateN(), getTime()... functions.  The Integrator interface might abstract timestepping the system using a method such as Integrator.advanceTime(double, DynamicalSystem). Document your choices.

Add GUI controls (e.g, radio buttons, or a list, etc.) to select the active Integrator implementation.  You may want to do the same for the time-step size---which is currently adjusted using the +/- keys. 
Given the same time-step size, which integrator is the least stable or most stable for very stiff hair? (be specific)

3.  Pin constraints were implemented using a post-step velocity and position projection in the hacky integrator. Implement a Constraint or filter class to make pin constraint projections play nicely with your new integrators.

4.  Wall-particle collision detection and response (or "staying inside the box"): The particles are currently not constrained to stay inside the unit computational cell. Implement a simple scheme to detect collisions with the four walls, and (as in Witkin's course notes) filter the post-step state to provide simple collision response. Use a restitution coefficient to attenuate normal velocity (defined in Constants.RESTITUTION_COEFF). Be careful how you update the particle velocity and position or you might find your particles interpenetrating or sinking into the wall. Also add a friction-like drag force.
Generate a video demonstrating collisions.


Creative Artifacts:  A cool part of physically based animation is building creative artifacts.  Use your imagination and try to make something clever/interesting/whatever that also shows off your system's functionality. 
Submit videos of creative artifacts for bonus points.
 
Hand-in using CMS:  Please submit a short write-up (detailing what you did, your findings, and who you discussed the assignment with, etc.), as well as your Java implementation, and creative simulation artifacts, videos, etc.   If you are working with a partner, be sure to form and submit your zip file as a group.

Submit videos in a portable format such as QuickTime, mpg, or divx, but not native formats, e.g., not the FRAPS codec for your machine. 


Have Fun!!!

On collaboration and academic integrity: You are allowed to collaborate on the assignments to the extent of formulating ideas as a group, and derivation of physical equations. However, you must conduct your programming and write up completely on your own (or with your partner), and understand what you are writing. Please also list the names of everyone that you discussed the assignment with.  (You are expected to maintain the utmost level of academic integrity in the course. Any violation of the code of academic integrity will be penalized severely.)


References:
Previous Results (Spring 2007):  particles07.mov


Copyright Doug James, January 2009.