next up previous
Next: Part Two Up: Part One Previous: Noah

Use drawPolygon

1.
Read the PolygonDemo handout for an example of how to use drawPolygon to draw a set of connected line segments.
2.
Modify your program so that instead of calling drawLine once for each line segment, it creates an array and puts all the coordinates into it, and then calls drawPolygon once at the end.

Which version of the program was easier to write? Which version do you think is likely to be faster?



Allen B. Downey
3/18/1998