CS 261 Homework 3 - Shape Decomposer

Due Fri Mar 01 at 9:00am

Overview

For this assignment, you will write a system for viewing shape decompositions. The basic idea is that a shape (like a polygon) can be represented as a sequence of coordinates in Euclidean space--connecting these points in order produces the outline of the shape. If we start algorithmically removing points from this outline, we start "decomposing" the shape and producing a more abstract polygon. For example:

The above images show the original picture on the left, and then the picture with 90% of its "least important" points removed. Importance here is determined using the following simple algorithm (described in more detail in the Koffman text, page 146):

Given a point P and its neighbors L and R, compute the distances LP, PR, and LR. Importance is measured as LP + PR - LR

Your task is to write a program that loads a sequence of points from a file, displays those points as a polygon on the screen, and allows the user to remove unimportant points in order to deform the polygon using a slider. Furthermore, the slider goes in both directions, enabling the user to also restore removed points to the polygon. You will be writing this system from scratch, though I will give you some guidance below.

Edit: Note this assignment should be completed individually.

Objectives

Necessary Files

You will want a copy of the Hwk3.zip file which contains a number of "shape files" (text files with lists of points) that you can use in writing your program, as well as the README.txt file for this assignment. Hint: the box.txt class is a simple way to check that things are working (because you can do the math for it by hand!).

You may also want to have old code on hand to provide you with examples and a starting point. In particular, you will likely draw from the Movie class, the ZISFrame class, the Bead lab (especially Bead, Necklace, and NecklaceFrame), and the linked-list example from class.

Details

Submitting

BEFORE YOU SUBMIT: make sure your code is fully documented and functional! If your code doesn't run, I can't give you credit!

Submit your program to the Hwk3 submission folder on hedwig, following the instructions detailed in Lab A. You should upload all you classes, as well as the README.txt.

The homework is due at the start of class on Fri Feb 29.

Plan of Attack

You really should be able to figure out how to write a program of this size on your own. Try doing it by yourself, and see if you can make any progress. But if you get stuck, below is a rough ordering for how to attack the problem:

Show Plan

Extensions

Grading

This assignment will be graded based on approximately the following criteria: