Hi

On Sun, Dec 31, 2023 at 3:33 AM Gavin via ntg-context
<ntg-context@ntg.nl> wrote:
>
> Hi MetaFun fans,
>
> Following a suggestion of Hans, I experimented with && and &&& and &&&& for 
> joining paths in MetaFun. The joiner &&& produces one long path, but && and 
> &&&& seem to produce a disconnected path which includes all the original 
> paths. However, if one of the paths is a single point, then it connects it. 
> MWE below.
>
> I spotted this on my globes module, where we saw an extra line appear for a 
> very specific orientation of the globe. I guessed that this orientation had 
> an island right on the horizon, so that only one boundary point was visible, 
> creating a singe point path for that island. I should probably fix my module 
> so it doesn’t do that. However, it might be nice to have && and &&&& deal 
> with this situation gracefully.
>
> Gavin
>
>
> \startMPpage
>  path p[], q ;
>  p1 = fullcircle scaled 3cm ;
>  p2 = fullcircle scaled 2cm shifted (3cm,0) ;
>  p3 = (3cm,2cm) ;
>  q = for i = 1 upto 3 :
>         p[i] &&
>      endfor
>      cycle ;
>  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 ;
>  eofill q withcolor 0.9 ;
>  draw fullcircle scaled 6cm shifted (1.25cm,0) ;
> \stopMPpage

Not beautiful, but this seems to do what you want in this particular case:

\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

This gives

q = p1 && p2 &&& p3 && cycle ;

/Mikael
___________________________________________________________________________________
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