Animation (6) sur Pythagore

pythagore6

input geometriesyr16.mp ;
input dlf_tex.mp;

u:=1cm;

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

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,H;
numeric c;
c:=5;
ang :=70;

B:=(0,0);     
C:=(c*u,0);
A:= C rotatedaround(0.5[B,C],ang);
(H-A) rotated 90=whatever[B,C];
H=whatever[B,C];

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

pair TB,TC,TU;

TB:=(-2u,-5u);
TC:=(0u,-5u);
TU:=(4u,-5u);


picture fig;
path poly;

fig:=currentpicture;
currentpicture:=nullpicture;

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

    poly := polygone(A,B,H) rotatedaround(B,(0.1*i)*(180-ang/2));
    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,C,H) withcolor orange;
    draw polygone(A,C,H) dashed evenly;    
    fill polygone(A,B,H) withcolor orange;
    draw polygone(A,B,H) dashed evenly;

    poly := polygone(A,B,H) rotatedaround(B,(180-ang/2)) shifted ((0.1*i)*(TB-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+23)
    fill polygone(A,C,H) withcolor orange;
    draw polygone(A,C,H) dashed evenly;    
    fill polygone(A,B,H) withcolor orange;
    draw polygone(A,B,H) dashed evenly;

    fill polygone(A,B,H) rotatedaround(B,(180-ang/2)) shifted (TB-B) withcolor orange;
    draw polygone(A,B,H) rotatedaround(B,(180-ang/2))shifted (TB-B);

    poly := polygone(A,C,H) rotatedaround(C,(0.1*i)*(-90-ang/2));
    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+33)
    fill polygone(A,C,H) withcolor orange;
    draw polygone(A,C,H) dashed evenly;    
    fill polygone(A,B,H) withcolor orange;
    draw polygone(A,B,H) dashed evenly;

    fill polygone(A,B,H) rotatedaround(B,(180-ang/2)) shifted (TB-B) withcolor orange;
    draw polygone(A,B,H) rotatedaround(B,(180-ang/2))shifted (TB-B);

    poly := polygone(A,C,H) rotatedaround(C,(-90-ang/2)) shifted ((0.1*i)*(TC-C));
    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+44)
    fill polygone(A,C,H) withcolor orange;
    draw polygone(A,C,H) dashed evenly;    
    fill polygone(A,B,H) withcolor orange;
    draw polygone(A,B,H) dashed evenly;

    fill polygone(A,B,H) rotatedaround(B,(180-ang/2)) shifted (TB-B) withcolor orange;
    draw polygone(A,B,H) rotatedaround(B,(180-ang/2))shifted (TB-B);

    fill polygone(A,C,H) rotatedaround(C,(-90-ang/2)) shifted (TC-C) withcolor orange;
    draw polygone(A,C,H) rotatedaround(C,(-90-ang/2))shifted (TC-C);    

    poly := polygone(A,B,C) xscaled (1-0.06*i) yscaled (1-0.06*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+54)
    fill polygone(A,C,H) withcolor orange;
    draw polygone(A,C,H) dashed evenly;    
    fill polygone(A,B,H) withcolor orange;
    draw polygone(A,B,H) dashed evenly;

    fill polygone(A,B,H) rotatedaround(B,(180-ang/2)) shifted (TB-B) withcolor orange;
    draw polygone(A,B,H) rotatedaround(B,(180-ang/2))shifted (TB-B);

    fill polygone(A,C,H) rotatedaround(C,(-90-ang/2)) shifted (TC-C) withcolor orange;
    draw polygone(A,C,H) rotatedaround(C,(-90-ang/2))shifted (TC-C);    

    poly := polygone(A,B,C) xscaled (0.4) yscaled (0.4) shifted ((0.1*i)*(TU-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;

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

beginfig(65)
  fill polygone(A,C,H) withcolor orange;
  draw polygone(A,C,H) dashed evenly;    
  fill polygone(A,B,H) withcolor orange;
  draw polygone(A,B,H) dashed evenly;

  fill polygone(A,B,H) rotatedaround(B,(180-ang/2)) shifted (TB-B) withcolor orange;
  draw polygone(A,B,H) rotatedaround(B,(180-ang/2))shifted (TB-B);

  fill polygone(A,C,H) rotatedaround(C,(-90-ang/2)) shifted (TC-C) withcolor orange;
  draw polygone(A,C,H) rotatedaround(C,(-90-ang/2))shifted (TC-C);    

  fill polygone(A,B,C) xscaled (0.4) yscaled (0.4) shifted (TU-B) withcolor green;
  draw polygone(A,B,C) xscaled (0.4) yscaled (0.4) shifted (TU-B);

  label.bot(btex $c$ etex,0.5[B,C]);
  label.ulft(btex $a$ etex,0.5[B,A]);
  label.urt(btex $b$ etex,0.5[A,C]);

  label.bot(btex $1$ etex,0.5[B,C] xscaled (0.4) yscaled (0.4) shifted (TU-B));
  %------------------------------- Tracé de la figure
  draw fig ;
  %------------------------------- Tracé du cadre
  draw cadre withcolor black withpen pencircle scaled 2pt;    
  clip currentpicture to cadre;
endfig;

beginfig(66)
  fill polygone(A,C,H) withcolor orange;
  draw polygone(A,C,H) dashed evenly;    
  fill polygone(A,B,H) withcolor orange;
  draw polygone(A,B,H) dashed evenly;

  fill polygone(A,B,H) rotatedaround(B,(180-ang/2)) shifted (TB-B) withcolor orange;
  draw polygone(A,B,H) rotatedaround(B,(180-ang/2))shifted (TB-B);

  fill polygone(A,C,H) rotatedaround(C,(-90-ang/2)) shifted (TC-C) withcolor orange;
  draw polygone(A,C,H) rotatedaround(C,(-90-ang/2))shifted (TC-C);    

  fill polygone(A,B,C) xscaled (0.4) yscaled (0.4) shifted (TU-B) withcolor green;
  draw polygone(A,B,C) xscaled (0.4) yscaled (0.4) shifted (TU-B);

  label.bot(btex $c$ etex,0.5[B,C]);
  label.ulft(btex $a$ etex,0.5[B,A]);
  label.urt(btex $b$ etex,0.5[A,C]);

  label.bot(btex $1$ etex,0.5[B,C] xscaled (0.4) yscaled (0.4) shifted (TU-B));
  label.bot(btex $b$ etex,0.5[A,C] rotatedaround(C,(-90-ang/2))shifted (TC-C));
  %------------------------------- Tracé de la figure
  draw fig ;
  %------------------------------- Tracé du cadre
  draw cadre withcolor black withpen pencircle scaled 2pt;    
  clip currentpicture to cadre;
endfig;

beginfig(67)
  fill polygone(A,C,H) withcolor orange;
  draw polygone(A,C,H) dashed evenly;    
  fill polygone(A,B,H) withcolor orange;
  draw polygone(A,B,H) dashed evenly;

  fill polygone(A,B,H) rotatedaround(B,(180-ang/2)) shifted (TB-B) withcolor orange;
  draw polygone(A,B,H) rotatedaround(B,(180-ang/2))shifted (TB-B);

  fill polygone(A,C,H) rotatedaround(C,(-90-ang/2)) shifted (TC-C) withcolor orange;
  draw polygone(A,C,H) rotatedaround(C,(-90-ang/2))shifted (TC-C);    

  fill polygone(A,B,C) xscaled (0.4) yscaled (0.4) shifted (TU-B) withcolor green;
  draw polygone(A,B,C) xscaled (0.4) yscaled (0.4) shifted (TU-B);

  label.bot(btex $c$ etex,0.5[B,C]);
  label.ulft(btex $a$ etex,0.5[B,A]);
  label.urt(btex $b$ etex,0.5[A,C]);
  
  label.bot(btex $1$ etex,0.5[B,C] xscaled (0.4) yscaled (0.4) shifted (TU-B));
  label.bot(btex $b$ etex,0.5[A,C] rotatedaround(C,(-90-ang/2))shifted (TC-C));
  label.bot(btex $a$ etex,0.5[A,B] rotatedaround(B,(180-ang/2))shifted (TB-B));
  %------------------------------- Tracé de la figure
  draw fig ;
  %------------------------------- Tracé du cadre
  draw cadre withcolor black withpen pencircle scaled 2pt;    
  clip currentpicture to cadre;
endfig;


beginfig(68)
  fill polygone(A,C,H) withcolor orange;
  draw polygone(A,C,H) dashed evenly;    
  fill polygone(A,B,H) withcolor orange;
  draw polygone(A,B,H) dashed evenly;

  fill polygone(A,B,H) rotatedaround(B,(180-ang/2)) shifted (TB-B) withcolor orange;
  draw polygone(A,B,H) rotatedaround(B,(180-ang/2))shifted (TB-B);

  fill polygone(A,C,H) rotatedaround(C,(-90-ang/2)) shifted (TC-C) withcolor orange;
  draw polygone(A,C,H) rotatedaround(C,(-90-ang/2))shifted (TC-C);    

  fill polygone(A,B,C) xscaled (0.4) yscaled (0.4) shifted (TU-B) withcolor green;
  draw polygone(A,B,C) xscaled (0.4) yscaled (0.4) shifted (TU-B);

  label.bot(btex $c$ etex,0.5[B,C]);
  label.ulft(btex $a$ etex,0.5[B,A]);
  label.urt(btex $b$ etex,0.5[A,C]);
  
  label.bot(btex $1$ etex,0.5[B,C] xscaled (0.4) yscaled (0.4) shifted (TU-B));
  label.bot(btex $b$ etex,0.5[A,C] rotatedaround(C,(-90-ang/2))shifted (TC-C));
  label.bot(btex $a$ etex,0.5[A,B] rotatedaround(B,(180-ang/2))shifted (TB-B));

  label.top(TEX("$S$"),0.5[B,C] xscaled (0.4) yscaled (0.4) shifted (TU-B)); 
  %------------------------------- Tracé de la figure
  draw fig ;
  %------------------------------- Tracé du cadre
  draw cadre withcolor black withpen pencircle scaled 2pt;    
  clip currentpicture to cadre;
endfig;

beginfig(69)
  fill polygone(A,C,H) withcolor orange;
  draw polygone(A,C,H) dashed evenly;    
  fill polygone(A,B,H) withcolor orange;
  draw polygone(A,B,H) dashed evenly;

  fill polygone(A,B,H) rotatedaround(B,(180-ang/2)) shifted (TB-B) withcolor orange;
  draw polygone(A,B,H) rotatedaround(B,(180-ang/2))shifted (TB-B);

  fill polygone(A,C,H) rotatedaround(C,(-90-ang/2)) shifted (TC-C) withcolor orange;
  draw polygone(A,C,H) rotatedaround(C,(-90-ang/2))shifted (TC-C);    

  fill polygone(A,B,C) xscaled (0.4) yscaled (0.4) shifted (TU-B) withcolor green;
  draw polygone(A,B,C) xscaled (0.4) yscaled (0.4) shifted (TU-B);

  label.bot(btex $c$ etex,0.5[B,C]);
  label.ulft(btex $a$ etex,0.5[B,A]);
  label.urt(btex $b$ etex,0.5[A,C]);
  
  label.bot(btex $1$ etex,0.5[B,C] xscaled (0.4) yscaled (0.4) shifted (TU-B));
  label.bot(btex $b$ etex,0.5[A,C] rotatedaround(C,(-90-ang/2))shifted (TC-C));
  label.bot(btex $a$ etex,0.5[A,B] rotatedaround(B,(180-ang/2))shifted (TB-B));

  label.top(TEX("$S$"),0.5[B,C] xscaled (0.4) yscaled (0.4) shifted (TU-B));
  label.top(TEX("$S \times b^2$"),0.5[A,C] rotatedaround(C,(-90-ang/2))shifted (TC-C));  
  %------------------------------- Tracé de la figure
  draw fig ;
  %------------------------------- Tracé du cadre
  draw cadre withcolor black withpen pencircle scaled 2pt;    
  clip currentpicture to cadre;
endfig;


beginfig(70)
  fill polygone(A,C,H) withcolor orange;
  draw polygone(A,C,H) dashed evenly;    
  fill polygone(A,B,H) withcolor orange;
  draw polygone(A,B,H) dashed evenly;

  fill polygone(A,B,H) rotatedaround(B,(180-ang/2)) shifted (TB-B) withcolor orange;
  draw polygone(A,B,H) rotatedaround(B,(180-ang/2))shifted (TB-B);

  fill polygone(A,C,H) rotatedaround(C,(-90-ang/2)) shifted (TC-C) withcolor orange;
  draw polygone(A,C,H) rotatedaround(C,(-90-ang/2))shifted (TC-C);    

  fill polygone(A,B,C) xscaled (0.4) yscaled (0.4) shifted (TU-B) withcolor green;
  draw polygone(A,B,C) xscaled (0.4) yscaled (0.4) shifted (TU-B);

  label.bot(btex $c$ etex,0.5[B,C]);
  label.ulft(btex $a$ etex,0.5[B,A]);
  label.urt(btex $b$ etex,0.5[A,C]);
  
  label.bot(btex $1$ etex,0.5[B,C] xscaled (0.4) yscaled (0.4) shifted (TU-B));
  label.bot(btex $b$ etex,0.5[A,C] rotatedaround(C,(-90-ang/2))shifted (TC-C));
  label.bot(btex $a$ etex,0.5[A,B] rotatedaround(B,(180-ang/2))shifted (TB-B));

  label.top(TEX("$S$"),0.5[B,C] xscaled (0.4) yscaled (0.4) shifted (TU-B));
  label.top(TEX("$S \times b^2$"),0.5[A,C] rotatedaround(C,(-90-ang/2))shifted (TC-C));
  label.top(TEX("$S \times a^2$"),0.5[A,B] rotatedaround(B,(180-ang/2))shifted (TB-B));  
  %------------------------------- Tracé de la figure
  draw fig ;
  %------------------------------- Tracé du cadre
  draw cadre withcolor black withpen pencircle scaled 2pt;    
  clip currentpicture to cadre;
endfig;


beginfig(71)
  fill polygone(A,C,H) withcolor orange;
  draw polygone(A,C,H) dashed evenly;    
  fill polygone(A,B,H) withcolor orange;
  draw polygone(A,B,H) dashed evenly;

  fill polygone(A,B,H) rotatedaround(B,(180-ang/2)) shifted (TB-B) withcolor orange;
  draw polygone(A,B,H) rotatedaround(B,(180-ang/2))shifted (TB-B);

  fill polygone(A,C,H) rotatedaround(C,(-90-ang/2)) shifted (TC-C) withcolor orange;
  draw polygone(A,C,H) rotatedaround(C,(-90-ang/2))shifted (TC-C);    

  fill polygone(A,B,C) xscaled (0.4) yscaled (0.4) shifted (TU-B) withcolor green;
  draw polygone(A,B,C) xscaled (0.4) yscaled (0.4) shifted (TU-B);

  label.bot(btex $c$ etex,0.5[B,C]);
  label.ulft(btex $a$ etex,0.5[B,A]);
  label.urt(btex $b$ etex,0.5[A,C]);
  
  label.bot(btex $1$ etex,0.5[B,C] xscaled (0.4) yscaled (0.4) shifted (TU-B));
  label.bot(btex $b$ etex,0.5[A,C] rotatedaround(C,(-90-ang/2))shifted (TC-C));
  label.bot(btex $a$ etex,0.5[A,B] rotatedaround(B,(180-ang/2))shifted (TB-B));

  label.top(TEX("$S$"),0.5[B,C] xscaled (0.4) yscaled (0.4) shifted (TU-B));
  label.top(TEX("$S \times b^2$"),0.5[A,C] rotatedaround(C,(-90-ang/2))shifted (TC-C));
  label.top(TEX("$S \times a^2$"),0.5[A,B] rotatedaround(B,(180-ang/2))shifted (TB-B));

  label.top(TEX("$S \times c^2$"),0.5[C,B]);
  %------------------------------- Tracé de la figure
  draw fig ;
  %------------------------------- Tracé du cadre
  draw cadre withcolor black withpen pencircle scaled 2pt;    
  clip currentpicture to cadre;
endfig;

beginfig(72)
  fill polygone(A,C,H) withcolor orange;
  draw polygone(A,C,H) dashed evenly;    
  fill polygone(A,B,H) withcolor orange;
  draw polygone(A,B,H) dashed evenly;

  fill polygone(A,B,H) rotatedaround(B,(180-ang/2)) shifted (TB-B) withcolor orange;
  draw polygone(A,B,H) rotatedaround(B,(180-ang/2))shifted (TB-B);

  fill polygone(A,C,H) rotatedaround(C,(-90-ang/2)) shifted (TC-C) withcolor orange;
  draw polygone(A,C,H) rotatedaround(C,(-90-ang/2))shifted (TC-C);    

  fill polygone(A,B,C) xscaled (0.4) yscaled (0.4) shifted (TU-B) withcolor green;
  draw polygone(A,B,C) xscaled (0.4) yscaled (0.4) shifted (TU-B);

  label.bot(btex $c$ etex,0.5[B,C]);
  label.ulft(btex $a$ etex,0.5[B,A]);
  label.urt(btex $b$ etex,0.5[A,C]);
  
  label.bot(btex $1$ etex,0.5[B,C] xscaled (0.4) yscaled (0.4) shifted (TU-B));
  label.bot(btex $b$ etex,0.5[A,C] rotatedaround(C,(-90-ang/2))shifted (TC-C));
  label.bot(btex $a$ etex,0.5[A,B] rotatedaround(B,(180-ang/2))shifted (TB-B));

  label.top(TEX("$S$"),0.5[B,C] xscaled (0.4) yscaled (0.4) shifted (TU-B));
  label.top(TEX("$S \times b^2$"),0.5[A,C] rotatedaround(C,(-90-ang/2))shifted (TC-C));
  label.top(TEX("$S \times a^2$"),0.5[A,B] rotatedaround(B,(180-ang/2))shifted (TB-B));

  label.top(TEX("$S \times c^2$"),0.5[C,B]);

  label(TEX("$S \times c^2 =S \times a^2+ S \times b^2$"),0.5[B,C] shifted ((0,-u)));  
  %------------------------------- Tracé de la figure
  draw fig ;
  %------------------------------- Tracé du cadre
  draw cadre withcolor black withpen pencircle scaled 2pt;    
  clip currentpicture to cadre;
endfig;

beginfig(73)
  fill polygone(A,C,H) withcolor orange;
  draw polygone(A,C,H) dashed evenly;    
  fill polygone(A,B,H) withcolor orange;
  draw polygone(A,B,H) dashed evenly;

  fill polygone(A,B,H) rotatedaround(B,(180-ang/2)) shifted (TB-B) withcolor orange;
  draw polygone(A,B,H) rotatedaround(B,(180-ang/2))shifted (TB-B);

  fill polygone(A,C,H) rotatedaround(C,(-90-ang/2)) shifted (TC-C) withcolor orange;
  draw polygone(A,C,H) rotatedaround(C,(-90-ang/2))shifted (TC-C);    

  fill polygone(A,B,C) xscaled (0.4) yscaled (0.4) shifted (TU-B) withcolor green;
  draw polygone(A,B,C) xscaled (0.4) yscaled (0.4) shifted (TU-B);

  label.bot(btex $c$ etex,0.5[B,C]);
  label.ulft(btex $a$ etex,0.5[B,A]);
  label.urt(btex $b$ etex,0.5[A,C]);
  
  label.bot(btex $1$ etex,0.5[B,C] xscaled (0.4) yscaled (0.4) shifted (TU-B));
  label.bot(btex $b$ etex,0.5[A,C] rotatedaround(C,(-90-ang/2))shifted (TC-C));
  label.bot(btex $a$ etex,0.5[A,B] rotatedaround(B,(180-ang/2))shifted (TB-B));

  label.top(TEX("$S$"),0.5[B,C] xscaled (0.4) yscaled (0.4) shifted (TU-B));
  label.top(TEX("$S \times b^2$"),0.5[A,C] rotatedaround(C,(-90-ang/2))shifted (TC-C));
  label.top(TEX("$S \times a^2$"),0.5[A,B] rotatedaround(B,(180-ang/2))shifted (TB-B));

  label.top(TEX("$S \times c^2$"),0.5[C,B]);

  label(TEX("$S \times c^2 =S \times a^2+ S \times b^2$"),0.5[B,C] shifted ((0,-u)));
  label(TEX("\fbox{$c^2 = a^2 + b^2$}"),0.5[B,C] shifted ((0,-2u)));  
  %------------------------------- Tracé de la figure
  draw fig ;
  %------------------------------- Tracé du cadre
  draw cadre withcolor black withpen pencircle scaled 2pt;    
  clip currentpicture to cadre;
endfig;



end ;