Page complète Niveau supérieur

Fichiers de Jean-Louis Garcin

Intersection de paraboles

paraboles.mp
%@AUTEUR: Jean-Louis Garcin
%@DATE: 26 juin 2010
 
paraboles (figure 1)
beginfig(1); 
 
 path pc,gc, traitb,traith,inter,trait,traitv;
 numeric u,d, r,h;
 picture pic;
 %%%%% 
 
 d=35;
 u=0.3cm;
 
 %%%%
 for r= 0 upto (d-1):
   pc := halfcircle scaled ((2*r)*u) rotated (-90);
   gc := halfcircle scaled ((2*r+2)*u) rotated (-90);
 
   for  h= 0 upto (r-1):
     traitb := (0,h*u)-- (d*u,h*u);
     traith := (0,(h+1)*u)--(d*u,(h+1)*u);
     if  ((r+h)/2) >floor((r+h)/2):
       inter:= buildcycle(traitb,pc,traith,gc);
       draw inter withcolor  ((r+h)/(2.2*d))[black,white];
       fill inter withcolor  ((r+h)/(2.2*d))[black,white];
     fi
   endfor;
 endfor;
 
 for r = (-3) downto (- d):
   pc := halfcircle scaled (2*(abs(r+1))*u)   rotated (-90);
   gc :=  halfcircle scaled (2*(abs(r))*u   )   rotated (-90);
   for  h= -1 downto  r+1 :
     traitb := (0,h*u)-- (d*u,h*u);
     traith := (0,(h+1)*u)--(d*u,(h+1)*u);
     if  ((r+h)/2) =floor((r+h)/2):
       inter:= buildcycle(traitb,gc,traith,pc);
       draw inter withcolor ((-r-h)/(2.2*d))[black,white];
       fill inter withcolor  ((-r-h)/(2.2*d))[black,white];
     fi
   endfor;
 endfor;
 
 for r=  1 upto d:
   gc :=  halfcircle scaled (2*r*u)   rotated (-90);
   trait:= (0,(1-r)*u)-- (d*u,(1-r)*u);
   traitv:=(0,(1-r)*u)--(0,-(r*u));
   inter:=buildcycle(traitv,trait,gc);
   fill inter withcolor  ((2*r)/(2.2*d))[black,white];
   draw inter withcolor  ((2*r)/(2.2*d))[black,white];
 endfor;
 
 pic:=currentpicture;
 
 draw pic xscaled (-1);
endfig;
end;