ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Strange behavior with anglestriped()
@ 2023-11-19 17:56 Fabrice Couvreur
  2023-11-19 21:54 ` [NTG-context] " Otared Kavian
  0 siblings, 1 reply; 5+ messages in thread
From: Fabrice Couvreur @ 2023-11-19 17:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1162 bytes --]

Hi,
I don't understand why the hatching of the two rectangles is not the same
color.
Thanks for your help.
Fabrice

\starttext
        \setupbodyfont[8pt]
        \startMPcode
           path p, q, r, b ;

           z[0] = (2cm,0cm) ;
           z[1] = (2cm,2cm) ;
           z[2] = (0cm,2cm) ;

           p := unitsquare xyscaled (9cm, 5cm) ;
           q := llcorner p--z[0]--z[1]--z[2]--cycle ;
           r := unitsquare xyscaled (7cm,3cm) shifted(2cm,2cm) ;
           b := z[2]--z[1]--ulcorner r--urcorner p--lrcorner r--z[1]--
           z[0]--llcorner p--cycle ;


           draw b anglestriped (1,45,2) withcolor cyan;
           draw q anglestriped (1,45,2) withcolor cyan;

           draw p ;

           label.llft("A", p) ;
           label.lrt("D", p) ;
           label.ulft("B", p) ;
           label.urt("C", p) ;
           label.lft("M", z[2]) ;
           label.ulft("N", z[1]) ;
           label.bot("P", z[0]) ;
           label.top("J", ulcorner r) ;
           label.rt("I", lrcorner r) ;
           label.bot(btex $x$ etex,(llcorner p+z[0])/2);
           label.lft(btex $x$ etex,(llcorner p+z[2])/2);
        \stopMPcode

\stoptext

[-- Attachment #1.2: Type: text/html, Size: 1915 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] 5+ messages in thread

* [NTG-context] Re: Strange behavior with anglestriped()
  2023-11-19 17:56 [NTG-context] Strange behavior with anglestriped() Fabrice Couvreur
@ 2023-11-19 21:54 ` Otared Kavian
  2023-11-20 19:47   ` Fabrice Couvreur
  0 siblings, 1 reply; 5+ messages in thread
From: Otared Kavian @ 2023-11-19 21:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2314 bytes --]

Hi Fabrice,

It seems to me the colors are the same, although they may appear different at first sight because the « with » of the lines are different (the width is larger in the lower rectangle).

I attach the PDF created with your code.

Best regards: Otared



> On 19 Nov 2023, at 18:56, Fabrice Couvreur <fabrice1.couvreur@gmail.com> wrote:
> 
> Hi,
> I don't understand why the hatching of the two rectangles is not the same color. 
> Thanks for your help.
> Fabrice
> 
> \starttext
>         \setupbodyfont[8pt]
>         \startMPcode
>            path p, q, r, b ;
>          
>            z[0] = (2cm,0cm) ;
>            z[1] = (2cm,2cm) ;
>            z[2] = (0cm,2cm) ;
> 
>            p := unitsquare xyscaled (9cm, 5cm) ;
>            q := llcorner p--z[0]--z[1]--z[2]--cycle ;
>            r := unitsquare xyscaled (7cm,3cm) shifted(2cm,2cm) ;
>            b := z[2]--z[1]--ulcorner r--urcorner p--lrcorner r--z[1]--
>            z[0]--llcorner p--cycle ;
>            
>           
>            draw b anglestriped (1,45,2) withcolor cyan;
>            draw q anglestriped (1,45,2) withcolor cyan;
>            
>            draw p ;
>            
>            label.llft("A", p) ;
>            label.lrt("D", p) ;
>            label.ulft("B", p) ;
>            label.urt("C", p) ;
>            label.lft("M", z[2]) ;
>            label.ulft("N", z[1]) ;
>            label.bot("P", z[0]) ;
>            label.top("J", ulcorner r) ;
>            label.rt("I", lrcorner r) ;
>            label.bot(btex $x$ etex,(llcorner p+z[0])/2);
>            label.lft(btex $x$ etex,(llcorner p+z[2])/2);
>         \stopMPcode
> 
> \stoptext
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

Otared Kavian
e-mail: otared@gmail.com
Phone: +33 6 88 26 70 95





[-- Attachment #1.2.1: Type: text/html, Size: 671 bytes --]

[-- Attachment #1.2.2: hachage-couleur.pdf --]
[-- Type: application/pdf, Size: 11188 bytes --]

[-- Attachment #1.2.3: Type: text/html, Size: 5057 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] 5+ messages in thread

* [NTG-context] Re: Strange behavior with anglestriped()
  2023-11-20 19:47   ` Fabrice Couvreur
