CS 4984, Graphics Project - Due December 10, 2008

Structured 2D Graphics for Building Design

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 several 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.

Master Objects

This system contains three pre-defined master objects shown below:

Your first task is to create a class named Masters with methods window1, window2, and door, that draw the master objects as shown above with the dimensions shown, which happen to be in feet. The frames, sill, step, and doorknob are all 6" wide. The methods are to have parameters for specifying a color, to be determined using a color picker. Note that in the master objects, there are thin black broundaries around the polygons. Also, ensure that when the methods exit, the current drawing color and polygon mode are restored. The details are as follows:

Users should be able to select the colors of the window and door components and edit them.

Polygons

The graphics system is also designed to permit the user to create rectangles and convex polygons in World Coordinates. If the user tries to create a non-convex polygon, an error message should be shown. The user should be able to edit the sides of squares and the vertices of polygons. Each rectangle or polygon should have a thin black boundary. Users should be able to select the colors of the rectangles and polygons and edit them.

BONUS There is a 5% bonus for rendering all simple polygons by decomposing them into triangles and then coloring the triangles.
Your job is to write a program that allows you to draw multiple copies of the master objects, rectangles, and polygons, 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 in the viewport, 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.

BONUS Most drawing programs have the capability of zooming in and out so that drawing detail is easier to see. A well-implemented zoom function will get a 5% bonus, and a pan function will get another 5%.

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. An alternate method that will be discussed in class uses a special projection matrix called a pick matrix.

Partners:

The clss project 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 Monday, December 1.

Submission:

Submit your program by 11:59pm 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. 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.