/TourDict 100 dict def TourDict begin /MaillageTour {% hyperboloïde R dr neg r0 {% /rr ED /z1 a rr r sub div def /Zpoint z1 def 0 dT 360 { /Theta ED % M1 /x1 rr Theta cos mul def /y1 rr Theta sin mul def /Xpoint x1 def /Ypoint y1 def PointsApresTransformations /Z1 ED /Y1 ED /X1 ED % M2 /x2 rr dr add Theta cos mul def /y2 rr dr add Theta sin mul def /z2 a rr dr add r sub div def /Xpoint x2 def /Ypoint y2 def /Zpoint z2 def PointsApresTransformations /Z2 ED /Y2 ED /X2 ED % M3 /x3 rr dr add Theta dT add cos mul def /y3 rr dr add Theta dT add sin mul def /z3 z2 def /Xpoint x3 def /Ypoint y3 def /Zpoint z3 def PointsApresTransformations /Z3 ED /Y3 ED /X3 ED % M4 /x4 rr Theta dT add cos mul def /y4 rr Theta dT add sin mul def /z4 z1 def /Xpoint x4 def /Ypoint y4 def /Zpoint z4 def PointsApresTransformations /Z4 ED /Y4 ED /X4 ED %% centre de la face /xF {X1 X2 add X3 add X4 add 4 div} bind def /yF {Y1 Y2 Y3 Y4 add add add 4 div} bind def /zF {Z1 Z2 Z3 Z4 add add add 4 div} bind def %% vecteur : centre de la face -> point de vue /xV {XpointVue xF sub } bind def /yV {YpointVue yF sub } bind def /zV {ZpointVue zF sub } bind def %% distance % /D {xV dup mul yV dup mul add zV dup mul add sqrt} bind def %% normale % les vecteurs de la face /V1x X2 X1 sub def /V1y Y2 Y1 sub def /V1z Z2 Z1 sub def /V2x X3 X2 sub def /V2y Y3 Y2 sub def /V2z Z3 Z2 sub def % le produit vectoriel /xN V1y V2z mul V1z V2y mul sub def /yN V1x V2z mul V1z V2x mul sub neg def /zN V1x V2y mul V1y V2x mul sub def % le produit scalaire des 2 vecteurs /PSfacette xV xN mul yV yN mul add zV zN mul add def % vecteur centre de la facette vers la source de lumière /VxLight xLight xF sub def /VyLight yLight yF sub def /VzLight zLight zF sub def % norme /normeL VxLight dup mul VyLight dup mul VzLight dup mul add add sqrt def % produit scalaire /PSLight VxLight xN mul VyLight yN mul add VzLight zN mul add def /normeN xN dup mul yN dup mul zN dup mul add add sqrt def /CosCouleur PSLight normeL normeN mul div ChangeSigne def condition { /facette{ newpath X1 Y1 Z1 3dto2d moveto X2 Y2 Z2 3dto2d lineto X3 Y3 Z3 3dto2d lineto X4 Y4 Z4 3dto2d lineto closepath } def facette H_S CosCouleur sethsbcolor fill toDraw} if } for } for } def /Haut { /Zpoint H def /TableauxPoints [ 0 1 359 {% on décrit le cercle /theta exch def [ /Xpoint r0 theta cos mul def /Ypoint r0 theta sin mul def PointsApresTransformations 3dto2d ] } for ] def TableauxPoints 0 get aload pop moveto 0 1 359 { /compteur exch def TableauxPoints compteur get aload pop lineto } for } def end