Pavages…

Pavages carrés

pavagescarreexemples.mp
%%D'apres 'Pour la science' n°272 Avril 2000 - p106
 
input geometriesyr12;
 
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;
 
pavagescarreexemples (figure 10)
beginfig(10);
  path NN;
  NN=u*(0,0)..u*(0.25,.1)..u*(0.5,0.7)..u*(1,1);
  trace pavagescar(NN,0,orange);
endfig;
pavagescarreexemples (figure 11)
beginfig(11);
  trace pavagescar(NN,1,orange);
endfig;
pavagescarreexemples (figure 12)
beginfig(12);
  trace pavagescar(NN,2,orange);
endfig;
pavagescarreexemples (figure 13)
beginfig(13);
  trace pavagescar(NN,3,orange);
endfig;
pavagescarreexemples (figure 14)
beginfig(14);
  trace pavagescar(NN,4,orange);
endfig;
 
end
 

Pavages triangulaires

pavagesequiexemples.mp
%%D'apres 'Pour la science' n°272 Avril 2000 - p106
 
input geometriesyr12;
 
vardef pavagesequi(expr chemin,tour,coul,coull)=
  save $;
  picture $;
  pair A,B,C;
  A=u*(0,0);
  B=u*(1,0);
  C=rotation(B,A,60);
  path especes;
  especes = chemin
	    -- rotation(chemin,symetrie(iso(A,B,C),A,B),-120)
	    -- rotation(chemin,symetrie(iso(A,B,C),A,B),120)
	    -- cycle;
  if tour=0:
    $=image(
      trace chemin;
      );
  elseif tour=1:
    $=image(
      fill especes withcolor coul;
      fill (chemin--symetrie(chemin,iso(A,B))--cycle) withcolor coull;
      trace especes;
      trace symetrie(chemin,iso(A,B));
      A:=symetrie(C,A);
      B:=symetrie(C,B);
      );
  elseif tour>=2:
    $=pavagesequi(chemin,1,coul,coull);
    for k=2 upto tour:
      $:=image(
	trace $;
	trace rotation($,symetrie(iso(A,B,C),A,B),-120);
	trace rotation($,symetrie(iso(A,B,C),A,B),120);
	trace symetrie($,iso(A,B));
	A:=symetrie(C,A);
	B:=symetrie(C,B)
	);
    endfor;
  fi;
  $
enddef;
 
vardef pavagesequiqui(expr chemin,tour,coul,coull)=
  save $;
  picture $;
  pair A,B,C;
  A=u*(0,0);
  B=u*(1,0);
  C=rotation(B,A,60);
  path especes;
    especes = chemin 
	      -- rotation(chemin,symetrie(iso(A,B,C),A,B),-120)
	      -- rotation(chemin,symetrie(iso(A,B,C),A,B),120)
	      -- cycle;
  if tour=0:
    $=image(
      trace chemin;
      );
  elseif tour=1:
    $=image(
      trace chemin;
      drawoptions(dashed evenly);
      trace rotation(chemin,symetrie(iso(A,B,C),A,B),-120);
      trace rotation(chemin,symetrie(iso(A,B,C),A,B),120);
      trace symetrie(chemin,iso(A,B));
      drawoptions();
      A:=symetrie(C,A);
      B:=symetrie(C,B);
      );
  elseif tour=2:
    $=image(
      fill especes withcolor coul;
      fill (chemin--symetrie(chemin,iso(A,B))--cycle) withcolor coull;
      trace especes;
      trace symetrie(chemin,iso(A,B));
      A:=symetrie(C,A);
      B:=symetrie(C,B);
      );
    $:=image(
      trace $;
      drawoptions(dashed evenly);
      trace rotation(pavagesequi(chemin,1,coul+0.5blanc,coull+0.5blanc),
        symetrie(iso(A,B,C),A,B),-120);
      trace rotation(pavagesequi(chemin,1,coul+0.5blanc,coull+0.5blanc),
        symetrie(iso(A,B,C),A,B),120);
      trace symetrie(pavagesequi(chemin,1,coul+0.5blanc,coull+0.5blanc),
        iso(A,B));
      drawoptions();
      A:=symetrie(C,A);
      B:=symetrie(C,B);
      );
  elseif tour>=3:
    $=pavagesequi(chemin,1,coul,coull);
    for k=2 upto tour-1:
      $:=image(
	trace $;
	trace rotation($,symetrie(iso(A,B,C),A,B),-120);
	trace rotation($,symetrie(iso(A,B,C),A,B),120);
	trace symetrie($,iso(A,B));
	A:=symetrie(C,A);
	B:=symetrie(C,B);
	);
    endfor;
    $:=image(
      trace $;
      drawoptions(dashed evenly);
      trace rotation(pavagesequi(chemin,tour-1,coul+0.5blanc,coull+0.5blanc),
        symetrie(iso(A,B,C),A,B),-120);
      trace rotation(pavagesequi(chemin,tour-1,coul+0.5blanc,coull+0.5blanc),
        symetrie(iso(A,B,C),A,B),120);
      trace symetrie(pavagesequi(chemin,tour-1,coul+0.5blanc,coull+0.5blanc),
        iso(A,B));
      drawoptions();
      A:=symetrie(C,A);
      B:=symetrie(C,B);
      );
  fi;
  $:=image(
    trace $;
    trace A--B--C--cycle 
	dashed dashpattern(on12bp off6bp on3bp off6bp) withcolor gris;
    trace iso(A,B)--iso(B,C)--iso(C,A)--cycle 
	dashed dashpattern(on12bp off6bp on3bp off6bp) withcolor gris;
    );
  $
enddef;
 
pavagesequiexemples (figure 1)
beginfig(1);
  path MM;
  MM=(0,0)--u*(0.25,0)--u*(0.25,0.4)--u*(0.75,0.2)--u*(1,0);
  trace pavagesequiqui(MM,0,orange,vert);
endfig;
pavagesequiexemples (figure 2)
beginfig(2);
  trace pavagesequiqui(MM,1,orange,vert);
endfig;
pavagesequiexemples (figure 3)
beginfig(3);
  trace pavagesequiqui(MM,2,orange,vert);
endfig;
pavagesequiexemples (figure 4)
beginfig(4);
  trace pavagesequiqui(MM,3,orange,vert);
endfig;
pavagesequiexemples (figure 5)
beginfig(5);
  trace pavagesequiqui(MM,4,orange,vert);
endfig;
 
end