%!PS-Adobe-2.0 %%BoundingBox: 0 0 372 180 /w 372 def /h 180 def (ps3d.inc) run (epsetup.inc) run (cube.inc) run % ------------------------------------------------ [0 0 6 1] set-eye 0 0 -4 translate3d /floor [0 1 0 2] def /wd 3 def /dp 3 def /fl floor 3 get neg def /grid { wd neg 1 wd { /i exch def i fl dp neg moveto3d i fl dp lineto3d } for dp neg 1 dp { /i exch def wd neg fl i moveto3d wd fl i lineto3d } for stroke } def page-begin 0 0.5 translate gsave 0.8 0.8 0.8 setrgbcolor newpath grid grestore gsave3d % the shadow gsave 0.6 0.6 0.6 setrgbcolor floor light-source plane-project [1 1 1] A rotate3d -0.5 -0.5 -0.5 translate3d cube { % [ [P[0] P[1] ... P[n-1]] n ] 0 get /f exch def /ell f length def newpath f ell 1 sub get aload pop moveto3d f { aload pop lineto3d } forall fill } forall grestore grestore3d gsave3d [1 1 1] A rotate3d -0.5 -0.5 -0.5 translate3d /E get-virtual-eye def /L get-virtual-light def cube { % [ [P[0] P[1] ... P[n-1]] n ] dup 0 get /f exch def 1 get /n exch def % n = normal function /ell f length def n E dot-product 0 ge { newpath f ell 1 sub get aload pop moveto3d f { aload pop lineto3d } forall gsave n L dot-product [0.30 0.30 0.80 1] shade 0 0 setrgbcolor fill grestore stroke } if } forall grestore3d page-end