University of Calgary

koch curve

Creating a Koch Curve 

source: Tino Duong, 2003

Description:

(Note: Description and question was taken from Dr. J. Boyd)

 

 

Your job is to write a function that computes Kn+1 from Kn. Generate all the data points needed to make K10. For K0 use (0,0) to (0,1).

Requirements:

    The format of the file MUST look like this

    0 0
    0.111111 0
    0.166667 0.096225
    0.222222 0
    0.333333 0
    0.388889 0.096225
    0.333333 0.19245
    0.444444 0.19245
    0.5 0.288675
    0.555556 0.19245
    0.666667 0.19245
    0.611111 0.096225
    0.666667 0
    0.777778 0
    0.833333 0.096225
    0.888889 0
    1 0

As you can see, this is just two columns of numbers. Each row is a data point (x,y) indicating the position of the point in the graph. The above points represents the data points for a K2 curve. The points from top to bottom are represent each point in the curve from left to right. Make sure your functions output the curve points in this order, to ensure proper display of the curve.

To view the graph of the K2 curve.

  1. Copy the above data points exactly in a file called "output.txt"
  2. Start "gnuplot" by typing gnuplot at the command terminal
  3. When gnuplot is running type:    plot "output.txt" with lines

    This fill create a graph of the curve.

Concepts:



Updated: August 10, 2005 11:10 PM