Animation (1) sur Pythagore

pythagore1

input geometriesyr16.mp ;


u:=1cm;

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

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,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 I,L;
I=whatever[R,Q];
I=whatever[A,A shifted (Q-B)];

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

draw A--I dashed evenly;

picture fig;
path poly;

fig:=currentpicture;
currentpicture:=nullpicture;

beginfig(1)
  fill polygone(A,C,D) withcolor orange;
  draw polygone(A,C,D) dashed evenly;
  fill polygone(A,D,E) withcolor orange;
  draw polygone(A,D,E) dashed evenly;
  fill polygone(A,B,G) withcolor orange;
  draw polygone(A,B,G) dashed evenly;    
  fill polygone(A,F,G) withcolor orange;
  draw polygone(A,F,G) dashed evenly;
  %------------------------------- 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(A,D,E) withcolor orange;
    draw polygone(A,D,E) dashed evenly;
    fill polygone(A,B,G) withcolor orange;
    draw polygone(A,B,G) dashed evenly;    
    fill polygone(A,F,G) withcolor orange;
    draw polygone(A,F,G) dashed evenly;

    pair AA;
    AA:= A shifted ((0.1*i)*(B-A));

    poly := polygone(AA,C,D);
    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:=1 upto 10:
  beginfig(i+12)
    fill polygone(A,D,E) withcolor orange;
    draw polygone(A,D,E) dashed evenly;
    fill polygone(A,B,G) withcolor orange;
    draw polygone(A,B,G) dashed evenly;    
    fill polygone(A,F,G) withcolor orange;
    draw polygone(A,F,G) dashed evenly;

    poly := polygone(B,C,D) rotatedaround(C,-9*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;

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

    pair AA;
    AA:= A shifted ((0.1*i)*(L-A));
    poly := polygone(AA,C,R);
    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+33)
    fill polygone(A,B,G) withcolor orange;
    draw polygone(A,B,G) dashed evenly;    
    fill polygone(A,F,G) withcolor orange;
    draw polygone(A,F,G) dashed evenly;

    fill polygone(R,C,L) withcolor orange;
    draw polygone(R,C,L) dashed evenly;   


    poly := polygone(A,D,E) rotatedaround(0.5[D,A],-18*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;

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

    fill polygone(R,C,L) withcolor orange;
    draw polygone(R,C,L) dashed evenly;
    
    pair AA;
    AA:= A shifted ((0.1*i)*(B-A));

    poly := polygone(AA,C,D);
    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:=1 upto 10:
  beginfig(i+53)
    fill polygone(A,B,G) withcolor orange;
    draw polygone(A,B,G) dashed evenly;    
    fill polygone(A,F,G) withcolor orange;
    draw polygone(A,F,G) dashed evenly;

    fill polygone(R,C,L) withcolor orange;
    draw polygone(R,C,L) dashed evenly;
    
    poly := polygone(B,C,D) rotatedaround(C,-9*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;

for i:=1 upto 10:
  beginfig(i+63)
    fill polygone(A,B,G) withcolor orange;
    draw polygone(A,B,G) dashed evenly;    
    fill polygone(A,F,G) withcolor orange;
    draw polygone(A,F,G) dashed evenly;
 
    fill polygone(R,C,L) withcolor orange;
    draw polygone(R,C,L) dashed evenly;
    
    pair AA;
    AA:= A shifted ((0.1*i)*(L-A));
    poly := polygone(AA,C,R);
    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:=1 upto 10:
  beginfig(i+73)
    fill polygone(A,B,G) withcolor orange;
    draw polygone(A,B,G) dashed evenly;    
    fill polygone(A,F,G) withcolor orange;
    draw polygone(A,F,G) dashed evenly;
 
    fill polygone(R,C,L) withcolor orange;
    draw polygone(R,C,L) dashed evenly;
    

    poly := polygone(L,C,R) rotatedaround(0.5[R,L],-18*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;

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

for i:=0 upto 10:
  beginfig(i+84)   
    fill polygone(A,F,G) withcolor orange;
    draw polygone(A,F,G) dashed evenly;

    fill polygone(I,R,C,L) withcolor orange;
    draw polygone(I,R,C,L) dashed evenly;   

    pair AA;
    AA:= A shifted ((0.1*i)*(C-A));

    poly := polygone(AA,B,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:=1 upto 10:
  beginfig(i+94)
    fill polygone(A,F,G) withcolor orange;
    draw polygone(A,F,G) dashed evenly;

    fill polygone(I,R,C,L) withcolor orange;
    draw polygone(I,R,C,L) dashed evenly;  

    poly := polygone(B,C,G) rotatedaround(B,9*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;

for i:=1 upto 10:
  beginfig(i+104)
    fill polygone(A,F,G) withcolor orange;
    draw polygone(A,F,G) dashed evenly;

    fill polygone(I,R,C,L) withcolor orange;
    draw polygone(I,R,C,L) dashed evenly;  

    pair AA;
    AA:= A shifted ((0.1*i)*(L-A));
    poly := polygone(AA,B,Q);
    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+115)
    fill polygone(I,R,C,L) withcolor orange;
    draw polygone(I,R,C,L) dashed evenly;  
    fill polygone(B,Q,L) withcolor orange;
    draw polygone(B,Q,L) dashed evenly;
    
    poly := polygone(A,F,G) rotatedaround(0.5[A,G],-18*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;

for i:=1 upto 10:
  beginfig(i+125)
    fill polygone(I,R,C,L) withcolor orange;
    draw polygone(I,R,C,L) dashed evenly;  
    fill polygone(B,Q,L) withcolor orange;
    draw polygone(B,Q,L) dashed evenly;
    
    pair AA;
    AA:= A shifted ((0.1*i)*(C-A));

    poly := polygone(AA,B,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:=1 upto 10:
  beginfig(i+135)
    fill polygone(I,R,C,L) withcolor orange;
    draw polygone(I,R,C,L) dashed evenly;  
    fill polygone(B,Q,L) withcolor orange;
    draw polygone(B,Q,L) dashed evenly;
    
    poly := polygone(B,C,G) rotatedaround(B,9*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;

for i:=1 upto 10:
  beginfig(i+145)
    fill polygone(I,R,C,L) withcolor orange;
    draw polygone(I,R,C,L) dashed evenly;  
    fill polygone(B,Q,L) withcolor orange;
    draw polygone(B,Q,L) dashed evenly;
    
    pair AA;
    AA:= A shifted ((0.1*i)*(L-A));
    poly := polygone(AA,B,Q);
    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:=1 upto 10:
  beginfig(i+155)
    fill polygone(I,R,C,L) withcolor orange;
    draw polygone(I,R,C,L) dashed evenly;  
    fill polygone(B,Q,L) withcolor orange;
    draw polygone(B,Q,L) dashed evenly;
    

    poly := polygone(L,B,Q) rotatedaround(0.5[L,Q],-18*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(166)
  fill polygone(I,R,C,L) withcolor orange;
  draw polygone(I,R,C,L) dashed evenly;
  fill polygone(I,Q,B,L) withcolor orange;
  draw polygone(I,Q,B,L) dashed evenly;  
  %------------------------------- Tracé de la figure
  draw fig ;
  %------------------------------- Tracé du cadre
  draw cadre withcolor black withpen pencircle scaled 2pt; 
  clip currentpicture to cadre;
endfig;
  

end ;


Niveau supérieur : Animations sur Pythagore