* [NTG-context] Hiding a part of a path
@ 2024-12-02 12:54 Jeong Dal via ntg-context
2024-12-02 13:13 ` [NTG-context] " Mikael Sundqvist
0 siblings, 1 reply; 4+ messages in thread
From: Jeong Dal via ntg-context @ 2024-12-02 12:54 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Jeong Dal
[-- Attachment #1.1: Type: text/plain, Size: 464 bytes --]
Dear all,
I’d like to hide a part of a path.
I can do that after changing it into an image, but it is not clearly erased.
Is there a way to do that not changing it into an image?
Thank you for reading.
Best regards,
Dalyoung
\startMPcode
path p,q;
picture pic;
numeric u; u:= 1cm;
p := origin--(2u,0)--(3u,u)--(3u,0)--(4u,0);
q := (3u,u)--(3u,0);
pic := image(draw p; draw q withcolor white;);
draw pic;
\stopMPcode
[-- Attachment #1.2: Type: text/html, Size: 2219 bytes --]
[-- Attachment #2: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* [NTG-context] Re: Hiding a part of a path
2024-12-02 12:54 [NTG-context] Hiding a part of a path Jeong Dal via ntg-context
@ 2024-12-02 13:13 ` Mikael Sundqvist
2024-12-02 14:14 ` Jeong Dal via ntg-context
0 siblings, 1 reply; 4+ messages in thread
From: Mikael Sundqvist @ 2024-12-02 13:13 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi
On Mon, Dec 2, 2024 at 1:57 PM Jeong Dal via ntg-context
<ntg-context@ntg.nl> wrote:
>
> Dear all,
>
> I’d like to hide a part of a path.
>
> I can do that after changing it into an image, but it is not clearly erased.
> Is there a way to do that not changing it into an image?
> Thank you for reading.
>
> Best regards,
>
> Dalyoung
>
> \startMPcode
> path p,q;
> picture pic;
> numeric u; u:= 1cm;
>
> p := origin--(2u,0)--(3u,u)--(3u,0)--(4u,0);
> q := (3u,u)--(3u,0);
> pic := image(draw p; draw q withcolor white;);
>
> draw pic;
> \stopMPcode
It is not clear how general you want this to be. For your example you
can draw only the parts of p you need.
\startMPpage[offset=1DK]
path p,q;
picture pic;
numeric u; u:= 1cm;
p := origin--(2u,0)--(3u,u)--(3u,0)--(4u,0);
q := (3u,u)--(3u,0);
% pic := image(draw p; draw q withcolor white;);
% draw pic;
draw p withpen pencircle scaled 4 ;
draw subpath (0,2) of p
&& subpath (3,4) of p
withpen pencircle scaled 2
withcolor yellow ;
\stopMPpage
If you need to "cut" in a more advanced way, I suggest to give such an example.
/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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* [NTG-context] Re: Hiding a part of a path
2024-12-02 13:13 ` [NTG-context] " Mikael Sundqvist
@ 2024-12-02 14:14 ` Jeong Dal via ntg-context
2024-12-02 15:14 ` Gavin via ntg-context
0 siblings, 1 reply; 4+ messages in thread
From: Jeong Dal via ntg-context @ 2024-12-02 14:14 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Jeong Dal
[-- Attachment #1.1: Type: text/plain, Size: 2164 bytes --]
Dear Mikael,
As you said, it might be good to use image.
Since I want not to draw a part of the path, I’d like to use the following code.
pic := image(origin--(2u,0)--(3u,u); (3u,0)--(4u,0););
Thank you for the reply.
Best regards,
Dalyoung
> 2024. 12. 2. 오후 10:13, Mikael Sundqvist <mickep@gmail.com> 작성:
>
> Hi
>
> On Mon, Dec 2, 2024 at 1:57 PM Jeong Dal via ntg-context
> <ntg-context@ntg.nl <mailto:ntg-context@ntg.nl>> wrote:
>>
>> Dear all,
>>
>> I’d like to hide a part of a path.
>>
>> I can do that after changing it into an image, but it is not clearly erased.
>> Is there a way to do that not changing it into an image?
>> Thank you for reading.
>>
>> Best regards,
>>
>> Dalyoung
>>
>> \startMPcode
>> path p,q;
>> picture pic;
>> numeric u; u:= 1cm;
>>
>> p := origin--(2u,0)--(3u,u)--(3u,0)--(4u,0);
>> q := (3u,u)--(3u,0);
>> pic := image(draw p; draw q withcolor white;);
>>
>> draw pic;
>> \stopMPcode
>
> It is not clear how general you want this to be. For your example you
> can draw only the parts of p you need.
>
> \startMPpage[offset=1DK]
> path p,q;
> picture pic;
> numeric u; u:= 1cm;
>
> p := origin--(2u,0)--(3u,u)--(3u,0)--(4u,0);
> q := (3u,u)--(3u,0);
> % pic := image(draw p; draw q withcolor white;);
> % draw pic;
> draw p withpen pencircle scaled 4 ;
> draw subpath (0,2) of p
> && subpath (3,4) of p
> withpen pencircle scaled 2
> withcolor yellow ;
> \stopMPpage
>
> If you need to "cut" in a more advanced way, I suggest to give such an example.
>
> /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
> ___________________________________________________________________________________
[-- Attachment #1.2: Type: text/html, Size: 26711 bytes --]
[-- Attachment #2: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* [NTG-context] Re: Hiding a part of a path
2024-12-02 14:14 ` Jeong Dal via ntg-context
@ 2024-12-02 15:14 ` Gavin via ntg-context
0 siblings, 0 replies; 4+ messages in thread
From: Gavin via ntg-context @ 2024-12-02 15:14 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Gavin
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-12-02 15:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-02 12:54 [NTG-context] Hiding a part of a path Jeong Dal via ntg-context
2024-12-02 13:13 ` [NTG-context] " Mikael Sundqvist
2024-12-02 14:14 ` Jeong Dal via ntg-context
2024-12-02 15:14 ` Gavin via ntg-context
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).