Koch Snowflake

What is it?

The Koch curve is constructed by dividing a line into three equal parts and replacing the middle segment by the other two sides of an equilateral triangle constructed on the middle segment. Repeated indefinitely results in a continuous curve which is of infinite length and nowhere differentiable. The Koch snowflakes are created by successively extending the sides of a triangle and are the result of an Iterated Function Systems. Iterate means to repeat an operation, generally using the last result of that operation as the input.
k1.gif k2.gif k3.gif SELF3.gif
Images from hmf.enseeiht.fr

  1. Draw an equilateral triangle
  2. Divide each side into three equal parts
  3. Remove the middle segment (= 1/3 of the original line segment) replace the middle segment with two segments of the same length (= 1/3 the original line segment) such that they all connect (i.e. 3 connecting segments of length 1/3 become 4 connecting segments of length 1/3.)
  4. To complete the shape, the above procedure is repeated indefinitely on each line segment on the side of a triangle.
image861.gif
http://ecademy.agnesscott.edu/~lriddle/ifs/ksnow/ksnow.htm


An example using Mathematica:
(*  program for a Koch snowflake.  found in the Notices
    of the AMS Vol .39 #7 Sept 92, page 709    *)

KochSnowflake[n_Integer?NonNegative] :=
   Show[Graphics[
       Nest[ (#1 /. 
       Line[{start_, finish_}] :> doline[start, finish]) &,
              {Line[{{0, 0}, {1/2, Sqrt[3]/2}}],
                Line[{{1/2, Sqrt[3]/2}, {1, 0}}],
                Line[{{1, 0}, {0, 0}}]},
              n]],
     AspectRatio -> Automatic, PlotRange -> All]

doline[start_, finish_] :=
   Module[{vec, normal},
    vec = finish - start;
    normal = Reverse[vec] {-1, 1} Sqrt[3]/6;
    {Line[{start, start + vec/3}],
     Line[{start + vec/3, start + vec/2 + normal}],
     Line[{start + vec/2 + normal, start + 2 vec/3}],
     Line[{start + 2 vec/3, finish}]
     }
    ]
Show[KochSnowflake[5]]
Export["koch5.dxf", Show[KochSnowflake[5]]]
  1. Run the Mathematica by passing different numbers into the equation, remember to change the names of the dxf files






  2. member pmoews created an openSCAD file for Koch Snowflakes.

    The triangles and carpets in these OpenSCAD files are limited to 3 or 4 iterations.