Skip to content

Instantly share code, notes, and snippets.

@NoraCodes
Created October 10, 2023 02:43
Show Gist options
  • Save NoraCodes/16a1073b5f1c1aeca504b4c19c369a38 to your computer and use it in GitHub Desktop.
Save NoraCodes/16a1073b5f1c1aeca504b4c19c369a38 to your computer and use it in GitHub Desktop.
Draw overlapping circles in PostScript
%!PS
/inch {72 mul} def
/pagewidth { currentpagedevice /PageSize get 0 get } def
/pageheight { currentpagedevice /PageSize get 1 get } def
/cSp { 0.66 inch } def
/cRp { 6 } def
cRp {
cRp {
newpath
pagewidth 2 div cSp cRp 2 div mul sub % find the center position in x
pageheight 2 div cSp cRp 2 div mul sub % find the center position in y
1 inch 0 360 arc stroke % draw a circle
0 cSp translate % move to the next circle
} repeat % draw circles vertically
cSp 0 cSp sub cRp mul translate % reset the vertical position
} repeat % draw circles horizontally
showpage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment