% E = virtual eye, L = virtual light are global variables % a polyhedron = an array of faces % a face = [ array of vertices + normal function ] /polyhedron-draw { 1 dict begin { aload pop /n exch def /p exch def E n dot-product 0 ge { /ell p length def newpath p ell 1 sub get aload pop moveto3d p { aload pop lineto3d } forall closepath gsave L n dot-product shading shade 0 0 setrgbcolor fill grestore stroke } if } forall end } def