Assignment 2 -- Bresenham Line Scan Conversion and Cohen-Sutherland Line Clipping
Deadline: Friday 24th of September at 5pm

The Goal of the Problem Set
For this problem set, you will be implementing both the Bresenham segment rasterization algorithm and the Cohen-Sutherland segment clipping algorithm. You will be given much of the infrastructure for displaying and web-publishing the algorithms (as applets) so all you need to do is fill in the algorithms themselves.

How do I get started?
We recommend that you do this problem set on an Athena machine. It is possible to do it on your machine at home (as long as it is Java 1.1 compliant), though you will have to then transfer files to your space on imagery in order to get credit for it (plus, we will not be actively supporting the PC platform).

Downloading the files:
Download assignment2.tar by clicking here. Save it to your /mit/imagery4/6.837/F99/students/uid/WWW/ directory. Then type:

athena% cd /mit/imagery4/6.837/F99/students/uid/WWW/
athena% tar xvf assignment2.tar

This will create a new directory for you: assignment2. In that directory you will see a number of files:

Setting up java:
Source the script setupJava:

athena% cd assignment2
athena% source setupJava

This script adds the Java Athena locker (which gives you access to the Java executables) and sets your CLASSPATH environment variable appropriately (which lets Java know to look for compiled .class files it needs in your imagery directory).
Important Note: You must source this script once every time you log on.

Using Java for this Assignment
Java is a great programming language. It's easy to use and flexible. Don't worry if you haven't used Java before. The syntax is close enough to C/C++ that knowing either of these, you know 90% of Java. For some information on the language, including tutorials, API references and language specifications, check out the Sun Java page at http://www.javasoft.com.
For the purposes of this problem set, here are the important Java commands to know:

A TODO List

For more detailed information on implementing the algorithms, including inputs and outputs to the method you must fill in etc., check the comments in Bresenham.java and CohenSutherland.java.

Don't Forget:
Scan converting and clipping line segments is fun! Think of the applications!