Arun Waves

November 26, 2011

Sierpinski triangle

Filed under: code,Processing,sketch — Arun @ 12:21 am
Tags: , ,

Note: It would help to know a little bit about fractals to appreciate this post.

Ever wanted to create a fractal? For those who are not aware of fractals think of it as a special figure that retains its form no matter how much zoomed in you are, a property known as self-similarity. Don’t believe me, check out this and this.

Quite mind boggling in itself, now if someone told you that this can be generated by a random algorithm!! I had to check it out for myself, so I used the familiar and easy to use Processing programming language to test it. You can read about the algorithm here, it basically involves a moving point whose direction is determined by rolling a dice. The point moves half distance towards one of the three vertices of a triangle When the dice has been rolled a sufficient number of times, you can see the Sierpinski Triangle. In this case the main triangle can be broken into 3 triangles which look like the original triangle and sub-triangle can be broken into 3 more similar triangles. See for yourself ……………..

Here are some screen shots;

Create a free website or blog at