« The GalaxyGoo Flash-a-thon Begins! | Main | Vassarely »

Chaos Game

Introduction:
We're going to start with a fantastic piece by Keith Peters. What a great way to kick off the Flash-a-thon! ~Kristin

seirpinski.jpg

Author: Keith Peters
Author's comments:
The Chaos Game is a simple algorithm that can produce some surprising fractal forms. This one has been done in 3D. More info here: http://mathworld.wolfram.com/ChaosGame.html


Support the educational projects at GalaxyGoo, and make an online donation through Network for Good or Facebook Causes..

For live version, and source files, continue reading.

Click to start and stop the animation.




Basically, you take a polygon, a random point. and a ratio. Choose one of the "corners" of the polygon at random and find the point at the specified ratio between that corner and the point. Then choose another corner at random, and find the point at the same ratio between the last point and the corner. Repeat about 10,000 times.

In the source, there are two parameters, sides and ratio. They have been set up to create a 3-sided polygon (triangle) with a ratio of 1/2. This creates the famous Sierpinski triangle. Choosing other values gives you results like this:

chaosgame1.jpgchaosgame2.jpg
chaosgame3.jpgchaosgame4.jpg


Download Source


Support the educational projects at GalaxyGoo, and make an online donation through Network for Good or Facebook Causes..



Creative Commons License

Creative Commons License


This work is licensed under a
Creative Commons GNU General Public License License and a
Creative Commons Attribution 3.0 United States License.