How do you make Koch snowflakes?
Construction
- Step1: Draw an equilateral triangle.
- Step2: Divide each side in three equal parts.
- Step3: Draw an equilateral triangle on each middle part.
- Step4: Divide each outer side into thirds.
- Step5: Draw an equilateral triangle on each middle part.
Is a snowflake infinite?
The areas enclosed by the successive stages in the construction of the snowflake converge to 85 times the area of the original triangle, while the perimeters of the successive stages increase without bound. Consequently, the snowflake encloses a finite area, but has an infinite perimeter.
How to create a Koch snowflake in Python?
And it introduces the computer science idea of recursion. Start the project by making an empty file koch.py . Right-click and open it with IDLE. We’re going to define a function that either draws a line with a kink in it, or draws a straight line the same length. Which one it does will depend on whether the argument order is greater than zero.
What are the parts of the Koch snowflake fractal?
After finding a piece of code on StackOverflow that drew the Koch snowflake fractal, I made a ton of modifications to it and used it to produce an animation divided in two parts: Constant size, recursion depth increasing. Constant recursion depth, size increasing.
What makes the Koch curve look like a snowflake?
The real Koch curve is what these drawings get closer and closer to as the order goes up, and the lines get smaller. Mathematicians call things defined that way a limit. The curves we draw all have smooth (straight line) segments. But they look like the Koch curve, once the straight parts are too small for us to see.
When to change Koch to recursive in Python?
Change the function koch, just a little: When a function calls itself, we say it is recursive . Recursion can solve problems that simple iteration (like a for-loop) cannot. Save and run. You will get the same two curves as before, because of the test code.