This assignment is due by the start of class on Mon., Sept. 25.
Please put your name, name of program, and compiling instructions at the
top of your files. In addition, describe the features you've implemented
and comment each function (explaining briefly what it does and what its
arguments are). You should provide sufficient additional comments
for the graders to understand the logic of the program. A 90 on the
homework is perfect but you can also garner 20
bonus points as described below.
The assignment is to implement a polygon scan conversion routine. Use HW2.cpp to handle display. Your program should allow the user to input polygon vertices (20 maximum) by pointing and clicking the mouse. The user ends a polygon by entering "d" or "D" from the the keyboard. You should support "NO-FILL" and "FILL" mode. In the former the program outlines the polygon and in the latter the program outlines and fills the polygon. The user will enter "f" or "F" from the keyboard to toggle the current fill-mode. Note: Outlining simply means scan converting the line segments between sucessive vertices. You should use your scan conversion routine from assignment 1 for this part.
HW2.cpp supports colors "0=black," "1=white," "2=blue," and "3=green."
For example if fb[i][j]=2, a blue pixel will be drawn at position i,j.
You should draw polygon vertices as they are entered in white.
You should draw line segments (between vertices) as they are entered in
blue. When in fill mode you should color all fill vertices green.
The point allocation is 10 points for proper endpoint entry, 10 points for
proper outlines, and 70 points for correct filling.
You should implement the filling algorithm described in class. (See
lecture notes from Sept. 11.)
WARNING: This algorithm is somewhat complicated to implement. I urge
you to start early.
BONUS: 20 bonus points for implementing polygon clipping as described
in class. (See lecture notes from Sept. 13.) The file hw02.cpp has
viewport code that is commented out. You can reintroduce this code
if you implement this feature.