COMP 15 Project #3: Robot parade

COMP15 Fall 20XX
Due: Wednesday, October 13, 11:00PM


Object-orientation is a natural approach to computer graphics. Graphical scenes consist of objects that are instantiated from one or more classes. Often, multiple objects of a specific type are instantiated from the same class. An object may consist of subparts where each subpart is an instance (object) of some other class. In this case, there is a part-of relationship from the child (subordinate object) to the parent object. The part-of relationships in a scene can be described in a "scene graph," which is a directed-acyclic graph (DAG) with the scene at the root of the DAG and graphical primitives at the leaves of the DAG.

The part-of relationship is usually accompanied by a spatial, geometric relationship between parent and child (a subpart of the parent.) The child must be scaled, oriented and placed with respect to the coordinate space of the parent. This is accomplished in PostScript using the scale, rotation and translation transformations, respectively. The PostScript transformation stack allows concatenation and nesting of transformations such that parent-child (part-subpart) geometric relationships are easily applied and managed.


The objectives for this project are:

The principles underlying this project are fundamental to the field of computer graphics.

What needs to be done

Your program must draw a scene with four robots. Each of the robots may be an instance of a single Robot class. The scene graph, generally, has the following (sub)parts:

Each part and the scene itself must be a separate class. Each class should have a constructor and a method function, draw_me, to display an instance of the class. The robot constructor should take one parameter which is the robot's size. (You could add other parameters like number of eyes, gray level, etc.)

What you draw is up to you, as long as it is tasteful. Before programming, draw a scene graph and lay out your parts on graph paper. Then translate your geometry into graphical primitives and transformations. Only the "leaves" of the scene graph may use graphical primitives (i.e., line, circle, rect.) Interior "nodes" of the scene graph may only create, scale, orient and place instances of robots (as in the case of the scene itself) or parts.

No files are being provided to jump start this project. You must reuse the PostscriptFile module that you developed in project assignment #2. The PostscriptFile module consists of the psfile.h include file and psfile.cpp. You will need the PostscriptFile class again in the future so be sure to save them. You must prepare a makefile to build your program using the make utility.

You should test as thoroughly as possible. Identify and test any special cases. Add comments to the source code to describe your approach and solution. Don't forget to provide a header comment with your name, section and e-mail address.

Extra credit

Here are two problems to consider:

Extra challenges are always above the call of duty and are for extra credit.

On-line resources

Be sure to read the on-line tutorials on PostScript. Take the "PostScript tutorial" link from the COMP15 schedule page. The PostScript write-up has links to the Adobe PostScript tutorial/cookbook and reference manuals (the "blue book" and the "red book.") The Adobe books are particularly well-written and have many examples in case you want to extend the PostscriptFile interface.

Submitting your work

Use the provide system to submit the finished program:

    provide comp15 a3 makefile psfile.h psfile.cpp ...
Be sure you are completely satisfied with your work before submitting! You must submit your makefile, psfile.h and psfile.cpp along with all of the include and source files needed to draw your scene. Yep, that's a lot of stuff and please be careful to make sure that no pieces and parts are missing!

Copyright © 2004-2013 Paul J. Drongowski