
%!PS-Adobe-2.0 EPSF-2.0
%%Title: Curva di Koch - by Emanuele Paolini
%%BoundingBox: 0 50 550 660
%%Pages: 1
%%EndComments
%%EndProlog
%%Page: 1 1
/koch {
dup 1 ge {
1 sub gsave
1 3 div dup scale dup koch
1 0 translate 60 rotate dup koch
1 0 translate -120 rotate dup koch
1 0 translate 60 rotate dup koch
grestore} {newpath 0 0 moveto 1 0 lineto stroke}
ifelse pop
} def
20 500 translate
500 500 scale
0.1 setlinewidth
%numero di iterazioni:
8
dup koch
1 0 translate -120 rotate dup koch
1 0 translate -120 rotate dup koch
showpage
%%Trailer
Notice that PostScript pictures are vectorial, so the printing resolution is only bounded by the resolution of the printer (or the monitor if you use a preview). As a matter of fact, the previous picture is the 8th iteration of the "snow-flock" fractal, and it contains exactly 196608 small segments, each 0.003 cm long.
Notice moreover that the number of iteration can be modified at will simply modifying a number in the source code. PostScript, indeed, is a complete programming language (in reverse polish notation). All the computations needed to draw the fractal, are accomplished by the printer itself.
Other nice fractals written in PostScript:
koch.ps koch.gif
peano.ps peano.gif
sierpinski.ps sierpinski.gif
sierpinski2.ps sierpinski2.gif
cantor.ps cantor.gif
drago.ps drago.gif
cerchi.ps cerchi.gif