Chaos Game (Sierpinski Gasket!)

Words
174
Reading
1 min
Listen
Play
9y



According to Wikipedia:


"In mathematics, the term chaos game originally referred to a method of creating a fractal, using a polygon and an initial point selected at random inside it"

As an explanation check out this cool youtube video by Numberphile!



In this video they make a triangle and then use any "trace point" which iteratively moves from its previous position half way towards a randomly chosen point from the original triangle. This process results in a picture of the Sierpinski Triangle! Using different starting shapes and fractions (i.e. "half way"), you can create a lot of cool patterns.

Tonight I made a simulation in javascript to see what would happen if you did this in 3 dimensions with a tetrahedron. I theorized it would give you the Sierpinski Tetrahedron (Sierpinski's Gasket). Turns out I was right!


Animation: http://www.jackmckeown.com/projects/simulation/Sierpinski/
Code: http://www.jackmckeown.com/projects/simulation/Sierpinski/simulation.js

EDIT: BTW don't let it run forever...it will just keep adding more and more points until it eats all of your ram ;) Don't worry...it's not going to hurt anything, but it might be annoying.

Chaos Game (Sierpinski Gasket!) | Ecency