/sierpinski_triangle

simple project for fun over christmas holidays

Primary LanguagePython

Sierpinski Triangle

Wiki: https://en.wikipedia.org/wiki/Sierpi%C5%84ski_triangle

Achieved using Chaos Game method described on Wikipedia.

Steps:

  • Draw 3 points of the eqiTrianglep0,p1,p2
  • draw a pointp3 on random (I have constrained it a fair bit)
  • now draw the next pointp4 as a point at half the distance betweenp3 and a single point of the triangle that was chosen at randomp0,p1,p2
  • continue but next pointp5 is drawn at half the distance of a pair of pointsp4 and random(p0,p1,p2)
  • repeat until satisfactory

Result of sierpinski.py:

sierp svg