Animation (4) sur Pythagore

pythagore4

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 M,N,J;
pair T,TT;


M= whatever[B,Q];
M= whatever[G,F];

N= whatever[E,A];
N= whatever[C,R];

J= whatever[A,F];
J= whatever[M,M shifted (B-C)];


draw C--N dashed evenly;
draw B--M dashed evenly;
draw J--M dashed evenly;

picture fig;
path poly;

fig:=currentpicture;
currentpicture:=nullpicture;

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

    poly := polygone(A,J,M,B) 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:=0 upto 10:
  beginfig(i+13)
    fill polygone(F,M,J) withcolor orange;
    fill polygone(A,N,C) withcolor orange;
    fill polygone(N,C,D,E) withcolor orange;

    fill polygone(A,J,M,B) rotatedaround(C,-90) withcolor orange;
    draw polygone(A,J,M,B) rotatedaround(C,-90) dashed evenly;

    poly := polygone(M,G,B) shifted ((0.1*i)*(R-B));
    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,N,C) withcolor orange;
    fill polygone(N,C,D,E) withcolor orange;

    fill polygone(A,J,M,B) rotatedaround(C,-90) withcolor orange;
    draw polygone(A,J,M,B) rotatedaround(C,-90) dashed evenly;
    fill polygone(M,G,B) shifted (R-B) withcolor orange;
    draw polygone(M,G,B) shifted (R-B) dashed evenly;

    poly := polygone(F,M,J) rotatedaround(0.5[C,M],-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+35)
    fill polygone(N,C,D,E) withcolor orange;

    fill polygone(A,J,M,B) rotatedaround(C,-90) withcolor orange;
    draw polygone(A,J,M,B) rotatedaround(C,-90) dashed evenly;
    fill polygone(M,G,B) shifted (R-B) withcolor orange;
    draw polygone(M,G,B) shifted (R-B) dashed evenly;
    fill polygone(F,M,J) rotatedaround(0.5[C,M],-180) withcolor orange;
    draw polygone(F,M,J) rotatedaround(0.5[C,M],-180) dashed evenly;

    poly := polygone(A,N,C) rotatedaround(0.5[C,B],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+46)
    fill polygone(A,J,M,B) rotatedaround(C,-90) withcolor orange;
    draw polygone(A,J,M,B) rotatedaround(C,-90) dashed evenly;    
    fill polygone(M,G,B) shifted (R-B) withcolor orange;
    draw polygone(M,G,B) shifted (R-B) dashed evenly;    
    fill polygone(F,M,J) rotatedaround(0.5[C,M],-180) withcolor orange;
    draw polygone(F,M,J) rotatedaround(0.5[C,M],-180) dashed evenly;    
    fill polygone(A,N,C) rotatedaround(0.5[C,B],180) withcolor orange;
    draw polygone(A,N,C) rotatedaround(0.5[C,B],180) dashed evenly;

    pair I,K;
    I:=0.5[C,B];
    K:=B rotatedaround(I,90);

    poly := polygone(N,C,D,E) rotatedaround(K,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;

beginfig(57)
  fill polygone(A,J,M,B) rotatedaround(C,-90) withcolor orange;
  draw polygone(A,J,M,B) rotatedaround(C,-90) dashed evenly;    
  fill polygone(M,G,B) shifted (R-B) withcolor orange;
  draw polygone(M,G,B) shifted (R-B) dashed evenly;    
  fill polygone(F,M,J) rotatedaround(0.5[C,M],-180) withcolor orange;
  draw polygone(F,M,J) rotatedaround(0.5[C,M],-180) dashed evenly;    
  fill polygone(A,N,C) rotatedaround(0.5[C,B],180) withcolor orange;
  draw polygone(A,N,C) rotatedaround(0.5[C,B],180) dashed evenly;

  pair I,K;
  I:=0.5[C,B];
  K:=B rotatedaround(I,90);
  
  fill polygone(N,C,D,E)  rotatedaround(K,90) withcolor orange;
  draw polygone(N,C,D,E)  rotatedaround(K,90) 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 ;