Fichier popart.mp (figure 1) — Modifié le 28 Mars 2008 à 21 h 37
prologues:=2;
input geometriesyr16;
vardef popart(expr deg,div,rep,sens,coul,coull)=
save $;
picture $;
save T;
transform P[];
path cc;
cc=cercles(u*(10,10),10u);
pair sommet[];
marque_p:="plein";
sommet0=pointarc(cc,0);
for k=1 upto deg:
sommet[k]=rotation(sommet[k-1],u*(10,10),360/deg);
pointe(sommet[k]);
endfor;
pair A,B,C;
A=u*(10,10);
for k=0 upto (deg-1):
B:=sommet[k];
C:=sommet[k+1];
if sens=-1:
if (k mod 2)=0:
A transformed P[k]=(1/div)[A,B];
B transformed P[k]=(1/div)[B,C];
C transformed P[k]=(1/div)[C,A];
else:
A transformed P[k]=((div-1)/div)[A,B];
B transformed P[k]=((div-1)/div)[B,C];
C transformed P[k]=((div-1)/div)[C,A];
fi
else:
A transformed P[k]=(1/div)[A,B];
B transformed P[k]=(1/div)[B,C];
C transformed P[k]=(1/div)[C,A];
fi;
endfor;
$=image(
for k=1 upto deg:
B:=sommet[k-1];
C:=sommet[k];
picture dessin;
if (k mod 2)=1:
dessin=image(
fill A--B--C--cycle withcolor coul;
fill ((A--B--C--cycle) transformed P[k-1]) withcolor coull;
trace A--B--C--cycle;
trace ((A--B--C--cycle) transformed P[k-1]);
);
trace dessin;
for j=1 upto (rep/2):
dessin:=dessin transformed (P[k-1]) transformed (P[k-1]);
trace dessin;
endfor;
else:
dessin=image(
fill A--C--B--cycle withcolor coul;
fill ((A--C--B--cycle) transformed P[k-1]) withcolor coull;
trace A--C--B--cycle;
trace ((A--C--B--cycle) transformed P[k-1]);
);
trace dessin;
for j=1 upto (rep/2):
dessin:=dessin transformed P[k-1] transformed P[k-1];
trace dessin;
endfor;
fi;
endfor;
);
$
enddef;
u:=7.5mm;
beginfig(1);
%figure(0,0,20u,20u);
trace popart(6,10,30,-1,blanc,blanc);
%fin;
endfig;
beginfig(2);
%figure(0,0,20u,20u);
trace popart(12,15,20,-1,blanc,blanc);
%fin;
endfig;
beginfig(3);
%figure(0,0,20u,20u);
trace popart(12,15,20,1,blanc,blanc);
%fin;
endfig;
beginfig(4);
%figure(0,0,20u,20u);
trace popart(16,15,20,-1,blanc,blanc);
%fin;
endfig;
beginfig(5);
%figure(0,0,20u,20u);
trace popart(16,15,20,1,blanc,blanc);
%fin;
endfig;
beginfig(6);
%figure(0,0,20u,20u);
trace popart(6,10,30,1,jaune,violet);
%fin;
endfig;
beginfig(7);
%figure(0,0,20u,20u);
trace popart(12,15,20,1,jaune,3/5[jaune,blanc]);
%fin;
endfig;
end