But if you want to calculate more
than one or to iterations, it quickly becomes awful. It is impossible to
store the coordinates in such an order that you know which one follows
which one, you have problems too when you want to insert the new points
between the other ones...

So, it seems to be impossible to
draw the snowflake when thinking this way.

What is the good approach?

Let us remember what we have
said in the part - 2 - b -. The Koch snowflake is an iterated function
system.

How can we describe what we are
doing when iterating one time.

A first algorithm is.

length=one

draw a line (length/3) long

turn left 60°

draw a line (length/3) long

turn right 120°

draw a line (length/3) long

turn left 60°

draw a line (length/3) long

- the first iteration -

Now, if we call this small sequence
of instruction a function: **Function flacon(length,n) **where n is
the number of iteration, the algorithm for 2 iteration will be:

length=one

flacon(length/3,n-1)

turn left 60°

flacon (length/3,n-1)

turn right 120°

flacon (length/3,n-1)

turn left 60°

flacon (length/3,n-1)

This algorithm will be translated
into Fortran. So we will only calculate the coordinates of the points,
and afterwards, we will use Matlab so as to visualize the results of our
calculations.

Consequently, the instruction "draw
a line (lenght/3) long" will become a "write xa, ya and xb, yb in a file".

We take an equilateral triangle
as initial pattern, so as to obtain the whole Koch's snowflake at the end.

One problem is to determine the
coordinates of the point E, knowing the coordinates of the points A and
B. The calculations are detailed in annex. To sum up, we write that this
point is the intersection of to circles, which radius equal d(A,B)/3.

Note that the test concerning the
sign of the difference between X_{A} and X_{B} is aimed
at choosing which point is the good one. As a matter of fact, we gain two
points with this method, and it is not obvious to choose the right one.

Here is the listing of the program:

- listing of the Fortran program to generate the Koch's snowflake -

Just click and a page will open where you can cut and copy in a

Normally, the files

If you experience some problem, the

Then, just type in Matlab command window:

load x.txt

load y.txt

plot (x,y)

You can remark that the subroutine flacon calls itself inside. This is very specific, and this is why we have to precise "recursive subroutine". Omitting this word will cause the compiler to generate an error.

Now that we have typed those lines, we can run the koch.exe program generated by the compiler and use Matlab so as to visualize the points stocked in the two files x.txt and y.txt.