%% D'apres une idee et un code original de Maxime Chupin usecolor -6 6 setxrange -5 3 setyrange 30 setxunit /ScreenDist .05 def -10 10 6 SetCamPos 0 0 0 SetCamView 2 setlinejoin /a 2.85 def /g { 3 dict begin /t exch def #rpn# a*Sin(t)/(1+(Cos(t))^2) 1 #rpn# a*Sin(t)*Cos(t)/(1+(Cos(t))^2) end } def %% /g' { % derivee premiere %% 3 dict begin %% /t exch def %% #rpn# (4*Cos(t)*Sin(t)^2)/(Cos(t)^2+1)^2+(2*Cos(t))/(Cos(t)^2+1) %% #rpn# (2*Sin(t)^2)/(Cos(t)^2+1)+(4*Cos(t)^2*Sin(t)^2)/(Cos(t)^2+1)^2+(2*Cos(t)^2)/(Cos(t)^2+1) %% 0 %% end %% } def %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% 1ere compilation : on calcule les 2 parties du tore %% %% sectionne, puis on sauvegarde %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% 3 5 [36 36] newtore %% [1 0 -4 3 div 0] solideqplansepare %% %% %% maintenant les 2 parties sont sur la pile %% dup videsolid %% dup (jaune) (rouge) inoutputcolors %% /villarceau1 exch def %% %% dup videsolid %% dup (jaune) (rouge) inoutputcolors %% /villarceau2 exch def %% %% %% on sauvegarde %% villarceau1 (villarceau1) writesolidfile %% villarceau2 (villarceau2) writesolidfile %% villarceau2 drawsolid** %% stop %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 2eme compilation et suivantes : on charge les donnees du tore %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /villarceau1 (villarceau1) readsolidfile def /villarceau2 (villarceau2) readsolidfile def .1 setlinewidth gris %% %% %on trace %% solidfuz villarceau2 drawsolid** %% villarceau2 %% {0 2 0 addv3d} solidtransform %% drawsolid** %le lemniscate % t_min t_max rayon_tube [resolution] %% -0 6.28 (g) .1 [100 10] newtube %% dup [.5 .6] solidputhuecolors %% %% plutôt qu'un tube, on utilise un simple trait %% bleu %% 2 setlinewidth %% 0 6.28 {g} CourbeR3 %% %% pour visualiser les axes %% -2 1 2 axesRVB [1 0 -4 3 div 0] eq2plan dup [-6 6 -9 9] planputrange dup [.5 dup] planputngrid newplan dup (.3 setfillopacity AntiqueWhite) solidputcolors dup videsolid drawsolid** bleu 2 setlinewidth newpath 0 0 5 cercle_ 0 3 0 [1 0 -4 3 div] false projpath stroke 0 0 5 cercle_ 0 -3 0 [1 0 -4 3 div] false projpath stroke