Lab Assignment 3 -- Demo and writeup due Thursday, April 13
CS 5721, Spring Semester, 2006
15 Points
Topic: Introduction to SPHIGS

The assignment: is to learn how to use SPHIGS.

References: Sections 7.3, 7.4, 7.5, and 7.7 of the text
/usr/local/studata/COURSES/cs5721/srgp_sphigs/SPH_DISTRIB/include/sphigs.h
Also see the sample programs in the srgp_sphigs/SPH_DISTRIB/examples subdirectory of the class account. Finally, there is a "SPHIGS documentation manual" in the file sphigs.ps in the subdirectory srgp_sphigs/SPH_DISTRIB/doc of the the class account, which I will give you, or you can print out with: % lpr /usr/local/studata/COURSES/cs5721/srgp_sphigs/SPH_DISTRIB/doc/sphigs.ps

Discussion:
There is a simple program called lab3.c in the lab3 subdirectory of the class account. There is also a Makefile there (and a Makefile for use on cs machines: Makefile.cs ). If you compile and run this program you will see a 3-D House on the screen. There is also a very sophisticated program SPHDEMO in the demo_directory of the lab3 directory that demonstrates some of the capabilities of SPHIGS (the README file there explains how it works).

Your task is to make the following modifications to lab3.c so that it creates a STREET_SCENE structure. Here are the modifications:
(1) Do modeling transformations on the given house to make a Mansion and a Cottage. The code to help you to do this is given on the page 307, program 7.10 of the text book. The mansion can be formed by first scaling the given house by 2.0, 3.0 and 1.0 in x, y and z directions. The next steps are rotation and translation.
(2) Add a chimney to each of the houses (see Section 7.5).
(3) Add new colors and change the color scheme of the houses to that shown in Figure 7.20 page 321 (see Section 7.7). The function to use is: SPH_loadCommonColor (index, common_name);
(4) Add a cube and a pyramid on top of it to make a "shed" in the scene.
(5) Read the viewing specification (VRP, VPN, VUP, PRP, etc.) from a file, rather than have it hard-coded as it currently is in lab3.c starting about line 25. Hint: you will have to change the viewing specification to see all of the mansion.

WARNING!!: The functions given in the text don't all work as shown. Some actual SPHIGS functions are different. Here is a list of things that might be useful:

Extra features:
  1. add some trees -- put a tall green pyramid on top of a thin rectangular brown solid (1 point)
  2. add actual streets -- one from left to right in front of the original house and mansion, and another at right angles to it on the left side of the original house (Hint: a long rectangular fillarea would be appropriate) (1 point)
  3. add coordinate axes to the scene and a square grid in the xz-plane (1 point) Hint: this requires the use of SPH_polyLine
  4. make the viewing interactive by allowing the user to change the view reference point by typing in key strokes: 'r' or 'l' should move the VRP 20 units to the right or left -- i.e. change the x-coordinate of VRP by +20 units or -20 units respectively; similarly 'u' or 'd' should change the y-coordinate of VRP by +/- 20 units; and the same for 'f' or 'b' and the z-coordinate. This may be easiest in RAW mode of the keyboard, using event mode. Hint: you should also adjust the view plane normal so that the view is toward the street scene. One easy way to do this is to make the VPN = VRP -- that way you are always looking at the origin (a better way would be to let VPN = VRP - CenterOfScene where the center of the scene is some point centered among the houses) (up to 2 points)
  5. Any other features you can think of -- approved by instructor.

What to turn in or demo:
Since this lab has visual aspects that can most easily be observed, you will be asked to do a demo of your program. Turn in or do the following items from the Computer Science Lab Report Format:
1. (1 point) The Basic Information (your name, class, section, TA's name, assignment number, and date) can be on a separate cover sheet or as (highlighted) comments at the top of your main program file.
2. (1 point) The Problem Statement is a brief description of The assignment: above. Note: the problem statement can (and should) be in a comment at the top of your main program file.
9. Extra Features (- if done.)
11. (5 points) Include the Program Listing(s). These listings should show good style, be appropriately commented, have the new parts highlighted that you added to the original lab3.c code, and include handwritten explanations if it helps the reader's understanding of the code.
13. & 14. (8 points) Do "demos" of each of the features of your program.
15. Include a description of any Known Bugs if needed. You may be able to gain back lost points by a careful analysis of what went wrong and possible fixes.
16. This is optional (and no points usually), but it is useful to think about Possible Improvements. Obviously there are many for this program.
17. Comments on the lab assignment are also optional (and again, no points usually), but appreciated!

Important Note: You may discuss algorithms with other students, but the program and lab report should be your own work.


Page URL: http://www.d.umn.edu /~ddunham/cs5721s06/assignments/lab3/assignment.html
Page Author: Doug Dunham
Last Modified: Tuesday, 04-Apr-2006 17:49:38 CDT
Comments to: ddunham@d.umn.edu