Source
``````%% D'apres une idee et un code original de Maxime Chupin

usecolor
-6 6 setxrange
-5 3 setyrange
30 setxunit

0 5 3 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
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% 1 2 {8} newtore
%% [0 1 0 -1] solideqplansepare
%%
%% %% maintenant les 2 parties sont sur la pile
%% dup videsolid
%% dup (jaune) (rouge) inoutputcolors
%% /tore1 exch def
%%
%% dup videsolid
%% dup (jaune) (rouge) inoutputcolors
%% /tore2 exch def
%%
%% %% on sauvegarde
%% tore1 (tore1) writesolidfile
%% tore2 (tore2) writesolidfile

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 2eme compilation et suivantes : on charge les donnees du tore
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%
%% %on trace
%% solidfuz
tore1
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``````