Skip to content

Instantly share code, notes, and snippets.

@ljcooke
Created August 9, 2020 12:15
Show Gist options
  • Save ljcooke/ddc41ea1019a7ec51b44cb9f6bfa5fd3 to your computer and use it in GitHub Desktop.
Save ljcooke/ddc41ea1019a7ec51b44cb9f6bfa5fd3 to your computer and use it in GitHub Desktop.
%!PS-Adobe-3.0 EPSF-3.0
%%Pages: 1
%%BoundingBox: 0 0 720 720
%%EndComments
/inch { 72 mul } def
/invertgray { 1 currentgray sub setgray } def
/makepoints { % nsides
4 dict begin
/n exch def
/array n 2 mul array def
0 1 n 1 sub {
/idx exch def
/angle idx 360 mul n div def
array idx 2 mul angle cos put
array idx 2 mul 1 add angle sin put
} for
array
end
} def
/nsides 50 def
/points nsides makepoints def
/point { % index
1 dict begin
/idx exch 2 mul def
points idx get
points idx 1 add get
end
} def
5 inch dup translate
4 inch dup scale
90 rotate
1 512 div setlinewidth
1 16 div setgray
newpath
2 2 moveto -2 2 lineto -2 -2 lineto 2 -2 lineto
closepath fill
invertgray
newpath
0 point moveto
1 1 nsides 1 sub { point lineto } for
closepath
fill
invertgray
1 1 128 div sub dup scale
2 dict begin
0 1 nsides 1 sub {
/i exch def
0 1 nsides 1 sub {
/j exch def
i j ne {
newpath
i point moveto
j point lineto
stroke
} if
} for
} for
end
showpage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment