von Koch Curve Lab Report
 Neils Fabian Helge von Koch's "Snowflake"

Purpose
The purpose of this project is to show how to create a von Koch curve, including a von Koch snowflake.

Mathematical Background

Swedish mathematician Helge von Koch introduced the "Koch curve" in 1904.  Starting with a line segment, recursively replace the line segment as shown below:

 0 1

The single line segment in Step 0, is broken into four equal-length segments in Step 1.  This same "rule" is applied an infinite number of times resulting in a figure with an infinite perimeter.

Here are the next few steps:

 2 3 4 ...

If the original line segment had length L, then after the first step each line segment has a length L/3.  For the second step, each segment has a length L/32, and so on.

After the first step, the total length is 4L/3.  After the second step, the total length is 42L/32, and after the kth step, the length is 4kL/3k.  After each step the length of the curve grows by a factor of 4/3.  When repeated an infinite number of times, the perimeter becomes infinite.  For a more detailed explanation of the length computation, see [Peitgen92B, p. 107] or Eric Weisstein's World of Math.

For the von Koch "snowflake," start with an equilateral triangle, and apply the "rule" above to each of the line segments.  Assume each side of the equilateral triangle is a units long.  The area of this equilateral triangle can be computed by breaking it into two 30-60-90 triangles:

The height of one of these two triangles is and the base is .  So, the area of the equilateral triangle (two 30-60-90 triangles) is .  In each step k, we add the area of nk little equilateral triangles with sides sk.  The area at step k can be written:

Convince yourself that n1 = 3, n2 = 3·4, n3 = 3·4·4, ..., and nk = 3·4k-1.  The sides of the little triangles are scaled down by a factor of 3 in each step, i.e., sk = (1/3)na.   The area recurrence formula can now be written:

The total area can be computed by evaluating the geometric series formed by the above recurrence formula.  The total area after an infinite number of steps is

For a more detailed explanation of the area computation, see [Peitgen92B, p. 167] or Eric Weisstein's World of Math.

In summary, the von Koch snowflake has an infinite perimeter, but a finite area!

The von Koch curve has a self-similarity, Hausdorff dimension, D = log 4/ log 3 = 1.2619.  (A line is 1D and a square is 2D). See [Peitgen92A] or [Devaney89].

The "modified" Koch curve [Falconer90, pp. 120-121] uses a rectangle in each iteration instead of a triangle.  (The height of the rectangle is the same as the height of the triangle in Step 1 above.)

Feel free to experiment with other "rules."

Also see Experiments in Computing:  Laboratories for Introductory Computer Science in Turbo Pascal by Kenneth Abernethy and J. Thomas Allen, Jr., PWS-Kent Publishing, Boston, 1993, Chapter 20, Recursion in Fractal Geometry.   The Koch Snowflake Curve, pp. 342-348; Generalized Snowflake Curves,  pp. 349-350.

Materials and Equipment

Software Requirements
Windows 98
Delphi 4/5 (to recompile)
KochCurve.EXE

Hardware Requirements
VGA display with 640-by-480 screen in high/true color display mode

Procedure

1. Double click on the KochCurve.EXE icon to start the program.
2. Select various values in the spinboxes at the left and immediately observe a new von Koch curve on the screen.
3. Select the Print button to print the currently displayed von Koch curve (perhaps in greater detail since many printers have many more dots than a display screen does).
4. To write a file to disk, select the bitmap size, and the press the Write to File button.  A save dialog will let you write this file anywhere you want.

Discussion
(Outline for now)

ScreenKochCurve unit and form:
- DrawVonKoch method
- ButtonPrintVonKochClick
- ButtonVonKochFileClick
- ShellExecute to link to web site

VonKochCurveLibrary unit (separates computations from user interface):
- TVonKochCurve Class with method Draw (draws on any canvas:  screen, printer, or bitmap)
- NextSegments (Local routine to Draw, which is called recursively.  Since NextSegments works with any line segment, the points making up the polygon are rotated before this routine is ever called.)

MapWorldToPixel unit:
- TRealPoint, RealPoint
- TRealRect, RealRect
- TDigitalPantograph [for mapping real (x,y) to integer (i,j); "corrects" direction of y-dimension]

Conclusions
Tell your friends:  the von Koch snowflake has an infinite perimeter, but a finite area!  What does that really mean?

Keywords
von Koch curve, von Koch snowflake, fractals, self-similarity, Hausdorff dimension, digital pantograph, world-to-pixel mapping, recursion

Delphi 4/5 Source and EXE:   VonKoch.ZIP (201 KB)

Turbo Pascal 7 Source and EXE:  Koch.ZIP
Note:  If you have a fast machine (233 MHz Pentium II or faster), you'll likely need a patch to run this TP 7 programs.
See this fix for "Runtime Error 200" for Turbo Pascal.

Future