CS 4204, Project 1 - Due March 29, 2007

Structured 2D Graphics

One of the important applications of computer graphics is drawing and computer aided design. You've all probably used such software before (like Paint, Corel, TurboCAD, or Canvas) and are aware of its characteristics without having thought about how such packages are actually implemented. The purpose of this project is to get a better understanding of how transformations are used in structured graphics and to build a small system that allows you to build up a 2D design from master objects and structure them into groups. It is also the case in structured graphics that the interactive interfaces are carefully crafted, since the attempt is always to build easy-to-use direct manipulation interfaces. That is a little harder to do in OpenGL, but there is enough capability to get the job done with the mouse and with menus. You will be expected to build a direct manipulation interface employing picking and dragging.

Your job is to write a program that allows you to draw multiple copies of the shapes, scale and position them, and structure them into composite objects called groups. You should be able to determine and change the order in which objects are drawn, which determines occlusion. Your grade will be based, in part, on the quality of your user interface and the ease of use of your program.

The User Interface:

Part of the purpose of this project is for you to get experience working out a good human-computer interface. This is harder than it looks. In particular, a good interface requires little end-user documentation, and users will not be frustrated by unnecessarily complicated action or motion sequences for the most commonly performed tasks, such as positioning an object. Once you think you have a good design, get a roomate or other uninterested person to try it out and watch carefully for signs of trouble. Allow sufficient time for some redesign! Should your interface suffer from flickering due to the clear/redraw cycles during interaction, you might try double buffering. Keyboard and form-filling interfaces are difficult to use for drawing applications and generally receive less credit.

Structuring:

This program is to have the ability to group objects together so that the group behaves like a single object that can be moved and scaled. Remember that when a group of objects is scaled, both the spacing and size of components changes. Your program should provide a single level of structuring (in other words, it is not necessary to be able to create groups of groups). You need also to be able to ungroup a structured object and to specify and change the order in which objects are drawn, which determines occlusion. For a good example of an interface for structuring and ordering, look at the drawing interface in MS WORD. That capability is visible if you right click near a graphical object.

You should provide capability for constructing up to 10 groups. You are required to do your structuring using the transformation stack as shown in class and to document this in your code so that we can find it.

Shape Primitives:

You are provided with three shape primitives in the file, shapes.c. These primitives are the functions, box, triangle, and torus. Their documentation is given in the function headers. Triangle is a 2D shape that looks like a 3D figure, while box and torus are flat shaded shapes. You may make modify these functions as you wish. For example, you might want to provide a wire-frame highlight as in your earlier homework assignment. These functions are parameterized. The best approach is to decide on a fixed set of parameter values for each primitive and then to treat these three primitives as master objects using structured graphics transformation techniques. To get a nice looking torus that appears smoothly rounded rather than polygonal, select larger radii.

Picking:

Picking is the process of identifying an object by pointing at it. This can be rather complicated in OpenGL, but since only scalings and translations are in effect for objects or groups, the easiest way to manage picking is to maintain a list of transformations in effect for objects or groups so that they can be easily inverted. That will enable you to determine at which object the mouse is pointing.

Documentation:

As with every program you will write this semester, your code will need to conform to the departmental standards, which include prettyprinting such as whitespace and indentation, a documentation header for each function you write including main, and readable inline documentation that describes the function of each chunk of code. Remember, too, to use the OpenGL datatypes for the OpenGL function arguments. The CS documentation standards may be found at http://ei.cs.vt.edu/~cs2604/Standards/Standards.html".

Partners:

Project 1 may be done jointly with one other class member. In that case, both names must appear in the program headers. To request to work together, submit a collaboration request form (no Email) in class by Tuesday, March 13. This form is found on the class web page.

Submission:

Email your final working program source code files as a .zip archive to Rongrong at by midnight the day it is due. Late projects lose 25% per day. The explanations of how it all works should be included in your code documentation; provide any linking instructions for Rongrong as a readme.txt. Partners should submit only a single copy of the project.

Here are the grading criterea. Note, however, that while ease of use counts only 4 points out of 20, a poor interface may make it impossible for us to evaluate the functionality thoroughly.