Koch curve: The Koch curve or Koch snowflake is a mathematical curve, and it is one of the earliest fractal curves which was described. Its basis came from the Swedish mathematician Helge von Koch. Here, we will learn how to write the code for it in python for data science.
The progression for the area of snowflakes converges to 8/5 times the area of the triangle. The progression of the snowflake’s perimeter is infinity. The snowflake consists of a finite area that is bounded by an infinitely long line.
First, we need to draw an equilateral triangle. It is good if the sides are divisible by 3 because of the nature of fractal.
Now we will divide each side into three equal parts.
Now we need to draw an equilateral triangle from the intersection of the three divided parts on each side.
Now we will divide the outer parts created into three parts as we have done before.
Now draw an equilateral triangle in each of the middle parts.
Representing in Lindenmayer system:
We can write the Koch curve by the following rewrite system.
Constants: +, ?
Production rules: F ? F+F-F+F
In the above illustration, F represents draw forward, – represents turn right 60 degrees and + represents turn left 60 degrees.
Creating a Koch curve:
For the creation of a full snowflake with Koch curve, we will repeat the same step three times.