input geometriesyr16;
u:=0.75cm;
vardef roulades(expr n, t)=
  save $;
  pair A[],I[],O,centre[],J[];
  path cc[],poly;
  picture $;
  $=image(
    O=u*(3,3);
    A1=u*(1,1);
    for j=2 upto n:
      A[j]=rotation(A[j-1],O,-360/n);
    endfor;
    trace A1
    for k=2 upto n:
      --A[k]
    endfor
    --cycle withpen pencircle scaled 1.25bp withcolor gris;
    trace droite(A1,A[n]);
    for k=0 upto n-2:
      centre[k]=A[n] shifted(k*(A[n]-A[1]));
    endfor;
    I0=A1;
    for k=0 upto (n-2):
      for j=1 upto (360/n):
	I[k*(360/n)+j]=rotation(I[k*(360/n)],centre[k],-j);
      endfor;
    endfor;
    J0=O;
    for k=0 upto (n-2):
      for j=1 upto (360/n):
	J[k*(360/n)+j]=rotation(J[k*(360/n)],centre[k],-j);
      endfor;
    endfor;
    cc1=I[0]
    for j=1 upto (360-360/n):
      ..I[j]
    endfor
    ;
    trace cc1 withcolor orange;
    if t=1:
      marque_p:="plein";
      for k=0 upto n-2:
	for j=10 step 30 until (360/n):
	  pointe(I[k*(360/n)+j]);
	  trace centre[k]--
	  for p=1 upto n-1:
	    rotation(centre[k],J[k*(360/n)+j],-p*(360/n))--
	  endfor
	  cycle dashed evenly withcolor 0.4[blanc,bleu];
	endfor;
      endfor;
    fi;
    );
  $:=rotation($,A1,-angle(A[n]-A[1]));
  $
enddef;
figure(-.5u,0,18u,6.5u);
%trace feuillet;
trace roulades(3,1);
fin;
figure(-.5u,0,18u,7.5u);
%trace feuillet;
trace roulades(4,1);
fin;
figure(-1.5u,0,19u,7.5u);
%trace feuillet;
trace roulades(5,1);
fin;
figure(-1.5u,0,20u,7.5u);
%trace feuillet;
trace roulades(8,1);
fin;
figure(-1.5u,0,21u,7.5u);
%trace feuillet;
trace roulades(20,1);
fin;
figure(-1.5u,0,21u,7.5u);
%trace feuillet;
trace roulades(36,2);
fin;
figure(-1.5u,0,20u,7.5u);
trace roulades(9,2);
currentpicture:=nullpicture;
nomme.bot(A1);
nomme.llft(A2);
nomme.llft(A3);
nomme.lft(A4);
nomme.rt(A7);
nomme.lrt(A8);
nomme.lrt(A9);
currentpicture:=rotation(currentpicture,A1,-angle(A[9]-A[1]));
trace roulades(9,2);
fin;
figure(-2.5u,0,20u,7.5u);
trace roulades(180,2);
fin;
figure(-.5u,0,18u,6.5u);
%trace feuillet;
trace roulades(3,2);
fin;
figure(-2.5u,0,19u,7.5u);
trace roulades(10,2);
trace hachurage(rotation(cc1--cycle,A1,-angle(A[10]-A[1])),60,0.4,2) withcolor gris;
dotlabel.bot(btex $A_1$ etex,A1);
dotlabel.bot(btex $A_{10}$ etex,rotation(A10,A1,-angle(A[10]-A[1])));
dotlabel.bot(btex $A'_{9}$ etex,rotation(centre1,A1,-angle(A[10]-A[1])));
dotlabel.ulft(btex $A'_1$ etex,rotation(I[36],A1,-angle(A[10]-A[1])));
fin;
end