@ 2023-11-20 19:42     ` Fabrice L
  2023-11-21 19:06       ` Fabrice Couvreur
  0 siblings, 1 reply; 5+ messages in thread
From: Fabrice L @ 2023-11-20 19:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 4715 bytes --]

Hi,

Fabrice, you have a problem with the definition of the path b: this path include q and b. To see this, replace your lines with :

           draw q anglestriped (1,45,2) withcolor cyan;
           draw b anglestriped (1,45,2) withcolor red;

And you will see that the path b is drawn twice : once in red, once in cyan. So if you change your instructions to :

           draw q anglestriped (1,45,2) withcolor cyan;
           draw r anglestriped (1,45,2) withcolor cyan;

This will correct the problem, because each path is now drawn only once. 

Fabrice. 

> Le 20 nov. 2023 à 14:47, Fabrice Couvreur <fabrice1.couvreur@gmail.com> a écrit :
> 
> Hi Otared,
> It's true that the color seems identical.
> Thanks.
> Fabrice
> 
> Le dim. 19 nov. 2023 à 21:55, Otared Kavian <otared@gmail.com <mailto:otared@gmail.com>> a écrit :
>> Hi Fabrice,
>> 
>> It seems to me the colors are the same, although they may appear different at first sight because the « with » of the lines are different (the width is larger in the lower rectangle).
>> 
>> I attach the PDF created with your code.
>> 
>> Best regards: Otared
>> 
>> 
>> 
>>> On 19 Nov 2023, at 18:56, Fabrice Couvreur <fabrice1.couvreur@gmail.com <mailto:fabrice1.couvreur@gmail.com>> wrote:
>>> 
>>> Hi,
>>> I don't understand why the hatching of the two rectangles is not the same color. 
>>> Thanks for your help.
>>> Fabrice
>>> 
>>> \starttext
>>>         \setupbodyfont[8pt]
>>>         \startMPcode
>>>            path p, q, r, b ;
>>>          
>>>            z[0] = (2cm,0cm) ;
>>>            z[1] = (2cm,2cm) ;
>>>            z[2] = (0cm,2cm) ;
>>> 
>>>            p := unitsquare xyscaled (9cm, 5cm) ;
>>>            q := llcorner p--z[0]--z[1]--z[2]--cycle ;
>>>            r := unitsquare xyscaled (7cm,3cm) shifted(2cm,2cm) ;
>>>            b := z[2]--z[1]--ulcorner r--urcorner p--lrcorner r--z[1]--
>>>            z[0]--llcorner p--cycle ;
>>>            
>>>           
>>>            draw b anglestriped (1,45,2) withcolor cyan;
>>>            draw q anglestriped (1,45,2) withcolor cyan;
>>>            
>>>            draw p ;
>>>            
>>>            label.llft("A", p) ;
>>>            label.lrt("D", p) ;
>>>            label.ulft("B", p) ;
>>>            label.urt("C", p) ;
>>>            label.lft("M", z[2]) ;
>>>            label.ulft("N", z[1]) ;
>>>            label.bot("P", z[0]) ;
>>>            label.top("J", ulcorner r) ;
>>>            label.rt("I", lrcorner r) ;
>>>            label.bot(btex $x$ etex,(llcorner p+z[0])/2);
>>>            label.lft(btex $x$ etex,(llcorner p+z[2])/2);
>>>         \stopMPcode
>>> 
>>> \stoptext
>>> 
>>> ___________________________________________________________________________________
>>> If your question is of interest to others as well, please add an entry to the Wiki!
>>> 
>>> maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
>>> webpage  : https://www.pragma-ade.nl <https://www.pragma-ade.nl/> / https://context.aanhet.net <https://context.aanhet.net/> (mirror)
>>> archive  : https://github.com/contextgarden/context
>>> wiki     : https://wiki.contextgarden.net <https://wiki.contextgarden.net/>
>>> ___________________________________________________________________________________
>> 
>> Otared Kavian
>> e-mail: otared@gmail.com <mailto:otared@gmail.com>
>> Phone: +33 6 88 26 70 95
>> 
>> 
>> 
>> 
>> ___________________________________________________________________________________
>> If your question is of interest to others as well, please add an entry to the Wiki!
>> 
>> maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
>> webpage  : https://www.pragma-ade.nl <https://www.pragma-ade.nl/> / https://context.aanhet.net <https://context.aanhet.net/> (mirror)
>> archive  : https://github.com/contextgarden/context
>> wiki     : https://wiki.contextgarden.net <https://wiki.contextgarden.net/>
>> ___________________________________________________________________________________
> ___________________________________________________________________________________
> 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: 8048 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] 5+ messages in thread

