Posted in Mathematics

The Koch Curve

Back to the world of fractals…

One of the famous fractals is the Koch curve, described by Helge von Koch in the early 1900s.

The basic idea of this fractal is as follows:

  1. Take an equliteral triangle, build another triangle in the middle of each side of the shape, the new triangle having a base length of 1/3 of the length of the side.
  2. Repeat ad infinitum.

Turtle graphics are very handy in the implementation. The needed functions or methods are Forward: Draw a line in given amount of units forwards to the current drawing angle. The second is Turn: Turns the drawing angle in given amount of degrees.

With recursion we are now ready to go to build a snowflake based on the Koch curve.

Below is two videos of my implemantation:

..and the same with more iterations: