ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: Hatch an area with Metapost (Metafun)
       [not found] <mailman.6.1423507568.2410.ntg-context@ntg.nl>
@ 2015-02-10  0:07 ` John Kitzmiller
  2015-02-10 17:35   ` Fabrice
  0 siblings, 1 reply; 13+ messages in thread
From: John Kitzmiller @ 2015-02-10  0:07 UTC (permalink / raw)
  To: ntg-context; +Cc: couvreur.fabrice


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

On Feb 9, 2015, at 1:46 PM, Fabrice <couvreur.fabrice@wanadoo.fr <mailto:couvreur.fabrice@wanadoo.fr>> wrote:
> 
> Great, but I did not know the macro numberstriped. Is it a Metapost or 
> Metafun macro?



It is a MetaFun macro in mp-tool, afaik.

The idea of filling a path is sometimes clipping to a path. Here is a way to do your task with (almost) only MetaPost:

\startMPpage[offset=2mm]
 path p, q ;
 p := unitsquare scaled 4cm ;
 z1 = point 3.6 of p ;
 q := z1 -- urcorner p -- lrcorner p -- llcorner p -- cycle;
 for i = 8 step -.5 until 0:
   draw (i,0)*cm -- (i-4,4)*cm withpen pencircle scaled 2pt withcolor blue;
 endfor;
 clip currentpicture to q;
 draw p ; draw q ;
 label.llft("B", llcorner p) ;
 label.lrt ("C", lrcorner p) ;
 label.ulft("A", ulcorner p) ;
 label.urt ("D", urcorner p) ;
 label.lft ("M", z1) ;
\stopMPpage

…just in case it helps to clarify.

John

