Hi Dalyong,

> I’d like to use the following code.
> 
> pic := image(origin--(2u,0)--(3u,u); (3u,0)--(4u,0););

You won’t be able to use that code, because the syntax is wrong. The image must 
contain drawing commands, but in your code it only contains paths.

I’m not sure what you want. Your original example made an image and colored 
white over part of the path. It doesn’t look great. It can be improved by 
making the white pen bigger:

pic := image(draw p; draw q withpen pencircle scaled 0.6 withcolor white;);

I’m not sure this gives what you want at the ends, but it certainly hides part 
of the path.

Mikael’s solution is neat because he doesn’t just hide part of the path, he 
makes a new path with that part completely removed. If you name that path, you 
can do whatever you want with it — draw it, scale it, put it in an image() 
command, etc.

\startMPpage[offset=1DK]
path p,pM; % pM will be Mikael’s path
numeric u; u:= 1cm;

p := origin--(2u,0)--(3u,u)--(3u,0)--(4u,0);
pM :=  subpath (0,2) of p && subpath (3,4) of p ; % Mikael's path has two 
disconnected pieces!
draw pM ;
\stopMPpage

If neither of those is what you need, please provide an example that shows more 
of what you are trying to do.

Gavin
___________________________________________________________________________________
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