Warning: Use of undefined constant image_setup - assumed 'image_setup' (this will throw an Error in a future version of PHP) in /home/westleyw/public_html/wp-content/themes/autofocus/functions.php on line 576

Warning: Use of undefined constant image_setup - assumed 'image_setup' (this will throw an Error in a future version of PHP) in /home/westleyw/public_html/wp-content/themes/autofocus/functions.php on line 577
Westley Wood » Fractal
© 2011 Westley Wood

Fractal

Fractals are shapes that are made up of multiple fractions of its original self.  Fractals like the Julia Set (in the above image) can be zoomed in to infinity, because the fractal generator continuously recalculates the fractal for each zoom.  When drawing a fractal like this, every pixel is first converted to a point.  Then each point is processed through an equation and the result will either be within the original values of restriction or it will escape the values indefinitely.

The program above continuously checks if the result of the equation is created within the set restrictions.  If at anytime the result exits the loop early, than the color of that pixel is based on how quick it exits the loop.  If it doesn’t exit the loop, than it is created as a black pixel.

This particular fractal is just one of the many Julia Set fractal.  Which is a small section of an even bigger fractal known as Mandelbrot Fractal.  These fractals both use the same formula to calculate their images.  The formula is:

Z = Z ² + C

To understand this formula you must first understand that Z represents a point on a graph.  Since it is a point on a graph, it will have an X value and a Y value.  We will call these Zx and Zy.  In order to calculate Z as a point, we will need to write out the full equation with respect to the X and Y values.  So first lets replace the first Z with (X + iY).

Z = X + iY

We are going to use this same idea to replace the ², with (X + iY)*(X + iY).

Z² = (X + iY) * (X+iY)

This factors out to be X² + 2iXY – Y².

Z² = X² + 2iXY – Y²

This is where it gets tricky.  If you are wanting to draw a Mandelbrot fractal (shown to the right), then you will need to initialize the X and iY to zero.  Then you will use the C as the point/pixel that you will be checking in the algorithm.

 C = Cx + iCy

Zx = X² – Y² + Cx

Zy = 2XY + Cy

On the other hand if you want to create one of the Julia Set’s you must set the original X and iY values as the calculated point/pixel and then set C as the point of the defined Julia Set.

Systems like these are the basis of Chaos Theory.  These systems can all find some level of order in what seems like a completely random pattern.  Not every random pattern is chaos, because there are some random patterns that cannot be defined by “time,” and since chaos is finding the order in respect to time.  They cannot be considered a chaotic system.

My partner Joshua Smith who developed the L-system for our fractal generation program.  Can be found at his blog  JALB.ME where he has several more pictures of the L-system and the Julia Set.  We will also be posting our fractal program on our sites soon. So keep an eye out for the download.

 

Post a Comment

You must be logged in to post a comment.