CS 381, Fall 2007
HW #5
General Information
- Submit your answers to the questions, C++ source programs and screenshots
of the graphics window to Blackboard by Thursday, October 25.
- Send source and screebshots only! No executables, project/workspace files, etc.
- Due: Thursday, October 25 (any time).
- Worth: 20 points.
Homework Policies
See the
Homework Policies handout.
Questions (5 pts)
- Exercise 5.8.
- Exercise 5.12.
Program #1 (5 pts)
Start with the trackball color cube program
cubet.c from Chapter 4 of the text. Remove the spinning rotation animation
and program the mouse to provide an interface which allows the cube to be
rotated, translated and scaled, by dragging the left, middle, and right
buttons, respectively. Also, add a keyboard callback and use the 'R' to
reset the model_view matrix and 'Q' to quit the program.
Program #2 (5 pts)
Exercise 5.19. Start with the 3D sierpinski gasket program
gasket3.c
from Chapter 2 of the text. Follow a linear trajectory that passes through
the gasket and is parallel to the z axis. Choose the increment along the
camera path so that the fly-through takes about 5 seconds with smooth motion.
Extra Credit:
- Perform a "roll" manuever using the flight path as the axis of rotation.
- Follow a closed circular trajectory which orbits around or through the
gasket in which the camera is always aimed at the center of the orbit.
Program #3 (5 pts)
Exercise 5.21. Divide your display vertically down the center and
create separate GLUT windows for the left and right halves of the screen.
Display the same color cube in each window using slightly different camera
positions corresponding to the spacing between your left and right eyes when
viewing the cube from a distance of 11 inches. Place the edge of a manilla
folder or a piece of stiff construction paper vertically against your
forehead centered between your eyes so that your left eye only sees the left
half of the screen and your right eye only sees the right half of the screen.
The distance from your eyes to the screen should be 11 inches. By looking
"through" the screen to a point several feet behind the screen, you should
be able to fuse the left and right views of the cube into a single cube
which appears 3D. Experiment with the camera positions to produce the best
effect and report your results. The cube_view.c
program from Chapter 5 provides a good starting point for positioning
the camera.
Extra Credit:
- Make the cube spin slowly (20 rpm) along its diagonal axis and compare
the 3D effects you observe for the animated and motionless cubes.
Note
Particularly well-done programs may be demonstrated in class.
CS 381, Fall 2007: Assignment 5 /
Last update: 21 Oct 2007