Anand Vishwanathan

Back
Refresh
Home
Search

HomeAbout MeMusicPhotosProjectsArticles
Software Process Automation
VB Control Conversion Project methodology and its automation
VHDL - An Introduction
Computer Networking
Pentium 4 Microprocessor
Web Site Designing Tutorial
CD-ROM Drives
Fractals
DownloadsGalleryFeedback

Planet Source Code.com

 The Amazing World of Fractals

 
This article was published in Short Circuit, the quarterly magazine of IEEE Bombay Chapter

Most of us like to play simulator games on Computers in which the player seems to race down a racetrack or fly through a realistic terrain. The landscapes used in these games look so real that most of us feel lifted from the real world into the virtual world. You would be amazed to know that most of these landscapes are developed using a certain type of images called Fractals. Applications of Fractals extend to the Chaos Theory in Mathematics where they show an order in seemingly random thing, and give us tools with which we can predict the weather, render natural looking objects, and help understand the order in our chaotic lives. In fact the very cover of this magazine is a fractal representing the Sun.

Any fractal image can be regarded as a plane made up of many points, each point having an x-coordinate and a y-coordinate, which determine its position on the plane. In fact, if you observe the fractal on the cover page carefully, and zoom into any portion of the figure, you will observe the same image. This is the most important property of Fractals.

To generate the fractal, a certain function is selected. This function is a bunch of math that can be performed on any pair of coordinates, and it will give two new coordinates. So to start with, a point is selected. Then a function is iterated on the point. This gives a new x-coordinate and a new y-coordinate. We evaluate the function at this new point to get yet another set of coordinates. This iterative process is continued for a for every new set of coordinates we get from the function. As we do this, one of the following may happen:

  1. The point may move around when we iterate the function, but never leave the plane.
  2. Or, it may stay on the plane for a while, and then leave, never to be seen again.

Depending on which of the above occur, fractals are painted with different colours. If the point never leaves the plane, then we go back to the first coordinates for that point, and make the point there a different colour. The points that never leave the plane are all coloured the same colour. If eventually the point does leave the plane, however, then we count how many times we had to iterate our function to make it leave, and use that number to colour the pixel at the original coordinates. For example, if it takes one iteration to make the point leave the plane, then maybe we colour it blue. It it takes two, then maybe its red. And so on.

The functions used for the generation of fractals are complex in nature and of the form f(z) = u + iv + c, where u and v are real and c is a complex constant.

Fractal images are of various types. The most common and widely used are the Julia Set and the Mandebroth Set. The only difference in these is the mathematical functions used for their generation and, of course the results.

Consider a function

zn = zn-12 + c

For the Mandelbroth Set, c is a complex value represented by the point on the plane where the current iteration is being performed. Thus, the iterations may result in equations such as

z1 = z02 + c, where z0 = initial point of c

The above process may be repeated until it approaches infinity (i.e. the point leaves the plane) or upto a certain maximum number of iterations decided (you certainly would not like to continue the iterative process waiting for the point to leave the plane while it is sure that it never will).

Similarly, for the Julia Set the above function would be suitable except for the difference that c is a fixed value for all the iterations and independent of the current point.

It is very difficult to predict the fractal obtained from a certain function. Fortunately, there are various commercial softwares available to help you create your own fractals.

 

 


Back to Top

Copyright © 2002 - 2009 and onwards, Anand Vishwanathan