CS 351: Assignment #6

Hierarchical Modeling System

Due midnight 1 November 2011 (Tuesday night)

In this assignment you'll implement a hierachical modeling system and learn how to build scene graphs using primitives and matrix transforms.


Tasks

Read the entire assignment before starting. If you don't, bad things will happen.

The Graphics System Specification outlines the functions required for a 2D/3D hierarchical modeling system that allows you to create modules and draw them. You will create a new set of functions for inserting graphics primitives, transforms, and other attributes into an open module. Each function will do approximately the same thing: put an instance of the object, transform, or attribute on the module's list.

As indicated in the graphics spec, the only required visual objects for the modeling system will be points, lines, polylines, and polygons. All of these primitives are described by one or more Point types. The important thing to remember about the insert function for these items is that graphics primitives need to be copied into the module so that the module has a local copy of the points constituting the object. If you do not copy the data into the module, bad things will happen.

The exception to the copy rule is inserting one module into another. In that case, a pointer to the sub-module needs to be stored in the parent. Modules should not be copied when they are inserted into another module. If you make copies of modules, bad things will happen.

The only tricky function to write is the function that actually traverses a Module's list and draws the scene onto the screen. The lectures notes include an algorithm for proper traversal of the scene graph. The most important aspect of the algorithm is how to organize the matrices.


Required Images

  1. Use the first test program to test out your system. It does not require any 3D functions module functions. The list of functions required is given at the top of the C file. Get those functions working first, before going on to anything else.

    My system prints out the vtm, the element type, and the point and line locations it is drawing from within Module_draw. here is my printout.

    This required picture is due on Friday, October 28, and is worth 10 of 30 points on the assignment.

  2. The second required picture is an image of a blue cube outline, made using your module_cube function.
  3. The third required image is a scene that contains a model with at least 3 layers of modules, where each higher module contains at least 3 instances of a lower module. For example, create a spaceship model, then a formation of 3 spaceships, then a scene with 3 formations. At the scene level, have each formation doing something different.
  4. The last required image is based on this test code, which produces the image below.

Extensions


Writeup

Make a child wiki page from your main CS 351 wiki page. Give it the label cs351f11project6. Please follow the format below.

  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 private handin folder as a single zip or tar file. Put your writeup on the wiki. Give it the label cs351f11project6.