CMP 161 -- Programming Assignment 3
Due date:
10:00am, THURSDAY, 2/26/2004
Objectives:
Learn and implement simple physics based animation.
Useful Links:
To Do:
-
This programming assignment is split into 2 stages.
The 1st stage is the same for everyone.
For the second stage, you have an option on how to proceed.
-
Okay, for the 1st stage,
you need to implement an animation for a simple pendulum.
You can find several examples of java applets showing
such animations on the web.
-
For the 2nd stage,
you have 3 options listed below:
-
Double Pendulum:
This is where another pendulum is attached to the end of
the 1st pendulum. Look at the following
link
for a description of relevant equations.
Allow the user to vary parameters such as lengths and masses.
-
Coupled Pendulum:
In this option,
two pendula are connected together by a spring.
See the following
example
.
Note that here you have to assume a ``physical pendulum''
where the mass is not concentrated at the ends but is
distributed across the length of a rigid rod.
In the formulation, you can assume that you have an
ideal (string or simple) pendulum where the mass is
at the center of the rigid rod.
That is,
the effective length is of each pendulum is half of
the specified length.
Allow the user to vary lengths and masses of the pendula
as well as the spring constant.
Also note that the spring does not have to be
attached at the ends of the pendula.
So, you may want to have the user change the spring attachment
points also.
-
Wind Chime:
Well, a 2D wind chime anyway.
Here, you also have to assume a ``phyical pendulum''.
The following
image
illustrates our ``wind chime'' setup,
but with no springs connecting the pendula.
One (or more) of these pendula are given an initial displacement
and you generate the animation by checking for collisions
and transfering those force to neighboring pendula.
You can simplify the simulation a bit by using ``fake physics''
for the energy transfer.
Allow users to specify the number, position and lengths of
pendula; also let the user specify initial conditions.
-
For both parts,
allow the user to manipulate the system --
either through typed-in box entries, sliders, or direct manipulation.
-
For both parts,
assume the pendula reside in 2D.
-
Note that this problem is quite different from previous
assignments in that it's pretty open-ended.
Also, you are not required to use Vtk.
-
In case it's not obvious where to start,
you need to determine the positions of the pendula over time.
To do this,
you need to integrate (RK4 recommended) the differential
equations (acceleration and/or angular velocity) in order
to find the next angular velocity and/or position, respectively.
Items To Submit:
Html page with description and images (and animations or applets)
of your project.
Make sure your links are all local
and relative to your submit directory.
Also make sure you have well documented code,
makefile, README file, user guide, etc.
Do not submit the data files with your program, html, etc.!
Grading:
Here's the breakdown for this program:
-
stage 1 functionality: 30%
-
stage 2 functionality: 50%
-
docs, gui, etc.: 20%
So, if you don't do stage 2 at all, but do everything else,
you get 50%
This program nominally accounts for 5% of your final grade. We must
be able to compile/test your code. Make sure that code and accompanying
make/project files, etc. must be tested for successful compilation at least on
the suns in the lab. For PC's, we will be using Visual C++. Also be sure to
include a README in your submission as to which platform to use. By the way,
if you're your development on PC's, you should be able to recompile your
fltk/opengl code on the suns with little or no modifications to your source.
Programs turned in at least a full day early will earn 1% bonus credit. Late
programs will be charged 1% late points. In addition, late programs will not
be accepted 24 hours past due date. Late programs and reports will not be
accepted for the final project. The bonus credits may be accumulated up to a
total of 50% toward program and final project credits. Programs are graded 80%
for functionality and correctness and 20% for style, readability,
documentation/writeup, and efficiency. Additional points may also be earned
for extra features.
Submission:
Create and submit a subdirectory called "prog3". It should contain
all the files you have to make your program compile/run. Include the other
items to be submitted in this directory as well. Submission must be done using
the submit utility from CATS.
-
To submit use: submit cmps161-ap.w04 prog3 files
-
To verify submission use: peek cmps161-ap.w04 prog3
These commands should work from any cats machine, but if there is a problem
try from unix.ic.
Last modified
Tuesday, 22-Jan-2019 09:42:16 PST.