%@AUTEUR: Christophe Poulain (4 février 2003) vardef hachurage(expr chemin, angle, ecart, trace)suffix couleur = save $; picture $; path support; support=(((-37cm,0))--((37cm,0))) rotated angle; if trace=1: drawoptions(dashed evenly); elseif trace=2: drawoptions(dashed dashpattern(on12bp off6bp on3bp off6bp)); fi; $ = image( for j=-200 upto 200: if ((support shifted (ecart*j*(1,0))) intersectiontimes chemin)<>(-1,-1): draw support shifted (ecart*j*(1,0)) withcolor if str couleur="":(0,0,0) else:couleur fi; fi endfor; ); clip $ to chemin; drawoptions(); $ enddef; color rouge; rouge = (1,0,0); beginfig(1); path p,q; p = fullcircle scaled 3cm; draw hachurage(p,45,2mm,0)rouge; draw p; q = (p scaled 0.5) shifted (4cm,2cm); draw hachurage(q,30,4mm,1); draw q; endfig; def dessine(expr p,a,e,t,s)(text couleurs) = save co,n; color co[]; numeric n; n := 0; forsuffixes c = couleurs: co[incr n] = c; endfor; if n = 1: co2 = co1; fi; draw hachurage(p,a,e,t) co1; draw p withpen pencircle scaled s withcolor co2; enddef; beginfig(2); path carre,cercle; cercle = fullcircle scaled 2cm; carre = ((0,0)--(3cm,0)--(3cm,3cm)--(0,3cm)--cycle) shifted (3cm,-1cm); dessine(((3cm,1cm)..(4cm,3cm)..(1cm,2cm)..cycle),30,4mm,3,1pt,black); dessine(cercle,60,3mm,0,2pt,green); dessine(carre,45,5mm,2,1pt,blue,red); endfig; end