Fichier pavages001.mp (figure 4) — Modifié le 28 Mars 2008 à 22 h 00

pavages001.mp (figure 4)
Source

%%D'apres 'Pour la science' n°272 Avril 2000 - p106

prologues:=2;

input geometriesyr16;

vardef pavages(expr chemin,tour,coul)=
  save $;
  picture $;
  pair A,B,C,D;
  A=u*(0,0);
  B=u*(1,0);
  C=u*(1,1);
  D=u*(0,1);
  path especes;
  especes=chemin--rotation(chemin,B,-90)--reverse(rotation(symetrie(chemin,B,C),B,-90))--rotation(chemin,B,90)--cycle;
  if tour=0:
    $=image(
      trace chemin;
      );
  elseif tour=1:
    $=image(
      fill especes withcolor coul;
      trace especes;
      A:=A shifted(u*(0,-1));
      B:=B shifted(u*(1,-1));
      C:=C shifted(u*(1,0));
      );
  elseif tour>=2:
    $=pavages(chemin,tour-1,coul);
    $:=image(
      trace $;
      trace symetrie($,B,C);
      trace rotation(symetrie($,B,C),B,-90);
      trace rotation($,B,90);
      A:=A shifted(u*(0,-(2**(tour-1))));
      B:=B shifted(u*(2**(tour-1),-(2**(tour-1))));
      C:=C shifted(u*(2**(tour-1),0));
      );
  fi;
  $
enddef;

vardef pavagescar(expr chemin,tour,coul)=
  save $;
  picture $;
  pair A,B,C,D;
  A=u*(0,0);
  B=u*(1,0);
  C=u*(1,1);
  D=u*(0,1);
  if tour=0:
    $=image(
      trace chemin;
      trace A--B--C--D--cycle dashed dashpattern(on12bp off6bp on3bp off 6bp) withcolor gris;
      );
  elseif tour=1:
    $=image(
      trace chemin;
      drawoptions(dashed evenly);
      trace rotation(chemin,B,-90);
      trace reverse(rotation(symetrie(chemin,B,C),B,-90));
      trace rotation(chemin,B,90);
      drawoptions();
      A:=A shifted(u*(0,-1));
      B:=B shifted(u*(1,-1));
      C:=C shifted(u*(1,0));
      trace A--B--C--D--cycle dashed dashpattern(on12bp off6bp on3bp off 6bp) withcolor gris;
      trace iso(A,D)--iso(B,C) dashed dashpattern(on12bp off6bp on3bp off 6bp) withcolor gris;
      trace iso(A,B)--iso(C,D) dashed dashpattern(on12bp off6bp on3bp off 6bp) withcolor gris;
      );
  elseif tour>=2:
    $=image(
      trace pavages(chemin,tour-1,coul);
      drawoptions(dashed evenly);
      trace symetrie(pavages(chemin,tour-1,coul+0.5blanc),B,C);
      trace rotation(symetrie(pavages(chemin,tour-1,coul+0.5blanc),B,C),B,-90);
      trace rotation(pavages(chemin,tour-1,coul+0.5blanc),B,90);
      drawoptions();
      A:=A shifted(u*(0,-(2**(tour-1))));
      B:=B shifted(u*(2**(tour-1),-(2**(tour-1))));
      C:=C shifted(u*(2**(tour-1),0));
      );
    trace A--B--C--D--cycle dashed dashpattern(on12bp off6bp on3bp off 6bp) withcolor gris;
    trace iso(A,D)--iso(B,C) dashed dashpattern(on12bp off6bp on3bp off 6bp) withcolor gris;
    trace iso(A,B)--iso(C,D) dashed dashpattern(on12bp off6bp on3bp off 6bp) withcolor gris;
  fi;
  $
enddef;


beginfig(1);
  path NN;
  NN=u*(0,0)..u*(0.25,.1)..u*(0.5,0.7)..u*(1,1);
  trace pavagescar(NN,0,orange);
endfig;

beginfig(2);
  trace pavagescar(NN,1,orange);
endfig;

beginfig(3);
  trace pavagescar(NN,2,orange);
endfig;

beginfig(4);
  trace pavagescar(NN,3,orange);
endfig;

beginfig(5);
  trace pavagescar(NN,4,orange);
endfig;

beginfig(6);
  trace pavagescar(NN,5,orange);
endfig;
end