Fractals and Chaos
VonKochSnowflake.gif (1087 bytes) von Koch Curve  Lab Report
Neils Fabian Helge von Koch's "Snowflake"
ScreenVonKochSnowflake.JPG (37028 bytes)
ScreenModifiedVonKochSnowflake.JPG (41965 bytes)

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 vonkoch0.gif (1032 bytes)
1 vonkoch1.gif (1206 bytes)

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 vonkoch2.gif (1290 bytes)
3 vonkoch3.gif (1372 bytes)
4 vonkoch4.gif (1473 bytes)

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: 

EquilateralTriangle.gif (2137 bytes)

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

vonKochAreaRecurrencesk.gif (518 bytes)

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:

vonKochAreaRecurrence.gif (719 bytes)

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

vonKochArea.gif (372 bytes)

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.)

VonKochModified.gif (1203 bytes)

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)

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


  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.

(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]

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

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.


Add FormResize handler.

Links:  (Also see Fractals and Chaos Section of efg's Mathematics Reference page)

Chaos Theory:  A Brief Introduction
Fractal Geometry:  A Simple Explanation
Fractals and Fractal Geometry
Koch's Flakes in "Fractals Polyhedra, Flakes & L-trees" 
"Koch Snowflake" from Eric Weissteins's World of Mathematics
Snowflake Curve


[Devaney89] Robert L. Devany and Linda Keen (editors)
Chaos and Fractals -- The Mathematics Behind the Computer Graphics
Figure 2, p. 114, Hausdorff dimension
American Mathematical Society, 1989.
[Falconer90] Kenneth Falconer
Fractal Geometry:  Mathematical Foundations and Applications
Example 9.5, Modified von Koch Curve, pp. 120-121
John Wiley & Sons, 1990.
[Peitgen92A] Heinz-Otto Peitgen, Hartmut Jürgens, Dietmar Saupe
Chaos and Fractals -- New Frontiers of Science
Section 2.4, The Koch Curve, pp. 89-93
Springer-Verlag, 1992
[Peitgen92B] Heinz-Otto Peitgen, Hartmut Jürgens, Dietmar Saupe
Fractals for the Classroom
Section 3.2, Geometric Series and the Koch Curve, pp. 164-170
Springer-Verlag, 1992

Updated 14 Jun 2009
Since 9 Apr 2000