* [NTG-context] Re: Strange behavior with anglestriped()
  2023-11-19 21:54 ` [NTG-context] " Otared Kavian
@ 2023-11-20 19:47   ` Fabrice Couvreur
  2023-11-20 19:42     ` Fabrice L
  0 siblings, 1 reply; 5+ messages in thread
From: Fabrice Couvreur @ 2023-11-20 19:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 3023 bytes --]

Hi Otared,
It's true that the color seems identical.
Thanks.
Fabrice

Le dim. 19 nov. 2023 à 21:55, Otared Kavian <otared@gmail.com> a écrit :

> Hi Fabrice,
>
> It seems to me the colors are the same, although they may appear different
> at first sight because the « with » of the lines are different (the width
> is larger in the lower rectangle).
>
> I attach the PDF created with your code.
>
> Best regards: Otared
>
>
>
> On 19 Nov 2023, at 18:56, Fabrice Couvreur <fabrice1.couvreur@gmail.com>
> wrote:
>
> Hi,
> I don't understand why the hatching of the two rectangles is not the same
> color.
> Thanks for your help.
> Fabrice
>
> \starttext
>         \setupbodyfont[8pt]
>         \startMPcode
>            path p, q, r, b ;
>
>            z[0] = (2cm,0cm) ;
>            z[1] = (2cm,2cm) ;
>            z[2] = (0cm,2cm) ;
>
>            p := unitsquare xyscaled (9cm, 5cm) ;
>            q := llcorner p--z[0]--z[1]--z[2]--cycle ;
>            r := unitsquare xyscaled (7cm,3cm) shifted(2cm,2cm) ;
>            b := z[2]--z[1]--ulcorner r--urcorner p--lrcorner r--z[1]--
>            z[0]--llcorner p--cycle ;
>
>
>            draw b anglestriped (1,45,2) withcolor cyan;
>            draw q anglestriped (1,45,2) withcolor cyan;
>
>            draw p ;
>
>            label.llft("A", p) ;
>            label.lrt("D", p) ;
>            label.ulft("B", p) ;
>            label.urt("C", p) ;
>            label.lft("M", z[2]) ;
>            label.ulft("N", z[1]) ;
>            label.bot("P", z[0]) ;
>            label.top("J", ulcorner r) ;
>            label.rt("I", lrcorner r) ;
>            label.bot(btex $x$ etex,(llcorner p+z[0])/2);
>            label.lft(btex $x$ etex,(llcorner p+z[2])/2);
>         \stopMPcode
>
> \stoptext
>
>
> ___________________________________________________________________________________
> 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
>
> ___________________________________________________________________________________
>
>
> Otared Kavian
> e-mail: otared@gmail.com <otared@gmail.com>
> Phone: +33 6 88 26 70 95
>
>
>
>
>
> ___________________________________________________________________________________
> 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: 5525 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] 5+ messages in thread

* [NTG-context] Re: Strange behavior with anglestriped()
  2023-11-20 19:42     ` Fabrice L
