Homework 2: Polygons and Fill
Due: Friday, Sept. 25, 11:59pm on Moodle
The goal of this homework is to implement a regular polygon function and complete the sweep fill method for convex polygons. This homework also contains a line implementation (solution to Homework 1), but you are free to put in your own line implementation.
Complete the constructor for the RegularPolygon class, using the Line class. At the end, you should have built up a list of all the points on the polygon. Then the draw() method (which is idential to the draw() method for Line) can be called to draw the outline of the polygon.
Hint: how would you define the vertices of a regular polygon if it was centered at the origin? How could you change those points to achieve one centered at the given point c?
Hint: are there always two boundary points? What if there is just one point matching a given y-value? What if there are more than 2?
You are welcome to do pair programming for this assignment. Make sure to switch off at least between parts (1) and (2), or alternate more frequently if you like. In addition, you must also complete the first bonus item below (different outline and fill colors). If you choose this option, submit one assignment and make sure to put both your names.
BONUS OPTIONS:
Note: you can receive full credit for this assignment without doing the bonus (unless you are pair programming).