Skip to content

Instantly share code, notes, and snippets.

@duggan
Created July 21, 2015 12:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duggan/cb440e5b266077589d8e to your computer and use it in GitHub Desktop.
Save duggan/cb440e5b266077589d8e to your computer and use it in GitHub Desktop.
PostScript for generating a Mandelbrot set.
%!PS-Adobe-2.0
51 .5 551 { /x exch def 111 .5 721 { /y exch def y 521 sub 201 div x 301 sub 201 div 1 index 1 index 31 -1 1 { /n exch def 1 index dup mul 1 index dup mul 1 index 1 index add /d exch def sub 4 index add 3 1 roll 2 mul mul 2 index add d 4 gt {exit} if } for pop pop pop pop n 31 div setgray x y moveto .5 0 rlineto 0 .5 rlineto -.5 0 rlineto fill } for } for showpage
@duggan
Copy link
Author

duggan commented Jul 21, 2015

On OSX, you can send this to a printer on the command line with lp mandelbrot.ps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment