CS 134
Assignment 2

Physical Simulation

(Due 5/15 at midnight)


In this assignment you will work from the spring-mass lab code to generate an underwater scene with "seaweed" and "fish". The point of the project is to develop an advanced interactive simulated world that includes collisions and some additional forces, 1) a simple bouyancy force, and 2) a global drag force.

The main element to simulate is a spring mass set of strands that are connected to the ground with the bouyancy forces pulling up on each mass node and springs (and dampers) acting to balance and keep the seaweed strands from growing or breaking apart (basic seaweed 20pts). Mass chains of approximately ten nodes is recommended, but more is also fine.

You will get a brief introduction to collision forces from the TA and will create collisions between the seaweed strands and a sphere. The sphere is controlled interactively via the keyboard. This "fish ball" (a delicacy in some countries) hits and pushes the seaweed (35pts) as it is moved around. No collisions between strands are necessary. And in the absence of the "fish", the seaweed will return to a static, upright stance after a short amount of time.

Bouyancy and drag forces (10pts each) can be added simply. The former a constant value that pulls upward, the second a gentle stalling force that pushes in the direction of the velocity of each force, to impede movement.

The fish applies forces but does not respond to the forces, instead it is moved horizontally, either interactively based on the keyboard (keys "awsd") or else, around in circles (by pushing the "o" key). (15pts for all key controls) To accomplish the circles action, the ball can be assumed to move in a circle with a fixed radius, starting from the position it is currently at.

A "bed" of seaweed will appear using a reasonable number of seaweed strands. You can add these in at the end, after debugging a single strand - but be sure to keep the runtime interactive by not adding too many strands. Placing the strands can be done on a grid, randomly, or design a custom layout by hand!

Given this is a project on animation, not rendering... you are given complete freedom on how to draw the scene, as long as it is visible and the control of the system is observable from the choice of rendering.

Finally, a clean efficient implementation with good documentation are required (10 more pts).

Not enough? Extra Credit: 5 pts for adding a lazy sway of the underwater sea grass by adding (pulsing?) current forces. Another 10 pts for adding a small school of fish ball characters, grading for this is at the discretion of the the TA. Impress him to make the the full 10.

As always, you may discuss the high-level concepts but you must write your own program, do not share code, do not sit together and code. Also, be cautious of your print-outs (used for debugging) as well, if someone copies your "thrown out" program, you will be held responsible. Finally, your code must be written in C and/or C++ and run on the linux machines in the lab by typing "assn2" at the shell command prompt.

Have fun!