A neat little bit of PostScript

Here is a short PostScript program.

  /D{def}def /d{.00017 add D}D /C{2 copy dup mul exch dup mul}D /g 150 string
  D /y .29 D 150 150 8[.4 0 0 .4 -45 -90]{/x -1.2 D 0 1 149{x y /n 300 D{/n n
  5 sub D C exch sub x add 3 1 roll 2 mul mul y add C add 4 gt n 5 eq or{exit
  }if}loop pop pop g exch n put /x x d}for /y y d g}image showpage

I can't remember where I got the program, and I don't know how it works. But for such a short program to produce a fractal diagram (which is what it does) seems rather clever. If your browser is up to it, you'll be able to see the diagram by selecting this link. (Attempting to send the program to a networked PostScript printer may not be advisable if you wish to stay friends with other users: the diagram can take several minutes to print.)


Links to home pages: [Personal] [Statistics] [IMS] [UKC]
Mike Bremner
19 April 1997 (minor revision, for technical reasons only, 15 September 2002)