Iterated Function System Iterated Function System
Total Page:16
File Type:pdf, Size:1020Kb
Iterated Function System Iterated Function System (or I.F.S. for short) is a program that explores the various aspects of the Iterated Function System. It contains three modes: 1. The Chaos Game, which implements variations of the chaos game popularized by Michael Barnsley, 2. Deterministic Mode, which creates fractals using iterated function system rules in a deterministic way, and 3. Random Mode, which creates fractals using iterated function system rules in a random way. Upon execution of I.F.S. we need to choose a mode. Let’s begin by choosing the Chaos Game. Upon selecting that mode, two windows will appear as in Figure 1. The blank one on the right is the graph window and is where the result of the execution of the chaos game will be displayed. The window on the left is the status window. It is set up to play the chaos game using three corners and a scale factor of 0.5. Thus, the next seed point will be calculated as the midpoint of the current seed point with the selected corner. It is also set up so that the corners will be graphed once they are selected, and a line is not drawn between the current seed point and the next selected corner. As a first attempt at playing the chaos game, let’s press the “Go!” button without changing any of these settings. We will first be asked to define corner #1, which can be accomplished either by typing in the xy-coordinates in the status window edit boxes, or by using the mouse to move the cross hair cursor appearing in the graph window. To activate the second option, we just drag the mouse and position the cross hair cursor where we want it. We choose a color for the corner before pressing the “OK” button. We repeat the process for the other corner points. Next we will be asked to define the initial seed point. Like the corner points, we can either type the coordinates in the status window edit boxes, or we can use the mouse. Upon clicking the “OK” button, we will be given the option of whether or not to plot the seed point. Next we will be asked to choose a corner (or let Chaos Game choose one at random) with the option of whether or not to plot the next seed point. After that we will be given three options: 1. Repeat the process of manually choosing a corner by hand, 2. Automate the process, or 3. Stop When we select the “Automate” option, the new seed points are plotted in rapid succession and in the colors determined by the corner points from which they were defined. The calculations and point plotting will continue until the “Pause” button is pushed at which point we will be given the option to continue or stop. Figure 1 shows the result after a while when Corner #1 was defined as having coordinates (0, 1) and associated color red, Corner #2 was defined as having coordinates(0, 0) and associated color green, and Corner #3 was defined as having coordinates (1, 0) and associated color blue. Figure 1 Figure 2 shows the result of running the chaos game with five corners and scale factor 0.5. Note: The pentagon formed is composed of five (overlapping) smaller pentagons, There is a hole in the middle of the pentagon, which is not covered by any of the smaller pentagons. Except for the color, each of the smaller pentagons is a scaled down version of the larger one. Figure 2 Next, let’s switch over to the deterministic mode. We have the choice of creating one of the pre- defined fractals or we can define our own iterated function system rules to define our own fractal. For starters, let’s press the “Go” button while “Left Gasket” is selected. A three by three grid of squares appears in the graph window and within the upper left hand square, a unit square ([0, 1] × [0, 1]) with a “V” inside appears. At the first iteration, the iterated function system will apply three rules, each one creating a scaled down copy of the unit square with a “V”. The rules are: 1. Multiple each x-coordinate and each y-coordinate by the scale factor 0.5. 2. Multiple each x-coordinate and each y-coordinate by the scale factor 0.5, then add 0.5 to each x-coordinate. 3. Multiple each x-coordinate and each y-coordinate by the scale factor 0.5, then add 0.5 to each y-coordinate. The three resulting squares will appear in the upper center grid square when the “Next” button is pressed. At the second iteration these same rules are applied to each of the squares created in the first iteration, resulting in nine squares. More generally, at the nth iteration, the three rules are applied to the 3n1 squares created at the previous iteration, thus creating 3n new squares. Figure 3 shows the result of pressing the “Next” button a total of eight times. Figure 3 Now let’s try to define our own iterated function rules to create our own fractal. To do this, we first choose the “Home Made” option. We will first be asked to determine the number of rules we will be using. For the purposes of this example let’s choose three rules, then press the “OK” button. The screen should look like Figure 4. For each rule there are associated six parameters: a scale factor in the x-direction, a scale factor in the y-direction, a rotation factor in the x- direction, a rotation factor in the y-direction, a translation factor in the x-direction, and a translation factor in the y-direction. The parameters that appear are those for the most recently created fractal, or if no fractal has been created yet, the left gasket. For rule #1 we define the two scale factors as 0.5, and the rotation and translation factors as 0. For rule #2 we define the scale factors as 0.5, the two rotation factors as -90 (degrees) and the y-direction translation factor as 1, leaving the x-direction translation factor at 0. For rule #3 we define the scale factors as 0.5, the rotation factors as 180, and both translation factors as 1. After we have defined all the parameters, we press the “OK” button at the bottom of the status window. Figure 4 Once the “Next” button is pressed, our screen will look like Figure 5. Note that in the upper center block three smaller squares have been formed. The lower left square, created from rule #2, is simply the original unit square where every x- and y-coordinate has been multiplied by 0.5. The upper left square, created from rule #2, is the original unit square where every x- and y- coordinate has been multiplied by 0.5, then the entire square was rotated clockwise 90 degrees (or counterclockwise -90 degrees), and finally the scaled, rotated square was translated up 1 unit. The vertex of the “V” is located on the left side of the square due to the rotation. The upper right square, created from rule #3, is the original unit square where every x- and y-coordinate has been multiplied by 0.5, then the entire square was rotated counterclockwise 180 degrees, and finally the scaled, rotated square was translated up one unit and to the right one unit. The vertex of the “V” is located on the top edge due to the rotation. Figure 6 shows the step-by-step creation of the resulting fractal after 8 steps. Figure 5 The third mode is “Random”. It starts with a predetermined “seed” point, randomly selects one of the defined iterated function system rules, and applies that rule to the seed to create and plot a new seed. This process continues until the user presses the pause button. Figure 7 shows the result of choosing “Equilateral Gasket” and letting the program run for several seconds before pressing the “Pause” button. Now let’s try to define our own iterated function rules to create our own fractal. To do this, we first choose the “Home Made” option. We will first be asked to determine the number of rules we will be using. For the purposes of this example let’s choose three rules, then press the “OK” button. The window on the left should look like Figure 8. We can determine the dimensions for the window and the coordinates for the initial point of the sequence to be generated (the seed). In addition, for each rule there are associated seven parameters: a scale factor in the x-direction, a scale factor in the y-direction, a rotation factor in the x-direction, a rotation factor in the y- direction, a translation factor in the x-direction, a translation factor in the y-direction, and the Figure 6 probability that the rule will be chosen. The parameters that appear are those for the most recently created fractal, or if no fractal has been created yet, the left gasket. For rule #1 let’s define the two scale factors as 0.5, and the rotation and translation factors as 0. For rule #2 we define the scale factors as 0.5, the two rotation factors as 0 and the x-direction translation factor as 0.5, leaving the y-direction translation factor at 0. For rule #3 we define the scale factors as 0.5, the rotation factors as 90, the x-direction translation factor as 1, and the y-direction 1 translation factor as 0.5.