On 12/31/2023 8:06 AM, Mikael Sundqvist wrote:
\startMPpage
path p[], q ;
p1 = fullcircle scaled 3cm ;
p2 = fullcircle scaled 2cm shifted (3cm,0) ;
p3 = (3cm,2cm) ;
p4 = fullcircle ;
q = p[1] for i = 2 upto 3:
if (length(p[i]) == 0): &&& else: && fi p[i]
endfor
&& cycle ;
eofill q withcolor 0.9 ;
draw p1 withpen pencircle scaled 2pt withcolor .7 ;
draw p2 withpen pencircle scaled 2pt withcolor .7 ;
draw p3 withpen pencircle scaled 2pt withcolor .7 ;
draw q withcolor red ;
draw fullcircle scaled 6cm shifted (1.25cm,0) ;
\stopMPpage
maybe this is a bit more beautiful then

 q = for i = 1 upto 3 :
    if length(p[i]) == 0 : % todo: a fast nolength
        (p[i] -- p[i] shifted 5(eps,eps))
    else:
        p[i]
    fi &&
 endfor cycle ;

(i'm not sure if we should change the implementation, probably not unless we have &&&&& -- actually we could have proper keywords which makes it less clumsy. Or 'recycle' that does the ugly eps job when we have a zero length path but we can move that over the year boundary.)

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to