double
- round to an int
only
for plotting each point.
The iterated function systems will be defined in files which your
program should open and read. The first line of the file tells the
number of functions in the system, and each subsequent line has 7
floating point numbers. The first 6 are the constants
constants a, b, c, d, e, and f that define the transformation.
The last number represents the probability of that function being chosen.
Here are two example files:
dragon.ifs
fern.ifs
Your program should ask the user for the name of the file that holds the IFS data. It should ask the user the width and height (in pixels) of the image they want to create. It should also ask the user how many iterations they want (how many points to plot).
Before plotting the points in the image, you'll need to know the size of the final image in an abstract coordinate system. Determine the size and location of your image by doing a preliminary iteration through the points in the image during which you just determine the boundaries of the image. Once you've determined the coordinates of the boundary, then repeat the iteration, this time plotting each point you find by mapping it onto the bitmap image to get a pixel location.
Since the images we're creating are not just black and white, but have a gray scale from 0 to 255, you can add some interest to your image as follows. When a point maps to a specific pixel location on your bitmap image, increment the total count for that point (not exceeding the one-byte limitation). Pixels that are hit more often will show up darker in your image.
Once you're done creating the 2-D array image, you should store it as a bitmap file as studied in the first lab.
Please keep in mind that these images take up a great deal of space - don't retain many of them in your home directory. It shouldn't disturb you to delete them, since they can be quickly regenerated.