Retour

Source : pythagore.mp


pythagore.mp
prologues:=2;
input geometrie2;
u=1cm;
pair p[];
beginfig(0);
  p6=u*(1,2);
  p7=u*(7,2);
  p8=u*(3,7);
  p9=projete(p8,p6,p7);
  draw p6--p7--p8--cycle;
  draw p8--p9;
  draw codeperp(p8,p9,p6);
  draw p6--(p6 shifted (0,-.5u)) dashed evenly;
  draw p7--(p7 shifted (0,-.5u)) dashed evenly;
  drawdblarrow (p6 shifted (0,-.5u))--(p7 shifted(0,-.5u));
  label.bot(btex $b$ etex,milieu(p6 shifted(0,-.5u),p7 shifted(0,-.5u)));
  draw p8--(p8 shifted(-(xpart(p8)-xpart(p6)+0.5*u),0)) dashed evenly;
  draw p6--(p6 shifted(-0.5*u,0)) dashed evenly;
  drawdblarrow (p8 shifted(-(xpart(p8)-xpart(p6)+0.5*u),0))--(p6 shifted(-0.5*u,0));
  label.lft(btex $h$ etex,milieu(p8 shifted(-(xpart(p8)-xpart(p6)+0.5*u),0),p6 shifted(-0.5*u,0)));
endfig;
beginfig(1);
  p0=u*(1,1);label.llft(btex $B$ etex,p0);
  p1=u*(6,1);label.lrt(btex $C$ etex,p1);
  p2=u*(3,5);label.top(btex $A$ etex,p2);
  p3=projete(p0,p1,p2);label.urt(btex $E$ etex,p3);
  p4=projete(p1,p2,p0);label.ulft(btex $F$ etex,p4);
  p5=projete(p2,p0,p1);label.bot(btex $D$ etex,p5);
  draw codeperp(p2,p5,p1);
  draw codeperp(p0,p3,p1);
  draw codeperp(p1,p4,p0);
  draw p0--p1--p2--cycle;
  draw p0--p3;
  draw p1--p4;
  draw p2--p5;
endfig;
beginfig(2);
  p10=u*(1,2);
  p11=u*(5,1);
  draw rectangle(p10,p11,3*u,-1);
endfig;
beginfig(3);
  p20=u*(1,5);
  p21=u*(4,1);
  p22=p20 rotatedabout(p21,-105);
  p23=cercle(p20,abs(p20-p21)) intersectionpoint cercle(p22,abs(p20-p21));
  draw p20--p21--p22--p23--cycle;
  draw codesegments(p20,p21,p21,p22,2);
  draw codesegments(p22,p23,p23,p20,2);
endfig;
beginfig(4);
  p30=u*(1,3);
  p31=u*(5,1);
  draw carre(p30,p31,-1,2);
endfig;
beginfig(5);
  p40=u*(1,4);label.ulft(btex $A$ etex,p40);
  p41=u*(1,1);label.llft(btex $C$ etex,p41);
  p42=u*(5,4);label.urt(btex $B$ etex,p42);
  draw p40--p41--p42--cycle;
  draw codeperp(p42,p40,p41);
  label.lft(btex $b$ etex,milieu(p40,p41));
  label.lrt(btex $c$ etex,milieu(p41,p42));
  label.top(btex $a$ etex,milieu(p42,p40));
endfig;
beginfig(6);
  p50=u*(1,8);label.ulft(btex $A$ etex,p50);
  p51=u*(8,8);label.urt(btex $D$ etex,p51);
  p52=u*(8,1);label.lrt(btex $F$ etex,p52);
  p53=u*(1,1);label.llft(btex $H$ etex,p53);
  draw p50--p51--p52--p53--cycle;
  draw codeperp(p50,p51,p52);
  draw codeperp(p51,p52,p53);
  draw codeperp(p52,p53,p50);
  draw codeperp(p53,p50,p51);
  p54=4/7[p50,p51];label.top(btex $B$ etex,p54);
  p55=4/7[p51,p52];label.rt(btex $E$ etex,p55);
  p56=4/7[p52,p53];label.bot(btex $G$ etex,p56);
  p57=4/7[p53,p50];label.lft(btex $C$ etex,p57);
  draw p54--p55--p56--p57--cycle;
endfig;
beginfig(7);
  p50=u*(1,8);label.ulft(btex $A$ etex,p50);
  p51=u*(8,8);label.urt(btex $D$ etex,p51);
  p52=u*(8,1);label.lrt(btex $F$ etex,p52);
  p53=u*(1,1);label.llft(btex $H$ etex,p53);
  draw p50--p51--p52--p53--cycle withcolor blue;
  draw codeperp(p50,p51,p52);
  draw codeperp(p51,p52,p53);
  draw codeperp(p52,p53,p50);
  draw codeperp(p53,p50,p51);
  p54=4/7[p50,p51];label.top(btex $B$ etex,p54);
  p55=4/7[p51,p52];label.rt(btex $E$ etex,p55);
  p56=4/7[p52,p53];label.bot(btex $G$ etex,p56);
  p57=4/7[p53,p50];label.lft(btex $C$ etex,p57);
  draw p54--p55--p56--p57--cycle;
endfig;
beginfig(8);
  p50=u*(1,8);label.ulft(btex $A$ etex,p50);
  p51=u*(8,8);label.urt(btex $D$ etex,p51);
  p52=u*(8,1);label.lrt(btex $F$ etex,p52);
  p53=u*(1,1);label.llft(btex $H$ etex,p53);
  p54=4/7[p50,p51];label.top(btex $B$ etex,p54);
  p55=4/7[p51,p52];label.rt(btex $E$ etex,p55);
  p56=4/7[p52,p53];label.bot(btex $G$ etex,p56);
  p57=4/7[p53,p50];label.lft(btex $C$ etex,p57);
  path angle[];
  angle1=buildcycle(p54--p50,p54--p57,cercle(p54,0.5*u));
  fill angle1 withcolor 0.4[green,blue];
  angle2=buildcycle(p54--p57,p54--p55,cercle(p54,0.4*u));
  fill angle2 withcolor red;
  angle3=buildcycle(p54--p55,cercle(p54,0.6*u),p54--p51);
  fill angle3 withcolor blue;
  angle4=buildcycle(p57--p50,p57--p54,cercle(p57,0.6*u));
  fill angle4 withcolor blue;
  draw p50--p51--p52--p53--cycle;
  draw codeperp(p50,p51,p52);
  draw codeperp(p51,p52,p53);
  draw codeperp(p52,p53,p50);
  draw codeperp(p53,p50,p51);
  draw p54--p55--p56--p57--cycle withcolor red;
endfig;
beginfig(9);
  label.ulft(btex $R$ etex,p40);
  label.llft(btex $S$ etex,p41);
  label.urt(btex $T$ etex,p42);
  draw p40--p41--p42--cycle;
  draw codeperp(p42,p40,p41);
endfig;
end