Homework 2, Lining up in the Raster.

Short Description:

Derive, implement and test Bresenham's line algorithm.

This assignment is worth 30 points.

Goals

When you finish this homework, you should

Formal Description

This program consists of four parts
  1. [5 points] Derive the case for Bresenham's algorithm where -1 ≤ m < 0
  2. [10 points] Derive the other two cases for Bresenham's algorithm.
  3. [10 points] Implement Bresenham's algorithm.
  4. [5 points] Implement liner interpolation of colors in your line algorithm.

For part 1, follow the discussion in the notes, but derive the case where the slope is negative. You should present your results in a professional manner.

For part 2, do the same but work with y as the axis of major change. You should present your results in a professional manner.

For part 3 and 4 you should start with the following code.

The entire collection is available in this tar file.

You should edit Canvas.js and replace the Line routine, which implements the brute force method with an implementation of Bresenham's algorithm. Your line routine should accept the two points and associated colors. It should continue to work with the routines in LineTests.js except that a line with two different end point colors should have a smooth interpolation of these colors between the end points AND it should be MUCH faster.

Please use the other routines in this package. In particular, you should not write directly the the frameBuffer array, but should make calls to SetPoint.

You should add a routine or routines which interpolate colors between two points.

Documentation

Your interface should built in a html file. This file should contain documentation discussing the project, including information such as Please use relative references to your code in the html file. This will allow me to extract the file in my local environment.

Extras

I find that I want to continue to play with simulations/visualizations of this type. Please do so, but only if you have sufficient time, do not enhance this, or any other project at the expense of your other classes.

If you do decide to continue some interesting additions might include

Submission

When you have finished your assignment, please submit a tar file containing all files needed for this project. Please do not post your project on line until after grades have been assigned.

In the same directory, place a document which contains your derivations. This should be in an known document format (pdf, Microsoft Word, libre office, or latex).

Submit your tar file as an attachment to a message to danbennett360@gmail.com. Please include your name, and the fact that this is homework 2 in the title of the message.