Lesson A9 - Recursion |
|
|
KochCurve Background: You can create a number of line drawings by starting with a simple pattern that is recursively subdivided in parts, each of which is (at least approximately) a reduced-size copy of the whole. The results are related to mathematical objects called “fractals”, and so images generated in this manner are often called "fractal" images. One example of a fractal curves is the “Koch curve” introduced by Swedish mathematician Helge von Koch in 1904. You can derive a Koch curve by beginning with the following basic four-segment piece: You then replace each line segment of the diagram with a smaller copy of itself. You again replace each line segment of the diagram with a smaller copy of the basic shape. Koch curves display an intricate beauty, as the number of levels of replacement increases. An even more remarkable figure can be created by joining three Koch curves as if they were the sides of a triangle. This figure is often referred to as a "Koch snowflake": The procedure for creating a Koch curve is usually recursive. At each level, we observe that a Koch curve is made up of four smaller Koch curves. This process can be described in the following pseudocode:
Instructions:
|
|