quadimpos.mp [ source brut ]
% -*- coding: iso-8859-15 -*- % fichier quadimpos.mp % Time-stamp: <2007-03-07T09:29:02 (cet) [yvon sur hypatie]> % création : 2007-03-07T08:15:02+0100 % % d'après ERNST (Bruno), L'aventure des figures impossibles % Taschen, © 1990 % Traduction française de « Avonturen met onmogelijke figuren » % Amsterdam, Aramith © 1985 J.A.F. de Rijk % % codage et adaptation : Le TeXnicien de surface numeric haut, large, u, epais[], ep_trait; u = 1cm; haut = 10u; large= 12u; epais7 = haut/4; % sens descendant epais1 = haut/4; % sens montant epais2 = haut/4; % verticale ep_trait = 0.5pt; % épaisseur du « trait de crayon » pair montant, descendant; montant = unitvector(1,0.5); descendant = unitvector(1,-0.5); color coul[]; % couleurs des « faces » coul1 = 0.60*white; coul2 = 0.85*white; coul3 = white; % couleur des « traits de crayon » coul4 = black;

beginfig(1); % points de base (un trapèze) z0 = origin; z1 = z0 shifted (descendant scaled large); z2 = z0 shifted (haut*up); z3 = z2 shifted (montant scaled large); % draw z0--z1--z3--z2--cycle; % pour construction % dotlabels(0,1,2,3); % pour construction % points de la figure avec points intermédiaires z4 = z2 shifted (descendant scaled epais7); z5-z4 = whatever*montant; z5-z1 = whatever*up; z6-z5 = whatever*descendant; z6-z2 = whatever*(z2-z3); z7-z6 = whatever*up; z7-z0 = whatever*descendant; z8-z7 = whatever*montant; z8-z1 = whatever*up; z10 = (z4 shifted (z0-z2)) shifted (epais2*up); z11-z10=epais1*montant; z12a-z11 = whatever*up; z12a-z4 = whatever*(z5-z4); z12 = z12a shifted (epais2*down); z13-z12 = whatever*montant; z13-z7 = whatever*up; z15a-z10 = whatever*descendant; z15a-z7 = whatever*up; z15 = z15a shifted (-epais7*descendant); z16-z15 = whatever*up; z16-z12 = whatever*montant; z17-z11 = whatever*descendant; z17-z15 = whatever*up; % coloriage puis traçage fill z2--z4--z5--z6--cycle withcolor coul2; fill z10--z15--z17--z11--cycle withcolor coul2; fill z2--z0--z7--z15a--z13--z16--z15--z10--z4--cycle withcolor coul1; fill z7--z8--z5--z4--z10--z11--z12--z13--cycle withcolor coul3; drawoptions(withcolor coul4); pickup pencircle scaled ep_trait; draw z2--z4--z5--z6--cycle; draw z4--z10--z11--z12--z13--z7; draw z2--z0--z7--z8--z5; draw z10--z15--z16; draw z11--z17; endfig; end
[haut]
trimpossible.mp [ source brut ]
% -*- coding: iso-8859-15 -*- %%% fichier illusions.mp %%% figures impossibles %%% Y. Henel 2004-02-22 %%% configuration %%% vous pouvez changer les valeurs des variables ci-dessous numeric u; u=10cm; numeric long, larg; long=u; larg=.1u; numeric rotat; rotat:=30; boolean avec_couleur; %%% commentez l'une des deux égalités ci-dessous : % avec_couleur=false; % pas de couleur avec_couleur=true; % de la couleur %%% on peut redéfinir les couleurs ici : color couleur[]; couleur1 = 0.35white; couleur2 = 0.85white; couleur3 = 0.75blue+.25white; %%%% fin de la partie configuration %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% constantes %%% ne pas toucher ! pair V[], v[]; v1=dir 60; v2=dir(-60); V1=long*v1; V3=larg*right; V2=larg*v2; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

beginfig(1); z0=origin; z1=z0 shifted V2; z2=z1 shifted V3; z3=z0 shifted V3; for i=0 upto 3: z[4+i] = z[i] shifted V1; endfor; z.aa = z2 shifted up; z.a= whatever[z2,z.aa]=whatever[z3,z7]; z.b=z.a shifted right; z8= whatever[z.a,z.b]=whatever[z2,z6]; numeric langle; langle= 180 - angle(z2-z3); for i=0 upto 8: z[10+i] = z[i] rotatedabout(z0,rotat); endfor; for i=0 upto 8: z[20+i] = (z[10+i] rotatedabout(z13, langle)) shifted (z17-z13); endfor; for i=0 upto 8: z[30+i] = (z[10+i] rotatedabout(z13, 120)) shifted (z27-z13); endfor; if avec_couleur: for i=0 upto 8: z[40+i]=z[10+i]; z[50+i] = z[20+i]; endfor; for i=1 upto 3: fill z[10*i+16]--z[10*i+17]--z[10*i+6]--z[10*i+18]--cycle withcolor couleur[i]; fill z[20+10*i]--z[20+10*i+3]--z[10*i]--z[10*i+1]--cycle withcolor couleur[i]; endfor; fi pickup pencircle scaled .5mm; for k=1 upto 3: draw for j=0 upto 3: z[10*k+j]-- endfor cycle; draw z[10*k+4]--z[10*k+7]--z[10*k+6]; for i=0, 3: draw z[10*k+i]--z[10*k+4+i]; endfor; draw z[10*k+6]--z[10*k+8]; endfor; % pendant la construction, repères : % dotlabels(30,31,32,33,34,35,36,37,38); endfig; end