Project Overview

You will write a program that will draw shapes in various colors, sizes, and positions, overlapping each other on a single plot. This program should accept an input csv with rows for each shape, and optionally a target output.

Input Format

The input will be a csv file, with each row in this format (f means floating point number, r means degrees [0,360)):

(SQUARE|TRIANGLE|CIRCLE|RECTANGLE), (RED|ORANGE|YELLOW|GREEN|BLUE|PURPLE), r, f, f, f

The floating point numbers are (total area, x-origin, y-origin). The RECTANGLE option means a golden rectangle, TRIANGLE means an equilateral triangle, and the origins provide relative position of the shape. The angle is the rotation of the shape relative to EAST == 0. NOTE: THERE IS NO HEADER ON THESE FILES.

If an invalid input file is provided, the program should respond with useful input, particularly the line number the error appears on, and what particularly is wrong with the line (e.g. an invalid shape or color, numerical inputs outside of their appropriate ranges, non-numbers supplied where numbers should be, too short lines).

Here are two files, one that should work and one that should return an error: works and does not

Output Format

If no output file is provided, the program should draw the shapes for the user in realtime, and then quit on click.

If an output file is provide, the program should save the final canvas to an eps (postscript) file.

Example Usage

In summary, you program should run as:

$ ./shape-drawing.py garbageinput.csv
Error: ... indicate what is wrong on the first line with an error ...
$ ./shape-drawing.py
... same as next line ...
$ ./shape-drawing.py -h
... useful info about usage ...
$ ./shape-drawing.py input.csv
... real time animation of shape drawing ...
$ ./shape-drawing.py input.csv output.eps
$ ls output.eps
... finds plot you just made ...

Process

As you make progress on this assignment, you should be committing updates to your branch in the repository.

When you think you are ready, you should have committed all of your revisions and pushed them to the repository. Then email your TA indicating this project is ready for evaluation.

If you finish early, we can talk about extensions to the project.

On the last day of class, you should be prepared to demonstrate your project from the commandline. You will probably want to create some input files to show different results (and your artistic skills).