Animation (2) sur Pythagore

pythagore2

input geometriesyr16.mp ;


u:=1cm;

%----------------------------------- Définition du cadre
path cadre;
numeric xmin,xmax,ymin,ymax;
xmin:=-u;
xmax:=10u;
ymin:=-u;
ymax:=10u;

cadre:=(xmin,ymin)--(xmax,ymin)--(xmax,ymax)--(xmin,ymax)--cycle;

%---------------------------------- Définitions générales utilisées
%                                   sur toutes les figures
pair A,B,C,D,E,F,G,H,I;
numeric a,b;
a:=6;
b:=3;

A:=(0,0);
B:=((a+b)*u,0);
C:=((a+b)*u,(a+b)*u);
D:=(0,(a+b)*u);
E:=(a*u,0);
F:=((a+b)*u,b*u);
G:=(a*u,(a+b)*u);
H:=(0,b*u);
I:=(a*u,b*u);

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



picture fig;
path poly;

fig:=currentpicture;
currentpicture:=nullpicture;

beginfig(1)
  fill polygone(G,C,I) withcolor orange;
  draw polygone(G,C,I);

  fill polygone(F,C,I) withcolor orange;
  draw polygone(F,C,I);

  fill polygone(H,I,E) withcolor orange;
  draw polygone(H,I,E);

  fill polygone(A,H,E) withcolor orange; 
  draw polygone(A,H,E);

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

for i:=0 upto 10:
  beginfig(i+2)  
    fill polygone(F,C,I) withcolor orange;
    draw polygone(F,C,I);

    fill polygone(H,I,E) withcolor orange;
    draw polygone(H,I,E);
    
    fill polygone(A,H,E) withcolor orange; 
    draw polygone(A,H,E);

    poly := polygone(G,C,I) shifted (0.1*i*(D-G));
    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(H,I,E) withcolor orange;
    draw polygone(H,I,E);
    
    fill polygone(A,H,E) withcolor orange; 
    draw polygone(A,H,E);

    fill polygone(G,C,I) shifted (D-G) withcolor orange;
    draw polygone(G,C,I) shifted (D-G);   

    poly := polygone(F,C,I) shifted (0.1*i*(B-F));
    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(A,H,E) withcolor orange; 
    draw polygone(A,H,E);

    fill polygone(G,C,I) shifted (D-G) withcolor orange;
    draw polygone(G,C,I) shifted (D-G);

    fill polygone(F,C,I) shifted (B-F) withcolor orange;
    draw polygone(F,C,I) shifted (B-F);    

    poly := polygone(H,I,E) shifted (0.1*i*(C-I));
    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(35)
  fill polygone(G,C,I) shifted (D-G) withcolor orange;
  draw polygone(G,C,I) shifted (D-G);

  fill polygone(F,C,I) shifted (B-F) withcolor orange;
  draw polygone(F,C,I) shifted (B-F);

  fill polygone(H,I,E) shifted(C-I) withcolor orange;
  draw polygone(H,I,E) shifted(C-I);

  fill polygone(A,H,E) withcolor orange; 
  draw polygone(A,H,E);

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

end ;