* About macro numberstriped () @ 2022-09-27 17:49 Fabrice Couvreur via ntg-context 2022-09-27 20:04 ` Hans Hagen via ntg-context 0 siblings, 1 reply; 17+ messages in thread From: Fabrice Couvreur via ntg-context @ 2022-09-27 17:49 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Fabrice Couvreur [-- Attachment #1.1: Type: text/plain, Size: 761 bytes --] Hello, I notice a strange behavior of the macro numberstriped ( ). Thanks. Fabrice \starttext \switchtobodyfont[9pt] \startMPcode path p, q, r, b ; p := unitsquare xyscaled (4cm,4cm) ; z[0] = (2cm,0cm) ; z[1] = (2cm,4cm) ; z[2] = (0cm,2cm) ; q := llcorner p--z[0]--z[1]--z[2]--cycle ; r := unitsquare xyscaled (1cm,1cm) shifted(0,3cm) ; b := unitsquare xyscaled (3cm,3cm) shifted(1cm,0) ; draw p ; draw r withcolor red; draw r numberstriped (.25,20,5) withcolor magenta ; draw b numberstriped (.25,20,5) withcolor magenta ; label.llft("D", p) ; label.lrt("C", p) ; label.ulft("A", p) ; label.urt("B", p) ; label.urt("P", lrcorner r) ; label.lft("Q", llcorner r) ; label.top("M", urcorner r) ; \stopMPcode \stoptext [-- Attachment #1.2: Type: text/html, Size: 1194 bytes --] [-- Attachment #2: hash.png --] [-- Type: image/png, Size: 34233 bytes --] [-- Attachment #3: Type: text/plain, Size: 496 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: About macro numberstriped () 2022-09-27 17:49 About macro numberstriped () Fabrice Couvreur via ntg-context @ 2022-09-27 20:04 ` Hans Hagen via ntg-context 2022-09-28 13:11 ` Fabrice Couvreur via ntg-context 0 siblings, 1 reply; 17+ messages in thread From: Hans Hagen via ntg-context @ 2022-09-27 20:04 UTC (permalink / raw) To: Fabrice Couvreur via ntg-context; +Cc: Hans Hagen On 9/27/2022 7:49 PM, Fabrice Couvreur via ntg-context wrote: > Hello, > I notice a strange behavior of the macro numberstriped ( ). > Thanks. > Fabrice > > \starttext > \switchtobodyfont[9pt] > \startMPcode > > path p, q, r, b ; > p := unitsquare xyscaled (4cm,4cm) ; > z[0] = (2cm,0cm) ; > z[1] = (2cm,4cm) ; > z[2] = (0cm,2cm) ; > q := llcorner p--z[0]--z[1]--z[2]--cycle ; > r := unitsquare xyscaled (1cm,1cm) shifted(0,3cm) ; > b := unitsquare xyscaled (3cm,3cm) shifted(1cm,0) ; > draw p ; > draw r withcolor red; > draw r numberstriped (.25,20,5) withcolor magenta ; > draw b numberstriped (.25,20,5) withcolor magenta ; > label.llft("D", p) ; > label.lrt("C", p) ; > label.ulft("A", p) ; > label.urt("B", p) ; > label.urt("P", lrcorner r) ; > label.lft("Q", llcorner r) ; > label.top("M", urcorner r) ; > > \stopMPcode > \stoptext you need to find a volunteer to make the pattern have the two corner blobs \starttext \startMPcode path p, q, r, b ; path p ; p := unitsquare xyscaled (4cm,4cm) ; draw p ; draw p withpattern image ( draw (llcorner unitsquare -- urcorner unitsquare) scaled 5mm ; % how to get the corner dots ) withpatternscale 1/16 withpen pencircle scaled 1mm ; \stopMPcode \stoptext ----------------------------------------------------------------- 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://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: About macro numberstriped () 2022-09-27 20:04 ` Hans Hagen via ntg-context @ 2022-09-28 13:11 ` Fabrice Couvreur via ntg-context 2022-09-28 13:29 ` Hans Hagen via ntg-context 0 siblings, 1 reply; 17+ messages in thread From: Fabrice Couvreur via ntg-context @ 2022-09-28 13:11 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Fabrice Couvreur [-- Attachment #1.1: Type: text/plain, Size: 2677 bytes --] Hi Hans, Thank you for this solution which is an approach that I did not know. Fabrice PS : What is the exact meaning of the word "blobs" because my English is average ? Le mar. 27 sept. 2022 à 22:04, Hans Hagen via ntg-context < ntg-context@ntg.nl> a écrit : > On 9/27/2022 7:49 PM, Fabrice Couvreur via ntg-context wrote: > > Hello, > > I notice a strange behavior of the macro numberstriped ( ). > > Thanks. > > Fabrice > > > > \starttext > > \switchtobodyfont[9pt] > > \startMPcode > > > > path p, q, r, b ; > > p := unitsquare xyscaled (4cm,4cm) ; > > z[0] = (2cm,0cm) ; > > z[1] = (2cm,4cm) ; > > z[2] = (0cm,2cm) ; > > q := llcorner p--z[0]--z[1]--z[2]--cycle ; > > r := unitsquare xyscaled (1cm,1cm) shifted(0,3cm) ; > > b := unitsquare xyscaled (3cm,3cm) shifted(1cm,0) ; > > draw p ; > > draw r withcolor red; > > draw r numberstriped (.25,20,5) withcolor magenta ; > > draw b numberstriped (.25,20,5) withcolor magenta ; > > label.llft("D", p) ; > > label.lrt("C", p) ; > > label.ulft("A", p) ; > > label.urt("B", p) ; > > label.urt("P", lrcorner r) ; > > label.lft("Q", llcorner r) ; > > label.top("M", urcorner r) ; > > > > \stopMPcode > > \stoptext > you need to find a volunteer to make the pattern have the two corner blobs > > \starttext > > \startMPcode > path p, q, r, b ; > path p ; p := unitsquare xyscaled (4cm,4cm) ; > draw p ; > draw p > withpattern image ( > draw (llcorner unitsquare -- urcorner unitsquare) scaled 5mm ; > % how to get the corner dots > ) > withpatternscale 1/16 > withpen pencircle scaled 1mm > ; > \stopMPcode > > \stoptext > > > ----------------------------------------------------------------- > 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://www.ntg.nl/mailman/listinfo/ntg-context > webpage : https://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : https://contextgarden.net > > ___________________________________________________________________________________ > [-- Attachment #1.2: Type: text/html, Size: 4221 bytes --] [-- Attachment #2: Type: text/plain, Size: 496 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: About macro numberstriped () 2022-09-28 13:11 ` Fabrice Couvreur via ntg-context @ 2022-09-28 13:29 ` Hans Hagen via ntg-context 2022-09-28 19:04 ` Henning Hraban Ramm via ntg-context 0 siblings, 1 reply; 17+ messages in thread From: Hans Hagen via ntg-context @ 2022-09-28 13:29 UTC (permalink / raw) To: Fabrice Couvreur via ntg-context; +Cc: Hans Hagen On 9/28/2022 3:11 PM, Fabrice Couvreur via ntg-context wrote: > Hi Hans, > Thank you for this solution which is an approach that I did not know. > Fabrice > > PS : What is the exact meaning of the word "blobs" because my English is > average ? in order to get 'lines' you need to fill the two opposing corners with "blobs of ink" Hans (who's dutch is better than his english) ----------------------------------------------------------------- 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://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: About macro numberstriped () 2022-09-28 13:29 ` Hans Hagen via ntg-context @ 2022-09-28 19:04 ` Henning Hraban Ramm via ntg-context 2022-10-01 17:42 ` Fabrice Couvreur via ntg-context 0 siblings, 1 reply; 17+ messages in thread From: Henning Hraban Ramm via ntg-context @ 2022-09-28 19:04 UTC (permalink / raw) To: Hans Hagen via ntg-context; +Cc: Henning Hraban Ramm Am 28.09.22 um 15:29 schrieb Hans Hagen via ntg-context: > On 9/28/2022 3:11 PM, Fabrice Couvreur via ntg-context wrote: >> PS : What is the exact meaning of the word "blobs" because my English >> is average ? > in order to get 'lines' you need to fill the two opposing corners with > "blobs of ink" Otherwise, a BLOB is a “binary large object”, e.g. if you save image data to a database. Hraban ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: About macro numberstriped () 2022-09-28 19:04 ` Henning Hraban Ramm via ntg-context @ 2022-10-01 17:42 ` Fabrice Couvreur via ntg-context 2022-10-01 19:46 ` Mikael Sundqvist via ntg-context 0 siblings, 1 reply; 17+ messages in thread From: Fabrice Couvreur via ntg-context @ 2022-10-01 17:42 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Fabrice Couvreur [-- Attachment #1.1: Type: text/plain, Size: 2484 bytes --] Hi Hans, When the rectangles are not identical, how to have the same type of hatching in both ? Thanks. Fabrice \starttext \startlinecorrection[blank] \startmidaligned \switchtobodyfont[9pt] \startMPcode path p, q, r, b ; p := unitsquare xyscaled (4cm,4cm) ; z[0] = (2cm,0cm) ; z[1] = (2cm,4cm) ; z[2] = (0cm,2cm) ; q := llcorner p--z[0]--z[1]--z[2]--cycle ; r := unitsquare xyscaled (1cm,1cm) shifted(0,3cm) ; b := unitsquare xyscaled (3cm,3cm) shifted(1cm,0) ; draw r withpattern image ( draw (llcorner unitsquare -- urcorner unitsquare) scaled 5mm ; % how to get the corner dots ) withpatternscale 1/8 withpen pencircle scaled 1pt withcolor cyan; ; draw b withpattern image ( draw (llcorner unitsquare -- urcorner unitsquare) scaled 5mm ; % how to get the corner dots ) withpatternscale 1/16 withpen pencircle scaled 1pt withcolor cyan; ; draw p; draw b; draw r; label.llft("D", p) ; label.lrt("C", p) ; label.ulft("A", p) ; label.urt("B", p) ; label.urt("P", lrcorner r) ; label.lft("Q", llcorner r) ; label.top("M", urcorner r) ; \stopMPcode \stopmidaligned \stoplinecorrection \stoptext Le mer. 28 sept. 2022 à 21:05, Henning Hraban Ramm via ntg-context < ntg-context@ntg.nl> a écrit : > Am 28.09.22 um 15:29 schrieb Hans Hagen via ntg-context: > > On 9/28/2022 3:11 PM, Fabrice Couvreur via ntg-context wrote: > >> PS : What is the exact meaning of the word "blobs" because my English > >> is average ? > > in order to get 'lines' you need to fill the two opposing corners with > > "blobs of ink" > > Otherwise, a BLOB is a “binary large object”, e.g. if you save image > data to a database. > > Hraban > > > ___________________________________________________________________________________ > If your question is of interest to others as well, please add an entry to > the Wiki! > > maillist : ntg-context@ntg.nl / > https://www.ntg.nl/mailman/listinfo/ntg-context > webpage : https://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : https://contextgarden.net > > ___________________________________________________________________________________ > [-- Attachment #1.2: Type: text/html, Size: 4153 bytes --] [-- Attachment #2: Type: text/plain, Size: 496 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: About macro numberstriped () 2022-10-01 17:42 ` Fabrice Couvreur via ntg-context @ 2022-10-01 19:46 ` Mikael Sundqvist via ntg-context 2022-10-02 8:55 ` Fabrice Couvreur via ntg-context 0 siblings, 1 reply; 17+ messages in thread From: Mikael Sundqvist via ntg-context @ 2022-10-01 19:46 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Mikael Sundqvist Hi, Is this what you are looking for? On Sat, Oct 1, 2022 at 7:43 PM Fabrice Couvreur via ntg-context <ntg-context@ntg.nl> wrote: > > Hi Hans, > When the rectangles are not identical, how to have the same type of hatching in both ? > Thanks. > Fabrice > > > \starttext > \startlinecorrection[blank] > \startmidaligned > \switchtobodyfont[9pt] > \startMPcode > path p, q, r, b ; > p := unitsquare xyscaled (4cm,4cm) ; > z[0] = (2cm,0cm) ; > z[1] = (2cm,4cm) ; > z[2] = (0cm,2cm) ; > q := llcorner p--z[0]--z[1]--z[2]--cycle ; > r := unitsquare xyscaled (1cm,1cm) shifted(0,3cm) ; > b := unitsquare xyscaled (3cm,3cm) shifted(1cm,0) ; > draw r anglestriped (1,45,2) withcolor cyan; draw b anglestriped (1,45,2) withcolor cyan; > > draw p; > draw b; > draw r; > > label.llft("D", p) ; > label.lrt("C", p) ; > label.ulft("A", p) ; > label.urt("B", p) ; > label.urt("P", lrcorner r) ; > label.lft("Q", llcorner r) ; > label.top("M", urcorner r) ; > > \stopMPcode > \stopmidaligned > \stoplinecorrection > \stoptext > > /Mikael ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: About macro numberstriped () 2022-10-01 19:46 ` Mikael Sundqvist via ntg-context @ 2022-10-02 8:55 ` Fabrice Couvreur via ntg-context 2022-10-02 9:20 ` Floris van Manen via ntg-context 0 siblings, 1 reply; 17+ messages in thread From: Fabrice Couvreur via ntg-context @ 2022-10-02 8:55 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Fabrice Couvreur [-- Attachment #1.1: Type: text/plain, Size: 2368 bytes --] Hi, Initially, there was a bug with maro numberstriped() and Hans suggested another sensible approach to me, but you don't get the same shape of the hatches depending on the dimensions of the squares. Your solution works perfectly but I'm trying to understand the action of the parameters: the first ? the second represents the angle in degrees that the segments make the third represents the gap between two segments Thanks Fabrice Le sam. 1 oct. 2022 à 21:46, Mikael Sundqvist via ntg-context < ntg-context@ntg.nl> a écrit : > Hi, > > Is this what you are looking for? > > On Sat, Oct 1, 2022 at 7:43 PM Fabrice Couvreur via ntg-context > <ntg-context@ntg.nl> wrote: > > > > Hi Hans, > > When the rectangles are not identical, how to have the same type of > hatching in both ? > > Thanks. > > Fabrice > > > > > > \starttext > > \startlinecorrection[blank] > > \startmidaligned > > \switchtobodyfont[9pt] > > \startMPcode > > path p, q, r, b ; > > p := unitsquare xyscaled (4cm,4cm) ; > > z[0] = (2cm,0cm) ; > > z[1] = (2cm,4cm) ; > > z[2] = (0cm,2cm) ; > > q := llcorner p--z[0]--z[1]--z[2]--cycle ; > > r := unitsquare xyscaled (1cm,1cm) shifted(0,3cm) ; > > b := unitsquare xyscaled (3cm,3cm) shifted(1cm,0) ; > > > > draw r anglestriped (1,45,2) withcolor cyan; > draw b anglestriped (1,45,2) withcolor cyan; > > > > > draw p; > > draw b; > > draw r; > > > > label.llft("D", p) ; > > label.lrt("C", p) ; > > label.ulft("A", p) ; > > label.urt("B", p) ; > > label.urt("P", lrcorner r) ; > > label.lft("Q", llcorner r) ; > > label.top("M", urcorner r) ; > > > > \stopMPcode > > \stopmidaligned > > \stoplinecorrection > > \stoptext > > > > > > /Mikael > > ___________________________________________________________________________________ > If your question is of interest to others as well, please add an entry to > the Wiki! > > maillist : ntg-context@ntg.nl / > https://www.ntg.nl/mailman/listinfo/ntg-context > webpage : https://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : https://contextgarden.net > > ___________________________________________________________________________________ > [-- Attachment #1.2: Type: text/html, Size: 3712 bytes --] [-- Attachment #2: Type: text/plain, Size: 496 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: About macro numberstriped () 2022-10-02 8:55 ` Fabrice Couvreur via ntg-context @ 2022-10-02 9:20 ` Floris van Manen via ntg-context 2022-10-02 9:49 ` Fabrice Couvreur via ntg-context 2022-10-02 9:52 ` Hans Hagen via ntg-context 0 siblings, 2 replies; 17+ messages in thread From: Floris van Manen via ntg-context @ 2022-10-02 9:20 UTC (permalink / raw) To: ntg-context; +Cc: Floris van Manen [-- Attachment #1: Type: text/plain, Size: 997 bytes --] On 02/10/2022 10:55, Fabrice Couvreur via ntg-context wrote: > Initially, there was a bug with maro numberstriped() and Hans suggested > another sensible approach to me, but you don't get the same shape of the > hatches depending on the dimensions of the squares. some unexpected side effect show up when the unitsquare is xyscaled to a rectangle like (2.5cm,1cm) it seems related to the angle chosen e.g. \startMPcode path p, q, r, b ; p := unitsquare xyscaled (4cm,4cm) ; q := unitsquare xyscaled (1cm,1cm) shifted(0,3cm) ; r := unitsquare xyscaled (2.5cm,1cm) shifted(1cm,3cm) ; b := unitsquare xyscaled (3cm,3cm) shifted(1cm,0) ; draw r anglestriped (1,35,2) withcolor red; draw q anglestriped (1,35,2) withcolor green; draw b anglestriped (1,35,2) withcolor cyan; draw p; draw q; draw b; draw r; label.llft("D", p) ; label.lrt("C", p) ; label.ulft("A", p) ; label.urt("B", p) ; label.urt("P", lrcorner r) ; label.lft("Q", llcorner r) ; label.top("M", urcorner r) ; \stopMPcode [-- Attachment #2: Screenshot from 2022-10-02 11-15-45.png --] [-- Type: image/png, Size: 48177 bytes --] [-- Attachment #3: Type: text/plain, Size: 496 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: About macro numberstriped () 2022-10-02 9:20 ` Floris van Manen via ntg-context @ 2022-10-02 9:49 ` Fabrice Couvreur via ntg-context 2022-10-02 9:52 ` Hans Hagen via ntg-context 1 sibling, 0 replies; 17+ messages in thread From: Fabrice Couvreur via ntg-context @ 2022-10-02 9:49 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Fabrice Couvreur [-- Attachment #1.1: Type: text/plain, Size: 2513 bytes --] Not only, it is also true with the code below : \startMPcode path p, q, r, b ; p := unitsquare xyscaled (4cm,4cm) ; z[0] = (2cm,0cm) ; z[1] = (2cm,4cm) ; z[2] = (0cm,2cm) ; q := llcorner p--z[0]--z[1]--z[2]--cycle ; r := unitsquare xyscaled (1cm,1cm) shifted(0,3cm) ; b := (0cm,0cm) -- lrcorner r -- lrcorner p -- cycle; draw r anglestriped (1,45,2) withcolor green; draw b anglestriped (1,45,2) withcolor green; draw b withcolor darkgreen; draw r withcolor darkgreen; draw p; label.llft("B", p) ; label.lrt("C", p) ; label.ulft("A", p) ; label.urt("D", p) ; label.urt("F", lrcorner r) ; label.lft("E", llcorner r) ; label.top("G", urcorner r) ; \stopMPcode Le dim. 2 oct. 2022 à 11:21, Floris van Manen via ntg-context < ntg-context@ntg.nl> a écrit : > > > On 02/10/2022 10:55, Fabrice Couvreur via ntg-context wrote: > > Initially, there was a bug with maro numberstriped() and Hans suggested > > another sensible approach to me, but you don't get the same shape of the > > hatches depending on the dimensions of the squares. > > some unexpected side effect show up when the unitsquare is xyscaled to a > rectangle like (2.5cm,1cm) > it seems related to the angle chosen > > e.g. > > > > \startMPcode > > path p, q, r, b ; > p := unitsquare xyscaled (4cm,4cm) ; > q := unitsquare xyscaled (1cm,1cm) shifted(0,3cm) ; > r := unitsquare xyscaled (2.5cm,1cm) shifted(1cm,3cm) ; > b := unitsquare xyscaled (3cm,3cm) shifted(1cm,0) ; > > draw r anglestriped (1,35,2) withcolor red; > draw q anglestriped (1,35,2) withcolor green; > draw b anglestriped (1,35,2) withcolor cyan; > draw p; > draw q; > draw b; > draw r; > > label.llft("D", p) ; > label.lrt("C", p) ; > label.ulft("A", p) ; > label.urt("B", p) ; > label.urt("P", lrcorner r) ; > label.lft("Q", llcorner r) ; > label.top("M", urcorner r) ; > > \stopMPcode > > ___________________________________________________________________________________ > If your question is of interest to others as well, please add an entry to > the Wiki! > > maillist : ntg-context@ntg.nl / > https://www.ntg.nl/mailman/listinfo/ntg-context > webpage : https://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : https://contextgarden.net > > ___________________________________________________________________________________ > [-- Attachment #1.2: Type: text/html, Size: 3848 bytes --] [-- Attachment #2: Type: text/plain, Size: 496 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: About macro numberstriped () 2022-10-02 9:20 ` Floris van Manen via ntg-context 2022-10-02 9:49 ` Fabrice Couvreur via ntg-context @ 2022-10-02 9:52 ` Hans Hagen via ntg-context 2022-10-02 11:02 ` Fabrice Couvreur via ntg-context 1 sibling, 1 reply; 17+ messages in thread From: Hans Hagen via ntg-context @ 2022-10-02 9:52 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Hans Hagen On 10/2/2022 11:20 AM, Floris van Manen via ntg-context wrote: > > > On 02/10/2022 10:55, Fabrice Couvreur via ntg-context wrote: >> Initially, there was a bug with maro numberstriped() and Hans >> suggested another sensible approach to me, but you don't get the same >> shape of the hatches depending on the dimensions of the squares. > > some unexpected side effect show up when the unitsquare is xyscaled to a > rectangle like (2.5cm,1cm) > it seems related to the angle chosen > > e.g. > > > > \startMPcode > > path p, q, r, b ; > p := unitsquare xyscaled (4cm,4cm) ; > q := unitsquare xyscaled (1cm,1cm) shifted(0,3cm) ; > r := unitsquare xyscaled (2.5cm,1cm) shifted(1cm,3cm) ; > b := unitsquare xyscaled (3cm,3cm) shifted(1cm,0) ; > > draw r anglestriped (1,35,2) withcolor red; > draw q anglestriped (1,35,2) withcolor green; > draw b anglestriped (1,35,2) withcolor cyan; > draw p; > draw q; > draw b; > draw r; > > label.llft("D", p) ; > label.lrt("C", p) ; > label.ulft("A", p) ; > label.urt("B", p) ; > label.urt("P", lrcorner r) ; > label.lft("Q", llcorner r) ; > label.top("M", urcorner r) ; > > \stopMPcode for that you can patch mp-tool.mpxl (l 676): maximum := max (xpart llcorner mask, xpart urcorner mask, ypart llcorner mask, ypart urcorner mask) ; minimum := min (xpart llcorner mask, xpart urcorner mask, ypart llcorner mask, ypart urcorner mask) ; % a hack: maximum := maximum + max(xpart urcorner shape, ypart urcorner shape); minimum := minimum - max(xpart urcorner shape, ypart urcorner shape); a bit overkill but it seems to work 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://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: About macro numberstriped () 2022-10-02 9:52 ` Hans Hagen via ntg-context @ 2022-10-02 11:02 ` Fabrice Couvreur via ntg-context 2022-10-02 11:38 ` Hans Hagen via ntg-context 0 siblings, 1 reply; 17+ messages in thread From: Fabrice Couvreur via ntg-context @ 2022-10-02 11:02 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Fabrice Couvreur [-- Attachment #1.1: Type: text/plain, Size: 4179 bytes --] I just tried but I got an empty file... Do we agree that I have to replace the two lines with the other two ? Regarding what you proposed, how to get the same type of hatching in both figures ? \startMPcode path p, q, r, b ; p := unitsquare xyscaled (4cm,4cm) ; z[0] = (2cm,0cm) ; z[1] = (2cm,4cm) ; z[2] = (0cm,2cm) ; q := llcorner p--z[0]--z[1]--z[2]--cycle ; r := unitsquare xyscaled (1cm,1cm) shifted(0,3cm) ; b := (0cm,0cm) -- lrcorner r -- lrcorner p -- cycle; draw r withpattern image ( draw (llcorner unitsquare -- urcorner unitsquare) scaled 5mm ; % how to get the corner dots ) withpatternscale 1/4 withpen pencircle scaled 1bp withcolor green ; draw b withpattern image ( draw (llcorner unitsquare -- urcorner unitsquare) scaled 5mm ; % how to get the corner dots ) withpatternscale 1/16 withpen pencircle scaled 1bp withcolor green ; draw b withpen pencircle scaled 1bp withcolor darkgreen; draw r withpen pencircle scaled 1bp withcolor darkgreen; draw p; label.llft("B", p) ; label.lrt("C", p) ; label.ulft("A", p) ; label.urt("D", p) ; label.urt("F", lrcorner r) ; label.lft("E", llcorner r) ; label.top("G", urcorner r) ; \stopMPcode Le dim. 2 oct. 2022 à 11:52, Hans Hagen via ntg-context <ntg-context@ntg.nl> a écrit : > On 10/2/2022 11:20 AM, Floris van Manen via ntg-context wrote: > > > > > > On 02/10/2022 10:55, Fabrice Couvreur via ntg-context wrote: > >> Initially, there was a bug with maro numberstriped() and Hans > >> suggested another sensible approach to me, but you don't get the same > >> shape of the hatches depending on the dimensions of the squares. > > > > some unexpected side effect show up when the unitsquare is xyscaled to a > > rectangle like (2.5cm,1cm) > > it seems related to the angle chosen > > > > e.g. > > > > > > > > \startMPcode > > > > path p, q, r, b ; > > p := unitsquare xyscaled (4cm,4cm) ; > > q := unitsquare xyscaled (1cm,1cm) shifted(0,3cm) ; > > r := unitsquare xyscaled (2.5cm,1cm) shifted(1cm,3cm) ; > > b := unitsquare xyscaled (3cm,3cm) shifted(1cm,0) ; > > > > draw r anglestriped (1,35,2) withcolor red; > > draw q anglestriped (1,35,2) withcolor green; > > draw b anglestriped (1,35,2) withcolor cyan; > > draw p; > > draw q; > > draw b; > > draw r; > > > > label.llft("D", p) ; > > label.lrt("C", p) ; > > label.ulft("A", p) ; > > label.urt("B", p) ; > > label.urt("P", lrcorner r) ; > > label.lft("Q", llcorner r) ; > > label.top("M", urcorner r) ; > > > > \stopMPcode > > for that you can patch mp-tool.mpxl (l 676): > > maximum := max (xpart llcorner mask, xpart urcorner mask, ypart > llcorner mask, ypart urcorner mask) ; > minimum := min (xpart llcorner mask, xpart urcorner mask, ypart > llcorner mask, ypart urcorner mask) ; > % a hack: > maximum := maximum + max(xpart urcorner shape, ypart urcorner shape); > minimum := minimum - max(xpart urcorner shape, ypart urcorner shape); > > a bit overkill but it seems to work > > 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://www.ntg.nl/mailman/listinfo/ntg-context > webpage : https://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : https://contextgarden.net > > ___________________________________________________________________________________ > [-- Attachment #1.2: Type: text/html, Size: 6009 bytes --] [-- Attachment #2: Type: text/plain, Size: 496 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: About macro numberstriped () 2022-10-02 11:02 ` Fabrice Couvreur via ntg-context @ 2022-10-02 11:38 ` Hans Hagen via ntg-context 2022-10-02 13:13 ` Fabrice Couvreur via ntg-context 0 siblings, 1 reply; 17+ messages in thread From: Hans Hagen via ntg-context @ 2022-10-02 11:38 UTC (permalink / raw) To: Fabrice Couvreur via ntg-context; +Cc: Hans Hagen On 10/2/2022 1:02 PM, Fabrice Couvreur via ntg-context wrote: > I just tried but I got an empty file... > Do we agree that I have to replace the two lines with the other two ? > Regarding what you proposed, how to get the same type of hatching in > both figures ? no, we disagree here; add them after the min/max lines 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://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: About macro numberstriped () 2022-10-02 11:38 ` Hans Hagen via ntg-context @ 2022-10-02 13:13 ` Fabrice Couvreur via ntg-context 2022-10-02 13:26 ` Hans Hagen via ntg-context 0 siblings, 1 reply; 17+ messages in thread From: Fabrice Couvreur via ntg-context @ 2022-10-02 13:13 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Fabrice Couvreur [-- Attachment #1.1: Type: text/plain, Size: 1458 bytes --] Ok, it works very well. Without wanting to insist, how to have the same hatching with two different figures ? Thanks. Fabrice Le dim. 2 oct. 2022 à 13:38, Hans Hagen via ntg-context <ntg-context@ntg.nl> a écrit : > On 10/2/2022 1:02 PM, Fabrice Couvreur via ntg-context wrote: > > I just tried but I got an empty file... > > Do we agree that I have to replace the two lines with the other two ? > > Regarding what you proposed, how to get the same type of hatching in > > both figures ? > no, we disagree here; add them after the min/max lines > > 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://www.ntg.nl/mailman/listinfo/ntg-context > webpage : https://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : https://contextgarden.net > > ___________________________________________________________________________________ > [-- Attachment #1.2: Type: text/html, Size: 2576 bytes --] [-- Attachment #2: Type: text/plain, Size: 496 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: About macro numberstriped () 2022-10-02 13:13 ` Fabrice Couvreur via ntg-context @ 2022-10-02 13:26 ` Hans Hagen via ntg-context 2022-10-02 13:36 ` Mikael Sundqvist via ntg-context 0 siblings, 1 reply; 17+ messages in thread From: Hans Hagen via ntg-context @ 2022-10-02 13:26 UTC (permalink / raw) To: ntg-context; +Cc: Hans Hagen On 10/2/2022 3:13 PM, Fabrice Couvreur via ntg-context wrote: > Ok, it works very well. Without wanting to insist, how to have the same > hatching with two different figures ? see upcoming mail from Mikael 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://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: About macro numberstriped () 2022-10-02 13:26 ` Hans Hagen via ntg-context @ 2022-10-02 13:36 ` Mikael Sundqvist via ntg-context 2022-10-02 16:15 ` Fabrice Couvreur via ntg-context 0 siblings, 1 reply; 17+ messages in thread From: Mikael Sundqvist via ntg-context @ 2022-10-02 13:36 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Mikael Sundqvist Hi, On Sun, Oct 2, 2022 at 3:26 PM Hans Hagen via ntg-context <ntg-context@ntg.nl> wrote: > > On 10/2/2022 3:13 PM, Fabrice Couvreur via ntg-context wrote: > > Ok, it works very well. Without wanting to insist, how to have the same > > hatching with two different figures ? > see upcoming mail from Mikael Oh, OK, here it goes. Hans will probably rename things if he adds this. \startMPpage[offset=1dk] vardef Stripe(expr p, a, d) = save thestripe ; picture thestripe ; thestripe := nullpicture ; save diag ; numeric diag ; diag := 0.55*( abs((urcorner boundingbox p) - (llcorner boundingbox p)) ) ; thestripe := image ( draw (-diag,0) -- (diag, 0) && for i = d step d until diag: (-diag, i) -- (diag, i) && (-diag,-i) -- (diag,-i) && endfor nocycle withpen currentpen ; ) ; thestripe := thestripe shifted center boundingbox p ; thestripe := thestripe rotatedaround(center boundingbox p, a) ; clip thestripe to p ; thestripe enddef ; path p ; p := fullcircle scaled 3cm && (unitsquare scaled 2cm shifted (4cm,4cm)) && cycle ; fill p withcolor darkred ; draw Stripe(p,30,.2cm) withcolor darkgreen ; path q ; q := fullsquare randomized 0.3 scaled 3cm yshifted 5cm ; fill q withcolor yellow ; draw Stripe(q,70,.3cm) withcolor red ; draw Stripe(p && q && cycle, -20, .5cm) withcolor "orange" ; draw p ; draw q ; \stopMPpage /Mikael ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: About macro numberstriped () 2022-10-02 13:36 ` Mikael Sundqvist via ntg-context @ 2022-10-02 16:15 ` Fabrice Couvreur via ntg-context 0 siblings, 0 replies; 17+ messages in thread From: Fabrice Couvreur via ntg-context @ 2022-10-02 16:15 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Fabrice Couvreur [-- Attachment #1.1: Type: text/plain, Size: 2156 bytes --] Hi Mikael, Great job ! Thanks Fabrice Le dim. 2 oct. 2022 à 15:37, Mikael Sundqvist via ntg-context < ntg-context@ntg.nl> a écrit : > Hi, > > On Sun, Oct 2, 2022 at 3:26 PM Hans Hagen via ntg-context > <ntg-context@ntg.nl> wrote: > > > > On 10/2/2022 3:13 PM, Fabrice Couvreur via ntg-context wrote: > > > Ok, it works very well. Without wanting to insist, how to have the same > > > hatching with two different figures ? > > see upcoming mail from Mikael > > Oh, OK, here it goes. Hans will probably rename things if he adds this. > > \startMPpage[offset=1dk] > > vardef Stripe(expr p, a, d) = > save thestripe ; picture thestripe ; thestripe := nullpicture ; > save diag ; numeric diag ; diag := 0.55*( abs((urcorner boundingbox p) > - (llcorner boundingbox p)) ) ; > thestripe := image ( > draw (-diag,0) -- (diag, 0) && > for i = d step d until diag: > (-diag, i) -- (diag, i) && > (-diag,-i) -- (diag,-i) && > endfor nocycle > withpen currentpen ; > ) ; > thestripe := thestripe shifted center boundingbox p ; > thestripe := thestripe rotatedaround(center boundingbox p, a) ; > clip thestripe to p ; > thestripe > enddef ; > > > path p ; p := fullcircle scaled 3cm && (unitsquare scaled 2cm shifted > (4cm,4cm)) && cycle ; > fill p withcolor darkred ; > draw Stripe(p,30,.2cm) withcolor darkgreen ; > > path q ; q := fullsquare randomized 0.3 scaled 3cm yshifted 5cm ; > fill q withcolor yellow ; > draw Stripe(q,70,.3cm) withcolor red ; > > draw Stripe(p && q && cycle, -20, .5cm) withcolor "orange" ; > > draw p ; > draw q ; > > \stopMPpage > > /Mikael > > ___________________________________________________________________________________ > If your question is of interest to others as well, please add an entry to > the Wiki! > > maillist : ntg-context@ntg.nl / > https://www.ntg.nl/mailman/listinfo/ntg-context > webpage : https://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : https://contextgarden.net > > ___________________________________________________________________________________ > [-- Attachment #1.2: Type: text/html, Size: 3444 bytes --] [-- Attachment #2: Type: text/plain, Size: 496 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2022-10-02 16:15 UTC | newest] Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-09-27 17:49 About macro numberstriped () Fabrice Couvreur via ntg-context 2022-09-27 20:04 ` Hans Hagen via ntg-context 2022-09-28 13:11 ` Fabrice Couvreur via ntg-context 2022-09-28 13:29 ` Hans Hagen via ntg-context 2022-09-28 19:04 ` Henning Hraban Ramm via ntg-context 2022-10-01 17:42 ` Fabrice Couvreur via ntg-context 2022-10-01 19:46 ` Mikael Sundqvist via ntg-context 2022-10-02 8:55 ` Fabrice Couvreur via ntg-context 2022-10-02 9:20 ` Floris van Manen via ntg-context 2022-10-02 9:49 ` Fabrice Couvreur via ntg-context 2022-10-02 9:52 ` Hans Hagen via ntg-context 2022-10-02 11:02 ` Fabrice Couvreur via ntg-context 2022-10-02 11:38 ` Hans Hagen via ntg-context 2022-10-02 13:13 ` Fabrice Couvreur via ntg-context 2022-10-02 13:26 ` Hans Hagen via ntg-context 2022-10-02 13:36 ` Mikael Sundqvist via ntg-context 2022-10-02 16:15 ` Fabrice Couvreur 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).