Hi Mikael, Great job ! Thanks Fabrice Le dim. 2 oct. 2022 à 15:37, Mikael Sundqvist via ntg-context < ntg-context@ntg.nl> a écrit :
Hi,
On Sun, Oct 2, 2022 at 3:26 PM Hans Hagen via ntg-context
wrote: On 10/2/2022 3:13 PM, Fabrice Couvreur via ntg-context wrote:
Ok, it works very well. Without wanting to insist, how to have the same hatching with two different figures ? see upcoming mail from Mikael
Oh, OK, here it goes. Hans will probably rename things if he adds this.
\startMPpage[offset=1dk]
vardef Stripe(expr p, a, d) = save thestripe ; picture thestripe ; thestripe := nullpicture ; save diag ; numeric diag ; diag := 0.55*( abs((urcorner boundingbox p) - (llcorner boundingbox p)) ) ; thestripe := image ( draw (-diag,0) -- (diag, 0) && for i = d step d until diag: (-diag, i) -- (diag, i) && (-diag,-i) -- (diag,-i) && endfor nocycle withpen currentpen ; ) ; thestripe := thestripe shifted center boundingbox p ; thestripe := thestripe rotatedaround(center boundingbox p, a) ; clip thestripe to p ; thestripe enddef ;
path p ; p := fullcircle scaled 3cm && (unitsquare scaled 2cm shifted (4cm,4cm)) && cycle ; fill p withcolor darkred ; draw Stripe(p,30,.2cm) withcolor darkgreen ;
path q ; q := fullsquare randomized 0.3 scaled 3cm yshifted 5cm ; fill q withcolor yellow ; draw Stripe(q,70,.3cm) withcolor red ;
draw Stripe(p && q && cycle, -20, .5cm) withcolor "orange" ;
draw p ; draw q ;
\stopMPpage
/Mikael
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net
___________________________________________________________________________________