--- /dev/null
+%!PS-Adobe-3.0 EPSF-3.0
+%%BoundingBox: -40 -40 140 120
+% Generates a koch snowflake, or crashes your pdf viewer, whichever you prefer.
+
+
+% Usage:
+% x1 y1 x2 y2 iterations koch x1 y1 ... x2 y2
+/koch {
+ 20 dict begin
+ /iteration exch def
+ /y2 exch def
+ /x2 exch def
+ /y1 exch def
+ /x1 exch def
+ /dy y2 y1 sub def
+ /dx x2 x1 sub def
+ /dist dx dx mul dy dy mul add sqrt def
+ /nx 0 dy sub dist div def
+ /ny dx dist div def
+
+ /xA dx 3 div x1 add def
+ /yA dy 3 div y1 add def
+ /xB dist 3 div nx mul dx 2 div add x1 add def
+ /yB dist 3 div ny mul dy 2 div add y1 add def
+ /xC dx 3 div 2 mul x1 add def
+ /yC dy 3 div 2 mul y1 add def
+
+ iteration 0 gt
+ {
+ /next_iteration iteration 1 sub def
+
+ x1 y1 xA yA next_iteration koch
+ xA yA xB yB next_iteration koch
+ xB yB xC yC next_iteration koch
+ xC yC x2 y2 next_iteration koch
+ %xB debug
+ }
+ {
+ x1 y1 moveto x2 y2 lineto
+
+ } ifelse
+ end
+} def
+
+/debug { moveto 20 string cvs show} bind def
+/Coronet findfont 12 scalefont setfont % Fancy font!
+
+% End prolog
+
+
+% Draw some text and the initial triangle faintly
+0.9 0.9 1 setrgbcolor
+(Koch's) 38 40 debug
+(Snowflake) 28 28 debug
+1E-6 setlinewidth
+0 0 moveto 50 100 lineto 100 0 lineto 0 0 lineto stroke
+
+/iterations 7 def % Define to the desired number of iterations to crash your pdf viewer
+0 0 1 setrgbcolor
+0 0 moveto
+0 0 50 100 iterations koch
+50 100 100 0 iterations koch
+100 0 0 0 iterations koch closepath
+fill
+
+showpage