ECE 1021
HOMEWORK #9
(Last Modified: 27 Nov 2010 )
Using the BMP functions from the previous homework, write a program that creates a Windows BMP file that contains a complete (i.e., six sided) von Koch snowflake of the level requested by the user. Your program should first generate a linked list of coordinate pairs (which would initially consist of six points in a hexagon) that are recursively expanded into the snowflake polygon.
The algorithm you will use is very similar to that developed in Section 11.8. But here you will call the recursive function to draw a snowflake of Level N from each vertex of the polygon in turn and the function will replace the side that goes out from that vertex with a snowflake of Level 1 and then recurse on each of the new segments drawing a snowflake of Level N-1.
Your program should ask the user what color to make the snowflake and what color to make the background.
This program merely simply changes the color of the two center line segments each time it replaces a line with a von Koch snowflake of Level 1. The program should ask the user if they want to fade from one color to another (and then get those two colors) or if they want the colors to be randomly generated. To fade from one color to another, simply step each portion of the RGB triplet from in equal steps (based on the N value of the snowflake). The obvious way to do this is to store an RBG triplet for each vertex in the polygon that represents what color to use when drawing the line segment leading out from that triplet. This is a real memory hog. Another way is to use the concept of a pallet and just store the pallet number for that segment. An even better way would be to see if you can find a way to determine what color to use at the time you actually draw the polygon.