Skip to content

Instantly share code, notes, and snippets.

@ljcooke
Last active August 9, 2020 09:00
Show Gist options
  • Save ljcooke/8203d642b1e3baa2ca8ba35d8c8d334e to your computer and use it in GitHub Desktop.
Save ljcooke/8203d642b1e3baa2ca8ba35d8c8d334e 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
/windistance 1 def
/project3d {
4 dict begin
/z exch def
/y exch def
/x exch def
/factor windistance z div def
x factor mul y factor mul
end
} def
/moveto3d { project3d moveto } def
/lineto3d { project3d lineto } def
/points [
0 0.5 sqrt 1.5
-1 0.5 sqrt 2.0
0 0.5 sqrt 2.5
1 0.5 sqrt 2.0
0 0.5 sqrt neg 1.5
-1 0.5 sqrt neg 2.0
0 0.5 sqrt neg 2.5
1 0.5 sqrt neg 2.0
] def
/point {
1 dict begin
/idx exch 3 mul def
points idx get
points idx 1 add get
points idx 2 add get
end
} def
/side {
4 dict begin
/i4 exch def
/i3 exch def
/i2 exch def
/i1 exch def
newpath
i1 point moveto3d
i2 point lineto3d
i3 point lineto3d
i4 point lineto3d
closepath
end
} def
5 inch dup translate
5 inch dup scale
1 256 div setlinewidth
2 setlinecap
2 setlinejoin
0 1 2 3 side stroke
4 5 6 7 side stroke
0 1 5 4 side stroke
0 3 7 4 side stroke
showpage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment