World of fractals
Home | Image Galleries | Animations | Types of Fractals | Downloads | Understanding Fractals | Contest | Links
Creating Fractals: The Basics
This section will show you the process, but not the difficult math, behind generating fractals. When you see a fractal image, you should think of the screen as a plane (a flat surface) made up of many, many points, or pixels. Each pixel has an x-coordinate and a y-coordinate, which determine its position on the screen. Since each pixel is in a different place, each pixel's coordinates are different from the rest.
The basis for creating fractals is firmly rooted in mathematics, but this section is a good way to learn about creating fractals with no previous knowledge of mathematics.
Most computer-generated fractals are made on the plane (a flat surface) divided up into lots of different points (pixels). Each of these points has two coordinates; an x-coordinate and a y-coordinate, which identify it's position in the grid. Because each pixel has a different place on the grid, each pixel's coordinates are unique. The table below shows how a 3x3 grid would be divided.
x=1, y=1 | x=2,y=1 | x=3, y=1 |
x=1, y=2 | x=2, y=2 | x=3, y=2 |
x=1, y=3 | x=2, y=3 | x=3, y=3 |
To create the fractal, we must have a mathematical function. A function is a mathematical formula that, when two coordinates are inserted in one end, two new coordinates will come out the other. So, to start, a pixel is selected. The coordinates are inserted into one end of the function, and new coordinates come out the other. We move to that point. Then, the coordinates for the new point are inserted through the first end, continuing this pattern repeatedly, giving us a new set of coordinates each time..
When we do this, one of two things may happen. The point may
move around back and forth in circles, never leaving the screen.
Or, it might leave the screen after a certain number of times the
function is used, or iterated. This determines the colors in the
fractal picture. If the point never leaves, we go back to the
first coordinate, and make it a certain color (e.g. blue). All
the points that never leave the screen are colored the same way.
If the point does leave the screen, then we count how many times
it took to leave the screen, and use that number to assign a
color to the pixel. For example, one iteration might be colored
red, two blue, etc. This accounts for the wide range of colors in
most fractals.
The next picture is an example of solving for a certain point on the Mandelbrot set (you can recognize the Mandelbrot set by it's distinctive shape). Point 0 is the original position, and each successive number is the coordinates after each iteration. So, after one iteration it reached point 0, and so on. You can see that at point 5 it leaves the screen, so it will be colored by whatever color is set for number 5.
For the Mandelbrot set, the pixels inside the boundary are the ones that never leave the screen, as you can see below. That is why this part is all colored equally. The boundary of the Mandelbrot set is very complicated because in this area the amount of iterations to leave the area changes rapidly.
Now we repeat this process with every pixel in the image. There
may be 800,000 or more pixels in one picture, so that's why
making fractals can take a long time!
For example, let's say we start with the pixel with an x-coordinate 1, and a y-coordinate 2. Perhaps when we use the function, the new pixel will have x-coordinate 3, and y-coordinate 8. Then, if we apply it again, it returns to x=1, y=2! Right back to where we started. We now know that this function will continue in a loop, so we color it accordingly. But let's say we look at the pixel with x-coordinate 9, and y-coordinate 7. Perhaps when we use the function, it will go to x=10, y=13. Applying it again, we get x=132, y=26. This is out of the screen, so we will color it color #2 because it took 2 iterations to leave the screen.
To learn more about how fractals are generated, read the lesson Creating Fractals: the Mathematics
Special thanks to The Fractory for the pictures and the basis for these lessons.
Home | Image Galleries | Animations | Types of Fractals | Downloads | Understanding Fractals | Contest | Links