# Fichiers de Jean-Louis Garcin

## Illusion d'optique à base d'ellipses

ellipses.mp

beginfig(1);

path pcg, gcg, pcd,gcd,inter, trait;
numeric u,d, i,j;
pair A, B,C;

%%%%%

d=24; % prendre une valeur paire.
u=0.3cm;
picture pic;

%%%%
for i= 0 upto (d-1):

pcg:=halfcircle scaled ((2*i)*u);
gcg:= halfcircle scaled ((2*i+2)*u);

for  j= (d-i) upto (d+i-1):

pcd:=halfcircle scaled ((2*j)*u) shifted (d*u,0);
gcd:=halfcircle scaled ((2*(j+1))*u) shifted (d*u,0);

if (i+j)/2 =floor((i+j)/2):
inter:= buildcycle(gcg,gcd,pcg,pcd);
fill inter withcolor  ((i+j)/(3*d))[blue,white];
fi
endfor;
endfor;

for i=0 upto (d-2):
pcg:=halfcircle scaled ((2*i)*u);
gcg:= halfcircle scaled ((2*i+2)*u);
j:=d+i;
pcd:=halfcircle scaled ((2*j)*u) shifted (d*u,0);
gcd:=halfcircle scaled ((2*(j+1))*u) shifted (d*u,0);
trait:=((-i)*u,0)--((-(i+1))*u,0);
inter:= buildcycle(gcg,gcd,trait,pcd);
fill inter withcolor  ((2*i+d)/(3*d))[blue,white];
draw trait withcolor  ((2*i+d)/(3*d))[blue,white];
endfor;

pic:=currentpicture;
draw pic yscaled -1;
pic:=currentpicture;

draw pic rotatedaround (((d/2)*u,0),180);

endfig;
end;