# Animation (3) sur Pythagore

pythagore3

input geometriesyr16.mp ;

u:=1cm;

numeric xmin,xmax,ymin,ymax;
xmin:=-4u;
xmax:=8u;
ymin:=-6u;
ymax:=8u;

%---------------------------------- Définitions générales utilisées
%                                   sur toutes les figures

pair A,B,C,D,E,F,G,Q,R;
numeric c;
c:=5;
ang :=110;

C:=(0,0);     % grand carré
B:=(c*u,0);
Q:=(c*u,-c*u);
R:=(0,-c*u);

draw polygone(B,Q,R,C);

A:= B rotatedaround(0.5[B,C],ang); % point A

draw polygone(A,B,C);
trace codeperp(B,A,C,5);

D:= A rotatedaround(C,90); % carré gauche
E:= C rotatedaround(D,90);

draw polygone(A,E,D,C);

F:= B rotatedaround(A,90); % carré droit
G:= A rotatedaround(F,90);

draw polygone(A,B,G,F);

pair H,I,L;

H= whatever[D,E];
H= whatever[A,A shifted(C-R)];

I= whatever[R,Q];
I= whatever[A,A shifted(C-R)];

L= whatever[C,B];
L= whatever[A,A shifted(C-R)];

draw I--H dashed evenly;
draw H--E dashed evenly;
draw H--F dashed evenly;

picture fig;
path poly;

fig:=currentpicture;
currentpicture:=nullpicture;

beginfig(1)
fill polygone(A,C,D,E) withcolor orange;
fill polygone(A,B,G,F) withcolor orange;

%------------------------------- Tracé de la figure
draw fig ;
draw cadre withcolor black withpen pencircle scaled 2pt;
endfig;

for i:=0 upto 10:
beginfig(i+2)
fill polygone(A,B,G,F) withcolor orange;

pair DD,EE;
DD:=D shifted (0.1*i*(H-E));
EE:=E shifted (0.1*i*(H-E));
poly := polygone(A,C,DD,EE);
fillcolor:=blue;
transparence poly;
%------------------------------- Tracé de la figure
draw fig ;
draw cadre withcolor black withpen pencircle scaled 2pt;
endfig;
endfor;

for i:=1 upto 10:
beginfig(i+12)
fill polygone(A,B,G,F) withcolor orange;

pair DD,EE;
DD:=D shifted (H-E);
EE:=E shifted (H-E);
poly := polygone(A,C,DD,EE) shifted (0.1*i*(R-C));
fillcolor:=blue;
transparence poly;
%------------------------------- Tracé de la figure
draw fig ;
draw cadre withcolor black withpen pencircle scaled 2pt;
endfig;
endfor;

for i:=1 upto 10:
beginfig(i+22)
fill polygone(A,B,G,F) withcolor orange;

pair K;
K:=A shifted (R-C);
pair AA,KK;
AA:=A shifted (0.1*i*(I-K));
KK:=K shifted (0.1*i*(I-K));
poly := polygone(R,C,AA,KK);
fillcolor:=blue;
transparence poly;
%------------------------------- Tracé de la figure
draw fig ;
draw cadre withcolor black withpen pencircle scaled 2pt;
endfig;
endfor;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

for i:=0 upto 10:
beginfig(i+33)
fill polygone(I,R,C,L) withcolor orange;

pair FF,GG;
FF:=F shifted (0.1*i*(H-F));
GG:=G shifted (0.1*i*(H-F));
poly := polygone(A,B,GG,FF);
fillcolor:=blue;
transparence poly;
%------------------------------- Tracé de la figure
draw fig ;
draw cadre withcolor black withpen pencircle scaled 2pt;
endfig;
endfor;

for i:=1 upto 10:
beginfig(i+43)
fill polygone(I,R,C,L) withcolor orange;

pair FF,GG;
FF:=F shifted (H-F);
GG:=G shifted (H-F);
poly := polygone(A,B,GG,FF) shifted (0.1*i*(Q-B));
fillcolor:=blue;
transparence poly;
%------------------------------- Tracé de la figure
draw fig ;
draw cadre withcolor black withpen pencircle scaled 2pt;
endfig;
endfor;

for i:=1 upto 10:
beginfig(i+53)
fill polygone(I,R,C,L) withcolor orange;

pair K;
K:=A shifted (Q-B);
pair AA,KK;
AA:=A shifted (0.1*i*(I-K));
KK:=K shifted (0.1*i*(I-K));
poly := polygone(Q,B,AA,KK);
fillcolor:=blue;
transparence poly;
%------------------------------- Tracé de la figure
draw fig ;
draw cadre withcolor black withpen pencircle scaled 2pt;
endfig;
endfor;

beginfig(64)
fill polygone(I,R,C,L) withcolor orange;
fill polygone(L,B,Q,I) withcolor orange;

%------------------------------- Tracé de la figure
draw fig ;