Experimenting with code when generating the Sierpinski triangles resulted in a beautiful picture of two birds kissing each other

143 Views Asked by At

So I recently found out about the Sierpinski triangles and decided to code it up myself because it seemed like a fun thing to do.

The original algorithm is as familiar:

  1. Take three points in a plane to form a triangle, you need not draw it.
  2. Randomly select any point inside the triangle and consider that your current position.
  3. Randomly select any one of the three vertex points.
  4. Move half the distance from your current position to the selected vertex.
  5. Plot the current position.
  6. Repeat from step 3.

What I instead did on step 4 just to try and spice things up was to calculate $x'= (x_{2} - x_{1})/2$ and $y' = \frac{\sqrt{(x_{2} - x_{1})^2 + (y_{2} - y_{1})^2}}{2}$ and ended up with the following result.

This is absolutely unexpected and beautiful. I have tried Googling around but have yet to find anyone mentioning this fractal. I just wanted to share this cool and beautiful fractal.

birds

Zooming in we see another pair of birds

zoomed_in_one

Yet another zoom in...

zoomed_in_two