Animation (5) sur Pythagore

pythagore5

input geometriesyr16.mp ;

u:=1cm;

%----------------------------------- Définition du cadre
numeric xmin,xmax,ymin,ymax;
xmin:=-4u;
xmax:=8u;
ymin:=-6u;
ymax:=7u;

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

pair A,B,C,D,E,F,G,Q,R,I,J,K,L;
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);

I:=0.5[C,B];  % milieux du grand carré
J:=0.5[B,Q];
K:=0.5[Q,R];
L:=0.5[R,C];

A:= B rotatedaround(I,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 M,N,O,P;
pair T,TT;

T:=I shifted (C-A);  % point M
TT:=J shifted (D-C);
M= whatever[I,T];
M= whatever[J,TT];

T:=J shifted (D-C);  % point N
TT:=K shifted (C-A);
N= whatever[J,T];
N= whatever[K,TT];

T:=L shifted (D-C);  % point O
TT:=K shifted (C-A);
O= whatever[L,T];
O= whatever[K,TT];

T:=L shifted (D-C);  % point P
TT:=I shifted (C-A);
P= whatever[L,T];
P= whatever[I,TT];

draw I--P;
draw J--M;
draw K--N;
draw L--O;

picture fig;
path poly;

fig:=currentpicture;
currentpicture:=nullpicture;

beginfig(1)
fill polygone(I,B,J,M) withcolor orange;
fill polygone(J,Q,K,N) withcolor orange;
fill polygone(L,O,K,R) withcolor orange;
fill polygone(M,N,O,P) withcolor orange;
fill polygone(I,P,L,C) withcolor orange;
%------------------------------- Tracé de la figure
draw fig ;
%------------------------------- Tracé du cadre
draw cadre withcolor black withpen pencircle scaled 2pt;
clip currentpicture to cadre;
endfig;

%---------------------------------- Définitions des figures
for i:=0 upto 10:
beginfig(i+2)
fill polygone(I,B,J,M) withcolor orange;
fill polygone(J,Q,K,N) withcolor orange;
fill polygone(L,O,K,R) withcolor orange;
fill polygone(M,N,O,P) withcolor orange;

poly := polygone(I,P,L,C) shifted ((0.1*i)*(B-P));
fillcolor:=blue;
transparence poly;
%------------------------------- Tracé de la figure
draw fig ;
%------------------------------- Tracé du cadre
draw cadre withcolor black withpen pencircle scaled 2pt;
clip currentpicture to cadre;
endfig;
endfor;

for i:=0 upto 10:
beginfig(i+13)
fill polygone(J,Q,K,N) withcolor orange;
fill polygone(L,O,K,R) withcolor orange;
fill polygone(M,N,O,P) withcolor orange;

fill polygone(I,P,L,C) shifted (B-P) withcolor orange;

poly := polygone(I,B,J,M) shifted ((0.1*i)*(A-M));
fillcolor:=blue;
transparence poly;
%------------------------------- Tracé de la figure
draw fig ;
%------------------------------- Tracé du cadre
draw cadre withcolor black withpen pencircle scaled 2pt;
clip currentpicture to cadre;
endfig;
endfor;

for i:=0 upto 10:
beginfig(i+24)
fill polygone(L,O,K,R) withcolor orange;
fill polygone(M,N,O,P) withcolor orange;

fill polygone(I,P,L,C) shifted (B-P) withcolor orange;
fill polygone(I,B,J,M) shifted (A-M) withcolor orange;

poly := polygone(J,Q,K,N) shifted ((0.1*i)*(F-N));
fillcolor:=blue;
transparence poly;
%------------------------------- Tracé de la figure
draw fig ;
%------------------------------- Tracé du cadre
draw cadre withcolor black withpen pencircle scaled 2pt;
clip currentpicture to cadre;
endfig;
endfor;

for i:=0 upto 10:
beginfig(i+35)
fill polygone(M,N,O,P) withcolor orange;

fill polygone(I,P,L,C) shifted (B-P) withcolor orange;
fill polygone(I,B,J,M) shifted (A-M) withcolor orange;
fill polygone(J,Q,K,N) shifted (F-N) withcolor orange;

poly := polygone(L,O,K,R) shifted ((0.1*i)*(G-O));
fillcolor:=blue;
transparence poly;
%------------------------------- Tracé de la figure
draw fig ;
%------------------------------- Tracé du cadre
draw cadre withcolor black withpen pencircle scaled 2pt;
clip currentpicture to cadre;
endfig;
endfor;

for i:=0 upto 10:
beginfig(i+46)
fill polygone(I,P,L,C) shifted (B-P) withcolor orange;
fill polygone(I,B,J,M) shifted (A-M) withcolor orange;
fill polygone(J,Q,K,N) shifted (F-N) withcolor orange;
fill polygone(L,O,K,R) shifted (G-O) withcolor orange;

poly := polygone(M,N,O,P) shifted ((0.1*i)*(E-M));
fillcolor:=blue;
transparence poly;
%------------------------------- Tracé de la figure
draw fig ;
%------------------------------- Tracé du cadre
draw cadre withcolor black withpen pencircle scaled 2pt;
clip currentpicture to cadre;
endfig;
endfor;

beginfig(57)
fill polygone(I,P,L,C) shifted (B-P) withcolor orange;
fill polygone(I,B,J,M) shifted (A-M) withcolor orange;
fill polygone(J,Q,K,N) shifted (F-N) withcolor orange;
fill polygone(L,O,K,R) shifted (G-O) withcolor orange;

fill polygone(M,N,O,P) shifted (E-M) withcolor orange;
%------------------------------- Tracé de la figure
draw fig ;
%------------------------------- Tracé du cadre
draw cadre withcolor black withpen pencircle scaled 2pt;
clip currentpicture to cadre;
endfig;

end ;