@ 2023-11-21 19:06       ` Fabrice Couvreur
  0 siblings, 0 replies; 5+ messages in thread
From: Fabrice Couvreur @ 2023-11-21 19:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 5079 bytes --]

Hi Fabrice,
Exactly, thanks for the correction.
Fabrice

Le lun. 20 nov. 2023 à 19:43, Fabrice L <fabrice.alpha@gmail.com> a écrit :

> Hi,
>
> Fabrice, you have a problem with the definition of the path b: this path
> include q and b. To see this, replace your lines with :
>
>            draw q anglestriped (1,45,2) withcolor cyan;
>            draw b anglestriped (1,45,2) withcolor red;
>
> And you will see that the path b is drawn twice : once in red, once in
> cyan. So if you change your instructions to :
>
>            draw q anglestriped (1,45,2) withcolor cyan;
>            draw r anglestriped (1,45,2) withcolor cyan;
>
> This will correct the problem, because each path is now drawn only once.
>
> Fabrice.
>
> Le 20 nov. 2023 à 14:47, Fabrice Couvreur <fabrice1.couvreur@gmail.com> a
> écrit :
>
> Hi Otared,
> It's true that the color seems identical.
> Thanks.
> Fabrice
>
> Le dim. 19 nov. 2023 à 21:55, Otared Kavian <otared@gmail.com> a écrit :
>
>> Hi Fabrice,
>>
>> It seems to me the colors are the same, although they may appear
>> different at first sight because the « with » of the lines are different
>> (the width is larger in the lower rectangle).
>>
>> I attach the PDF created with your code.
>>
>> Best regards: Otared
>>
>>
>>
>> On 19 Nov 2023, at 18:56, Fabrice Couvreur <fabrice1.couvreur@gmail.com>
>> wrote:
>>
>> Hi,
>> I don't understand why the hatching of the two rectangles is not the same
>> color.
>> Thanks for your help.
>> Fabrice
>>
>> \starttext
>>         \setupbodyfont[8pt]
>>         \startMPcode
>>            path p, q, r, b ;
>>
>>            z[0] = (2cm,0cm) ;
>>            z[1] = (2cm,2cm) ;
>>            z[2] = (0cm,2cm) ;
>>
>>            p := unitsquare xyscaled (9cm, 5cm) ;
>>            q := llcorner p--z[0]--z[1]--z[2]--cycle ;
>>            r := unitsquare xyscaled (7cm,3cm) shifted(2cm,2cm) ;
>>            b := z[2]--z[1]--ulcorner r--urcorner p--lrcorner r--z[1]--
>>            z[0]--llcorner p--cycle ;
>>
>>
>>            draw b anglestriped (1,45,2) withcolor cyan;
>>            draw q anglestriped (1,45,2) withcolor cyan;
>>
>>            draw p ;
>>
>>            label.llft("A", p) ;
>>            label.lrt("D", p) ;
>>            label.ulft("B", p) ;
>>            label.urt("C", p) ;
>>            label.lft("M", z[2]) ;
>>            label.ulft("N", z[1]) ;
>>            label.bot("P", z[0]) ;
>>            label.top("J", ulcorner r) ;
>>            label.rt("I", lrcorner r) ;
>>            label.bot(btex $x$ etex,(llcorner p+z[0])/2);
>>            label.lft(btex $x$ etex,(llcorner p+z[2])/2);
>>         \stopMPcode
>>
>> \stoptext
>>
>>
>> ___________________________________________________________________________________
>> 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
>>
>> ___________________________________________________________________________________
>>
>>
>> Otared Kavian
>> e-mail: otared@gmail.com <otared@gmail.com>
>> Phone: +33 6 88 26 70 95
>>
>>
>>
>>
>>
>> ___________________________________________________________________________________
>> 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
>>
>> ___________________________________________________________________________________
>>
>
> ___________________________________________________________________________________
> 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
>
> ___________________________________________________________________________________
>
>
>
> ___________________________________________________________________________________
> 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: 8943 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] 5+ messages in thread

end of thread, other threads:[~2023-11-21 18:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-19 17:56 [NTG-context] Strange behavior with anglestriped() Fabrice Couvreur
2023-11-19 21:54 ` [NTG-context] " Otared Kavian
2023-11-20 19:47   ` Fabrice Couvreur
2023-11-20 19:42     ` Fabrice L
2023-11-21 19:06       ` Fabrice Couvreur

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).