COM 1370 Computer Graphics - Summer 2001 - Assignment 2

Professor Futrelle -- College of Computer Science, Northeastern U., Boston, MA


Updated Saturday 6/30/2001

Your grade: Doing Part 1 tolerably will get you a 'C'. Doing the more difficult parts and doing them well can earn you up to an 'A'.

(repeating) This assignment is due electronically by the midnight on Thursday, July 5th (by the end of that day). Remember, turn in whatever you have done by that time.

Assignment #2 - earlier post. Preview of fat pixel interactive rectangle drawing (by Prof. Futrelle, 6/25/01). This combines the line drawing applet of Dori Smith with the fat pixel code from Assignment #1. Here's her source code for the line drawing applet. You will be required to recreate the rectangle drawing plus filling the interior using flood fill. The harder portion will involve reducing the redrawing by only redrawing when the mouse moves at least a full fat pixel. The full assignment will be posted soon.

Assignment 2 itself:

Assignment 2, Part 1: Starting from Smith's listing ( here's a local copy), change her paint method to draw a fat pixel rectangle and also fill it each time it's redrawn. Here are some suggestions as to how to proceed, some based on the demo applet that I posted for you:

Assignment 2, Part 2 (a tiny bit harder): Make the border and fill colors the same so that you're dragging a uniformly colored rectangle.

Assignment 2, Part 3 (Harder): Change the your algorithm so the repainting is only done when the mouse is moved far enough to enter a new fat pixel region. This should make it much smoother. You'll have to remember the current fat pixel position to compare with the mouse each time the mouse drag event occurs.

Assignment 2, Part 4 (Hardest): Replace the rectangle by a triangle with a fixed vertical edge such that dragging the mouse moves the third vertex, and fill it dynamically with the same fill() code (shape shouldn't matter!). This should also only redraw when a full fat pixel is traversed by the mouse. Hint: Whenever the mouse is to the right of the vertical line scan on the proper side of the vertical edge to see if there is any pixel that's unfilled in the interior. Fill in a different color than the border so you can be very sure what's getting done. You could start by writing it so it only works when the drag is to the right; that in itself would be an accomplishment.

See the page on electronic handins for the correct way to set up your directories and files for your electronic handins.

Go to COM1370 home page

Return to Prof. Futrelle's home page