[-- Attachment #1.2: Type: text/html, Size: 3050 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Hatch an area with Metapost (Metafun)
  2015-02-10  0:07 ` Hatch an area with Metapost (Metafun) John Kitzmiller
@ 2015-02-10 17:35   ` Fabrice
  0 siblings, 0 replies; 13+ messages in thread
From: Fabrice @ 2015-02-10 17:35 UTC (permalink / raw)
  To: ntg-context

Hi John,
Thank you for that other solution with Metapost. I am in front of 
learning Metapost and Metafun, I'm still far from mastering!
Fabrice
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Hatch an area with Metapost (Metafun)
  2015-02-17 13:51 ` John Kitzmiller
@ 2015-02-17 15:18   ` Fabrice
  0 siblings, 0 replies; 13+ messages in thread
From: Fabrice @ 2015-02-17 15:18 UTC (permalink / raw)
  To: ntg-context

Hi John,
That's what I thought, some macros work indifferently in Metafun or 
Metapost, others not.
Thank you for the interest in my question.
Fabrice
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Hatch an area with Metapost (Metafun)
       [not found] <mailman.56.1424118064.2410.ntg-context@ntg.nl>
@ 2015-02-17 13:51 ` John Kitzmiller
  2015-02-17 15:18   ` Fabrice
  0 siblings, 1 reply; 13+ messages in thread
From: John Kitzmiller @ 2015-02-17 13:51 UTC (permalink / raw)
  To: ntg-context; +Cc: couvreur.fabrice


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

On Feb 16, 2015, at 3:21 PM, Fabrice Couvreur wrote:
> 
> This does not work with :
> 
> labeloffset := 2mm;



On Feb 09, 2015, Hans Hagen wrote:

\startMPpage[offset=2pt]
     path p, q, r ; pair z ;
     p := unitsquare scaled 4cm ;
     z := point 3.6 of p ;
     q := z--urcorner p ;
     r := q -- reverse bottomboundary p -- cycle ;
     draw p ;
     draw q ;
     draw r numberstriped (.25,10,5) withcolor blue ;
     draw thetextext.llft("B", llcorner p) ;
     draw thetextext.lrt ("C", lrcorner p) ;
     draw thetextext.ulft("A", ulcorner p) ;
     draw thetextext.urt ("D", urcorner p) ;
     draw thetextext.lft ("M", z) ;
\stopMPpage
Hello Fabrice,

labeloffset does not work with Hans’ code above using ‘draw thetextext’ for labels. It works with the label macro:

\startMPpage[offset=2mm]
 path p, q, r ; pair z ;
 p := unitsquare scaled 4cm ;
 z := point 3.6 of p ;
 q := z--urcorner p ;
 r := q -- reverse bottomboundary p -- cycle ;
 draw p ;
 draw q ;
 draw r numberstriped (.25,10,5) withcolor blue ;
 labeloffset := 2mm ;
 label.llft("B", llcorner p) ;
 label.lrt ("C", lrcorner p) ;
 label.ulft("A", ulcorner p) ;
 label.urt ("D", urcorner p) ;
 label.lft ("M", z) ;
 \stopMPpage

John


[-- Attachment #1.2: Type: text/html, Size: 3727 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Hatch an area with Metapost (Metafun)
  2015-02-15 12:20 ` John Kitzmiller
@ 2015-02-16 17:26   ` Fabrice
  0 siblings, 0 replies; 13+ messages in thread
From: Fabrice @ 2015-02-16 17:26 UTC (permalink / raw)
  To: ntg-context

Hi,
This does not work with :

labeloffset := 2mm;

Fabrice

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Hatch an area with Metapost (Metafun)
       [not found] <mailman.1.1423998001.1995.ntg-context@ntg.nl>
@ 2015-02-15 12:20 ` John Kitzmiller
  2015-02-16 17:26   ` Fabrice
  0 siblings, 1 reply; 13+ messages in thread
From: John Kitzmiller @ 2015-02-15 12:20 UTC (permalink / raw)
  To: ntg-context; +Cc: Fabrice


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

On Feb 15, 2015, at 6:00 AM, Fabrice <couvreur.fabrice@wanadoo.fr <mailto:couvreur.fabrice@wanadoo.fr>> wrote:
> 
> Thank you for this new example.
>> Try the mpost variable lableoffset := ? to adjust.
> 
> This does not seem to workwith lableoffset := 2mm.
> Fabrice

I spelled it wrong, sorry! It is labeloffset := 2mm;


[-- Attachment #1.2: Type: text/html, Size: 3821 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Hatch an area with Metapost (Metafun)
  2015-02-11 11:45 ` John Kitzmiller
@ 2015-02-15 10:18   ` Fabrice
  0 siblings, 0 replies; 13+ messages in thread
From: Fabrice @ 2015-02-15 10:18 UTC (permalink / raw)
  To: ntg-context

Hi John,
Sorry for the late reply!
Thank you for this new example.
> Try the mpost variable lableoffset := ? to adjust.

This does not seem to workwith lableoffset := 2mm.
Fabrice
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Hatch an area with Metapost (Metafun)
       [not found] <mailman.19.1423600942.2410.ntg-context@ntg.nl>
@ 2015-02-11 11:45 ` John Kitzmiller
  2015-02-15 10:18   ` Fabrice
  0 siblings, 1 reply; 13+ messages in thread
From: John Kitzmiller @ 2015-02-11 11:45 UTC (permalink / raw)
  To: ntg-context; +Cc: couvreur.fabrice


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

On Feb 10, 2015, at 3:42 PM, couvreur.fabrice@wanadoo.fr <mailto:couvreur.fabrice@wanadoo.fr> wrote:
> Is it  possible to have  some explanation of  the parameters of  the  macro  numberstriped(#1,#2,#3)  ?
> How to have  horizontal hatching  ?  (How to  change the slope  hatching  ?)

There is also anglestriped in mp-tool with some examples. The second argument changes the angle.

\startMPpage[offset=2mm]
  path p, q ;
  p := unitsquare scaled 4cm ;
  z1 = point 3.6 of p ;
  q := subpath (0,2) of p -- z1 -- cycle;
  q := q shifted(-4cm,-4cm);
  draw q anglestriped(1,180,6) withcolor blue;
  draw p ; 
\stopMPpage

(I have not yet found why the striped path q goes out of position. Looking at mp-tool may help.)

> I  just noticed  that the position of  labels  is not  quite the  same  when using  macros  and macro  Metafun Metapost:
> I think the  labels are  too near to the  corners of the square  with the  macro  Metafun.

Try the mpost variable lableoffset := ? to adjust.

HTH,
John

[-- Attachment #1.2: Type: text/html, Size: 4025 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Hatch an area with Metapost (Metafun)
  2015-02-09 19:36     ` Hans Hagen
@ 2015-02-10 18:00       ` Fabrice
  0 siblings, 0 replies; 13+ messages in thread
From: Fabrice @ 2015-02-10 18:00 UTC (permalink / raw)
  To: ntg-context

Hi Hans,
Is it  possible to have  some explanation of  the parameters of  the  macro  numberstriped(#1,#2,#3)  ?
How to have  horizontal hatching  ?  (How to  change the slope  hatching  ?)
I  just noticed  that the position of  labels  is not  quite the  same  when using  macros  and macro  Metafun  Metapost:
I think the  labels are  too near to the  corners of the square  with the  macro  Metafun.
thank you,
Fabrice

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Hatch an area with Metapost (Metafun)
  2015-02-09 18:22   ` Fabrice
@ 2015-02-09 19:36     ` Hans Hagen
  2015-02-10 18:00       ` Fabrice
  0 siblings, 1 reply; 13+ messages in thread
From: Hans Hagen @ 2015-02-09 19:36 UTC (permalink / raw)
  To: ntg-context

On 2/9/2015 7:22 PM, Fabrice wrote:
> Hi Hans,
> Great, but I did not know the macro numberstriped. Is it a Metapostor
> Metafun macro?

yes
-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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 / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Hatch an area with Metapost (Metafun)
  2015-02-09 17:28 ` Hans Hagen
@ 2015-02-09 18:22   ` Fabrice
  2015-02-09 19:36     ` Hans Hagen
  0 siblings, 1 reply; 13+ messages in thread
From: Fabrice @ 2015-02-09 18:22 UTC (permalink / raw)
  To: ntg-context

Hi Hans,
Great, but I did not know the macro numberstriped. Is it a Metapostor 
Metafun macro?
Fabrice
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Hatch an area with Metapost (Metafun)
  2015-02-09 14:30 Fabrice Couvreur
@ 2015-02-09 17:28 ` Hans Hagen
  2015-02-09 18:22   ` Fabrice
  0 siblings, 1 reply; 13+ messages in thread
From: Hans Hagen @ 2015-02-09 17:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 2/9/2015 3:30 PM, Fabrice Couvreur wrote:
> Hi,
> How hatched trapezoid MBCD?
> Best regards,
> Fabrice
>
> \starttext
> \startMPcode
> path p ;
> p=unitsquare scaled 4cm ;
> draw p ;
> pair z ;
> z=point 3.6 of p ;
> draw z--urcorner p ;
> label.llft(btex B etex,llcorner p) ;
> label.lrt(btex C etex,lrcorner p) ;
> label.ulft(btex A etex,ulcorner p) ;
> label.urt(btex  D etex, urcorner p) ;
> label.lft(btex M etex, z) ;
> \stopMPcode
> \stoptext
>

\startMPpage[offset=2pt]
     path p, q, r ; pair z ;
     p := unitsquare scaled 4cm ;
     z := point 3.6 of p ;
     q := z--urcorner p ;
     r := q -- reverse bottomboundary p -- cycle ;
     draw p ;
     draw q ;
     draw r numberstriped (.25,10,5) withcolor blue ;
     draw thetextext.llft("B", llcorner p) ;
     draw thetextext.lrt ("C", lrcorner p) ;
     draw thetextext.ulft("A", ulcorner p) ;
     draw thetextext.urt ("D", urcorner p) ;
     draw thetextext.lft ("M", z) ;
\stopMPpage


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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 / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Hatch an area with Metapost (Metafun)
@ 2015-02-09 14:30 Fabrice Couvreur
  2015-02-09 17:28 ` Hans Hagen
  0 siblings, 1 reply; 13+ messages in thread
From: Fabrice Couvreur @ 2015-02-09 14:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi,
How hatched trapezoid MBCD ?
Best regards,
Fabrice

\starttext
\startMPcode
path p ;
p=unitsquare scaled 4cm ;
draw p ;
pair z ;
z=point 3.6 of p ;
draw z--urcorner p ;
label.llft(btex B etex,llcorner p) ;
label.lrt(btex C etex,lrcorner p) ;
label.ulft(btex A etex,ulcorner p) ;
label.urt(btex  D etex, urcorner p) ;
label.lft(btex M etex, z) ;
\stopMPcode
\stoptext

[-- Attachment #1.2: Type: text/html, Size: 1175 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-02-17 15:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.6.1423507568.2410.ntg-context@ntg.nl>
2015-02-10  0:07 ` Hatch an area with Metapost (Metafun) John Kitzmiller
2015-02-10 17:35   ` Fabrice
     [not found] <mailman.56.1424118064.2410.ntg-context@ntg.nl>
2015-02-17 13:51 ` John Kitzmiller
2015-02-17 15:18   ` Fabrice
     [not found] <mailman.1.1423998001.1995.ntg-context@ntg.nl>
2015-02-15 12:20 ` John Kitzmiller
2015-02-16 17:26   ` Fabrice
     [not found] <mailman.19.1423600942.2410.ntg-context@ntg.nl>
2015-02-11 11:45 ` John Kitzmiller
2015-02-15 10:18   ` Fabrice
2015-02-09 14:30 Fabrice Couvreur
2015-02-09 17:28 ` Hans Hagen
2015-02-09 18:22   ` Fabrice
2015-02-09 19:36     ` Hans Hagen
2015-02-10 18:00       ` Fabrice

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