m (→Understanding Recursion in the Koch Curve: Moved image) |
(added content) |
||
Line 8: | Line 8: | ||
===Understanding Recursion in the Koch Curve=== | ===Understanding Recursion in the Koch Curve=== | ||
[[File:Kochsim.gif|thumb|The Koch Curve]] | [[File:Kochsim.gif|thumb|The Koch Curve]] | ||
− | The Koch Curve is made of four Koch Curves that are a third of the size of the original Koch Curve. They are they are arranged so that the first and fourth are flat and the middle two point up to make an | + | The Koch Curve is made of four Koch Curves that are a third of the size of the original Koch Curve. They are they are arranged so that the first and fourth are flat and the middle two point up to make an equilateral that is triangle missing one side. |
[[File:Recersion in Koch Curve.png|500px]] | [[File:Recersion in Koch Curve.png|500px]] | ||
− | To make it easier to draw the Koch Curve | + | To make it easier to draw, the Koch Curve can be broken down into iterations, each one more complicated than the last. The first iteration is made up of four straight lines. The second iteration contains four copies of the first iteration. The third iteration contains four copies of the second iteration or sixteen copies of the first iteration. As iterations are added it gets more complicated and looks more and more like the real Koch Curve. |
[[File:Iterations of Koch Curve.png|500px]] | [[File:Iterations of Koch Curve.png|500px]] | ||
Line 20: | Line 20: | ||
====Basic Pen Path without Recursion==== | ====Basic Pen Path without Recursion==== | ||
+ | The triangle in the center is an equilateral triangle, therefore each of it's angles have a measure of 60°. | ||
+ | |||
+ | [[File:Equilateral Triangle in Koch Curve.png|500px]] | ||
+ | |||
+ | Using basic geometry the angles of the rotations the sprite must make can be found. | ||
+ | |||
+ | [[Sprite Turns in Koch Curve.png|500px]] | ||
====Adding Recursion==== | ====Adding Recursion==== | ||
+ | |||
+ | ==See Also== | ||
+ | *[http://www.example.com A [[Scratch Project]] that draws the koch curve] | ||
[[Category: Scripting Tutorials]] | [[Category: Scripting Tutorials]] |
Revision as of 22:50, 31 May 2013
This article or section is currently undergoing major changes by Bsteward (talk | contribs). Please avoid largely modifying this page's contents until this template has been removed. (Date?) |
Recursion is the process of repeating items in a self-similar way. Recursion can be implemented in Scratch by making a block that uses it self. This can be used to create fractals. A fractal is pattern that produces a picture, which can be zoomed into infinity and will still produce the same picture. Some common examples of fractals are The Mandelbrot, The Sierpinski Triangle, and The Koch Snowflake.
Contents
Creating the Koch Curve
The Koch Curve is a fractal that can be created relatively easily in Scratch. The Koch Curve is part of a larger fractal, the Koch Snowflake.
Understanding Recursion in the Koch Curve
The Koch Curve is made of four Koch Curves that are a third of the size of the original Koch Curve. They are they are arranged so that the first and fourth are flat and the middle two point up to make an equilateral that is triangle missing one side.
To make it easier to draw, the Koch Curve can be broken down into iterations, each one more complicated than the last. The first iteration is made up of four straight lines. The second iteration contains four copies of the first iteration. The third iteration contains four copies of the second iteration or sixteen copies of the first iteration. As iterations are added it gets more complicated and looks more and more like the real Koch Curve.
Implementing it in Scratch
Basic Pen Path without Recursion
The triangle in the center is an equilateral triangle, therefore each of it's angles have a measure of 60°.
Using basic geometry the angles of the rotations the sprite must make can be found.