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