CS160 Program 2: Basketball
Due Wednesday, October 29, 2003 MIDNIGHT
NOTE CHANGE IN DUE DATE
Submit Prog2 directory using CATS Submit Program
Objectives:
This goals of this assignment are to introduce geometrical
transformations, three-dimensional modeling, and simple
animation. You must also use the gui designer fluid
and turn in the fluid file as well as the program files.
Assignment:
This assignment involves creating a model of a basketball
court, moving a basketball around, moving the camera around,
and having the basketball go through the basket.
-
Create a simple basketball court. The floor should be a light
brown polygon. There should be one white wall polygon perpendicular
to the floor at one end. A basketball hoop will consist of a
thin yellow cylinder coming out of the wall at an appropriate height,
and a brown hoop cylinder at the end of the yellow cylinder.
A white basketball sphere of appropriate size should start
at the center of the floor.
The hoop cylinder should be drawn as a wireframe, but the rest
should be filled in with color. The background should be a color
different from the above, so that it objects are clearly visible
against it.
-
The camera should look at the basketball hoop at all times.
The camera position should be controllable using spherical coordinates
implemented as sliders. One slider should cause a rotation in a
floor plane of between -90 to 90 degrees. A second slider should
cause a rotation out of the floor plane from 0 to 90 degrees (you
shouldn't be able to move the camera under the floor).
The third slider should move the camera closer and farther from
the lookat point (the hoop).
-
The ball should also be movable in (x,y,z) with three fltk sliders.
-
The scene should be rendered in perspective.
-
There should be an fltk button "Auto" which, when pushed, causes
the ball to be animated from its present position, to the top of
the hoop, and vertically through the hoop to the floor below,
where it will stop. The animation should happen at a reasonable
speed. (You can move in straight lines and constant speed, if you
like.) The animation must be double-buffered.
-
There should be an an fltk button "Play" which also causes the
ball to be animated. However, this animation will be controlled
by two fltk sliders "Speed" and "Angle", which specify the
angle above the floor to start with, and the speed. The calculations
for this will be explained in discussion sections.
-
There should also be an fltk "exit" button, which ends the program.
-
You must use fluid to create the interface and turn in the
fluid file.
Hints:
-
I suggest you first animate using the Auto button, and then implement
the Play button, which is more challenging.
Good Programming Counts:
-
Remember to use the good programming practices that you learned in
101; it will make a difference in your scores. In particular,
keep the GUI and display routines in separate files, and separated
from files that are not related to displaying and interface items.
For example, do not make GUI calls in files not directly related
to the GUI, and do not make openGl calls in files other than
those displaying. For example, you should not have to include forms.h or
the openGl includes in files other than GUI or display files.
Do not use extern within .c files, put them in appropriate .h files.
-
Reread this assignment now and then to make sure you are fulfilling
all of the requirements.
-
Save yourself a great deal of misery by saving early versions of
your program in separate directories, so that you can back out
if your program deteriorates or you inadvertently hit "rm *".
Submit:
-
Submission must be done using
the submit utility from CATS. Run "quickhelp submit"
or "submit -m"
on a CATS machine to get more info on the submit command.
To submit the assignment, do the following:
- Create a DIRECTORY called "
prog2". It should
contain all the files required to make your program
compile/run. Also include the fluid file.
- Run "
make clean" in the directory to ensure you
do not submit .o files or the compiled program or a core file, or you
will lose points for possibly over-filling the directory.
- From prog2's parent directory (if you are in the prog2
directory, type "
cd .."), tar the directory with
the command "tar cvf prog2.tar prog2".
I strongly suggest you untar it (see above) to check.
- Compress the tar file with the command
"
gzip prog2.tar". This will produce the file
"prog2.tar.gz" which you will submit.
- Submit prog2.tar.gz with the command
"
submit cmps160-jw.f03 prog2 prog2.tar.gz".
Questions?:
E-mail
amin@cse.ucsc.edu and
wilhelms@cse.ucsc.edu