Chaos Game (Sierpinski Gasket!)

in #mathematics7 years ago (edited)



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.

Coin Marketplace

STEEM 0.16
TRX 0.13
JST 0.027
BTC 59226.54
ETH 2603.16
USDT 1.00
SBD 2.42