CS 351: Assignment #7

### Hierarchical Modeling System

Due midnight 3 November 2008 (Monday night)

For this assignment you'll implement 3D transformations and perspective viewing. You don't have to use your modeling system to complete the assignment, but test code is provided for both cases.

The Graphics System Specification now includes a section on 3D viewing. The 3D viewing function (section 8.2), the 3D matrix transformations (section 6.3) and the 3D module functions (section 7.2) except for Module_cube are the required sections for this week. The module functions are just the 3D versions of the 2D matrix module functions.

Use the procedure outlined in the lecture notes to generate the VTM in the Matrix_set3DView function.

The first required image is an image of a cube defined by the points (0, 0, 0) and (1, 1, 1). The output image should be 200x200, with the VRP = (0.5, 0.5, -2), VPN = (0, 0, 1), VUP = (0, 1, 0), projection distance of 2, view window size of (du, dv) = (1, 1), and (F, B) = (0.0, 5.0). You can use the non-modular example code to test your 3D matrix and viewing code before writing the module functions. Use the correct output to make sure your VTM is being created properly. In the default position (no command line argument), the image will show the cube straight on.

Once you implement the matrix module functions then you can try out the modular cube example. It should produce the same results, but draw the cube yellow. You can control the angle of the cube with a command line argument given in degrees.

The second required image is to make a shape other than a cube and show it in at least two orientations. Stick with line drawings for now.

### Extensions

• Use the modeling commands creatively to develop complex scenes. Make lots of copies of the cube and your other shape. Make formations of them. Make them different size.
• Create animated sequences and build an animated GIF.
• Add Module_PopMatrix and Module_PushMatrix commands to store and restore transformation matrices.
• Write routines that let you read in and write out modules from a human-editable file so you can create stuff off-line.
• Most of the extensions from the last assignment, but in 3D.
• Create module functions that add in basic graphics primitives other than cubes.

### Writeup

For the writeup this week, a diagram showing the viewing setup would be nice to see. You could, for example, use your graphics system to generate the diagram (which would be a nice extension).

All writeups should suggest the format of a lab report. They do not have to be long, but need to provide enough information that I have some idea you knew what you were doing.

1. Abstract: 200 word description (at most) of what you did and a picture to go along with it.
2. Description of the task, in your own words. Be brief, but write it as though explaining it to a fellow student not in the course.
3. Description of how you solved the task, including any key equations or algorithms. You should also include algorithms or descriptions of what you did for any extensions. Include pictures here.
4. More pictures. Please put a caption on each picture explaining something about it. If you have nothing else, give it a name and indicate whose picture it is.
5. Summary of what you learned.

### Handin

Put your code files in your handin folder. Send the prof an email with the URL for your writeup (wiki or standard web page) when it's done. In either case, please edit the assignment handin page on the wiki so there is a link to your assignment.