BU CAS CS 480

Introduction to Computer Graphics

Spring 1997

Programming Assignment 2

Due before class on Thursday, February 20


This programming assignment will introduce you to 2D modeling and transforms. Extend your polygon drawing tool from the previous assignment to do the following:

The polygon editing tool must run on the SGI, therefore you will need to use one of the SGI workstations in the CGL cluster (unless you have access to an SGI workstation elsewhere).

Your program's source files are to be electronically submitted by using the submit program on cgl. The code you submit should conform with the program assignment guidelines.

Part of your grade for this programming assignment will be based on your giving a short demo (2-3 minutes) in the CGL cluster. You will be expected to talk about how your program works, and we will see how well your program performs on some test examples. Demos will be scheduled 2-5 on the assignment due date.

Start programming early.

Local Coordinate Frames

Your polygon editing tool should display the local coordinate frame so that the user can move it around, and change it's orientation. Here are two examples of local coordinate frames:

Rotation, scaling, translation, and shear are applied in the selected polygon's local coordinate frame (not the global coordinate frame). For instance, scaling in the local coordinate system's X direction yields different results for these two local coordinate systems:

Furthermore, the user should be able to position the local coordinate frame anywhere inside or outside the selected polygon:

The location of the coordinate frame determines the center of rotation. Thus the rotation with respect to these two local coordinate frames is quite different:

Extra Credit

For extra credit on this assignment do two things:

  1. Create, display, and manage multiple polygons on the screen at the same time. Provide a mouse interface to select among all the polygons, and to add or move vertices. Allow the user to move the selected polygon to the back or front.

  2. Read/write your polygons to a text file. In addition to polygon vertices, be sure to store each polygon's local coordinate frame, color, line color, and fill flag.

Test Cases

You are responsible for testing your own code. Try various test cases. For instance, test your program with various local coordinate systems and transformations. Try selecting and editing multiple polygons.


Page Created: Jan 2, 1997 Last Modified: Jan 2, 1997 Maintained by: Stan Sclaroff