ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* mpost: cutbefore/cutafter
@ 2000-10-06 11:12 Marc van Dongen
  2000-10-07 21:26 ` Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: Marc van Dongen @ 2000-10-06 11:12 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1221 bytes --]

Dear metapost gurus,

There is something I don't understand about
cutbefore and cutafter. Maybe what I need is
in the metafont book which I don't have yet.

Anyway, here it goes.

Is there any way to tell mpost to cut a curve
exactly at the bpath of a boxed thingy? At the
moment I am facing the problem that for example
a cutafter of an arc goes slightly beyond (what
seems to be) the inner boundary of the bpath of
a circle.

I have attached a picture which demonstrates the
effect. In this picture the phenomenon manifests
itself with the first three circles at the bottom.
The arcs were drawn with a command that drew them
from the centres of the circles cutbefore and
cutafter the bpaths of the circles.

Ideally I would like to have control where to cut
the arcs. For example, it would be very nice if
it were possible to cut exactly at the outside of
where a circle is draw or to cut it exactly at
the inside of where a circle is drawn. Is there
any way to do this?

Any pointers/help would be greatly appreciated.

Regards,

Marc van Dongen
-- 
     Marc van Dongen, CS Dept | phone:  +353 21 4903578
University College Cork, NUIC | Fax:    +353 21 4903113
  College Road, Cork, Ireland | Email: dongen@cs.ucc.ie

[-- Attachment #2: example33.pdf --]
[-- Type: application/pdf, Size: 2786 bytes --]

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

* Re: mpost: cutbefore/cutafter
  2000-10-06 11:12 mpost: cutbefore/cutafter Marc van Dongen
@ 2000-10-07 21:26 ` Hans Hagen
  2000-10-09 18:51   ` Berend de Boer
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2000-10-07 21:26 UTC (permalink / raw)
  Cc: Mailing List

If members of this list don't want to be overloaded with metapost, we may
consider a dedicated metafun list.  

At 12:12 PM 10/6/00 +0100, Marc van Dongen wrote:
>Dear metapost gurus,
>
>There is something I don't understand about
>cutbefore and cutafter. Maybe what I need is
>in the metafont book which I don't have yet.
>
>Anyway, here it goes.
>
>Is there any way to tell mpost to cut a curve
>exactly at the bpath of a boxed thingy? At the
>moment I am facing the problem that for example
>a cutafter of an arc goes slightly beyond (what
>seems to be) the inner boundary of the bpath of
>a circle.

This has to do with line characteristics. The point itself has infinity
small but you draw it with a certain pen. Using another linecap already
helps. 

>I have attached a picture which demonstrates the
>effect. In this picture the phenomenon manifests
>itself with the first three circles at the bottom.
>The arcs were drawn with a command that drew them
>from the centres of the circles cutbefore and
>cutafter the bpaths of the circles.
>
>Ideally I would like to have control where to cut
>the arcs. For example, it would be very nice if
>it were possible to cut exactly at the outside of
>where a circle is draw or to cut it exactly at
>the inside of where a circle is drawn. Is there
>any way to do this?

You can forst raw the lines and then the circles. You can cut the linewidth
from the connecting path using the metafun point length on path operation. 

\setupcolors[state=start]

\starttext

\startMPpage

path p, q, r ; pair pr, qr ;

p := fullcircle scaled 4cm ;
q := fullcircle scaled 3cm shifted (5cm,6cm) ;
r := center p -- center q ;

pr := p intersectionpoint r ;
qr := q intersectionpoint r ;

r := r cutbefore pr ; r := r cutafter qr ;
r := r cutbefore (point 2.5pt on r) ;
r := reverse r ;
r := r cutbefore (point 2.5pt on r) ;

draw r withpen pencircle scaled 10pt;
draw p withpen pencircle scaled 5pt withcolor red ;
draw q withpen pencircle scaled 5pt withcolor green ;

\stopMPpage

\stoptext

I played a bit with clipping but that's too tricky and fuzzy (you can do
nice tricks that way). I will think about adding something of 'connecting'
things in the metafun manual. [some of this is taking place in the flow
chart module, btw] I've extended 'on' to accept negative values: 

primarydef len on pat =
  (arctime if len>0 : len else : (arclength(pat)+len) fi of pat) of pat
enddef ;

so then you get

r := r cutbefore pr ; r := r cutafter qr ;
r := r cutbefore (point  2.5pt on r) ;
r := r cutafter  (point -2.5pt on r) ;

I will not bore you with the macro cutends that i added to metafun a minute
ago

r cutends 2.5pt 

Hans

Hans  
-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


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

* Re: mpost: cutbefore/cutafter
  2000-10-07 21:26 ` Hans Hagen
@ 2000-10-09 18:51   ` Berend de Boer
  2000-10-09 19:34     ` metafun talk in ntg-context list (was Re: mpost: cutbefore/cutafter) Ed L Cashin
  0 siblings, 1 reply; 6+ messages in thread
From: Berend de Boer @ 2000-10-09 18:51 UTC (permalink / raw)
  Cc: Mailing List

> If members of this list don't want to be overloaded with metapost, we
may
> consider a dedicated metafun list.

It is sometimes hard to make the distinction. And MetaPost is becoming
an integral part of ConTeXt.

Groetjes,

Berend. (-:


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

* metafun talk in ntg-context list (was Re: mpost: cutbefore/cutafter)
  2000-10-09 18:51   ` Berend de Boer
@ 2000-10-09 19:34     ` Ed L Cashin
  2000-10-09 19:55       ` metafun talk in ntg-context list (was Re: mpost:cutbefore/cutafter) Hans Fredrik Nordhaug
  0 siblings, 1 reply; 6+ messages in thread
From: Ed L Cashin @ 2000-10-09 19:34 UTC (permalink / raw)
  Cc: Marc van Dongen, Hans Hagen, Berend de Boer

Berend de Boer <berend@pobox.com> writes:

> > If members of this list don't want to be overloaded with metapost, we
> > may
> > consider a dedicated metafun list.
> 
> It is sometimes hard to make the distinction. And MetaPost is becoming
> an integral part of ConTeXt.

Yes, I like being overloaded with metapost!  ;)

-- 
--Ed Cashin                     PGP public key:
  ecashin@coe.uga.edu           http://www.coe.uga.edu/~ecashin/pgp/


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

* Re: metafun talk in ntg-context list (was Re: mpost:cutbefore/cutafter)
  2000-10-09 19:34     ` metafun talk in ntg-context list (was Re: mpost: cutbefore/cutafter) Ed L Cashin
@ 2000-10-09 19:55       ` Hans Fredrik Nordhaug
  2000-10-09 20:07         ` metafun talk in ntg-context list (was Re: mpost: cutbefore/cutafter) Ed L Cashin
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Fredrik Nordhaug @ 2000-10-09 19:55 UTC (permalink / raw)
  Cc: NTG-ConTeXt mailing list

On 9 Oct 2000, Ed L Cashin wrote:

> Berend de Boer <berend@pobox.com> writes:
> 
> > > If members of this list don't want to be overloaded with metapost, we
> > > may consider a dedicated metafun list.
> > 
> > It is sometimes hard to make the distinction. And MetaPost is becoming
> > an integral part of ConTeXt.
> 
> Yes, I like being overloaded with metapost!  ;)
>

Me too, but there is one argument for setting up a metafun/metapost 
list - that people (merely) interested in metapost may not want to get
overloaded with context postings :-)

Cheers,
 Hans Fredrik

PS! Is there a list for metapost somewhere else? If not ...

--------------------------------------------------------------------------
   Hans Fredrik Nordhaug       | web:    www.mi.uib.no/~hansfn   
    Ph.D. student at           | phone:    (+47) 55 58 48 79       
    Department of Mathematics, | fax:      (+47) 55 58 96 72       
    University of Bergen       | e-mail:    hansfn@mi.uib.no      
--------------------------------------------------------------------------
   Fall 2000: Visiting at the Department of Civil Engineering,
                        Princeton University.
--------------------------------------------------------------------------


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

* Re: metafun talk in ntg-context list (was Re: mpost: cutbefore/cutafter)
  2000-10-09 19:55       ` metafun talk in ntg-context list (was Re: mpost:cutbefore/cutafter) Hans Fredrik Nordhaug
@ 2000-10-09 20:07         ` Ed L Cashin
  0 siblings, 0 replies; 6+ messages in thread
From: Ed L Cashin @ 2000-10-09 20:07 UTC (permalink / raw)
  Cc: NTG-ConTeXt mailing list

Hans Fredrik Nordhaug <nordhaug@karst.princeton.edu> writes:

> On 9 Oct 2000, Ed L Cashin wrote:
...
> > Yes, I like being overloaded with metapost!  ;)
> 
> Me too, but there is one argument for setting up a metafun/metapost 
> list - that people (merely) interested in metapost may not want to get
> overloaded with context postings :-)

Hopefully any metafun users who don't want to hear about context will
speak up.

> Cheers,
>  Hans Fredrik
> 
> PS! Is there a list for metapost somewhere else? If not ...

There's a metapost/metafont list: "metafont@ens.fr", but metafun might
be too context-specific for that list ... I don't know.  It's a very
low-traffic list.

>From my welcome-to-the-list message:

    From: sympa@ens.fr
    Subject: bienvenue dans la liste metafont
    Reply-To: metafont-request@ens.fr

    To get help for sympa software:
            mail sympa@ens.fr
            (no subject)
            help
    To unsubscribe:
            mail sympa@ens.fr
            (no subject)
            unsubscribe metafont

-- 
--Ed Cashin                     PGP public key:
  ecashin@coe.uga.edu           http://www.coe.uga.edu/~ecashin/pgp/


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

end of thread, other threads:[~2000-10-09 20:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-06 11:12 mpost: cutbefore/cutafter Marc van Dongen
2000-10-07 21:26 ` Hans Hagen
2000-10-09 18:51   ` Berend de Boer
2000-10-09 19:34     ` metafun talk in ntg-context list (was Re: mpost: cutbefore/cutafter) Ed L Cashin
2000-10-09 19:55       ` metafun talk in ntg-context list (was Re: mpost:cutbefore/cutafter) Hans Fredrik Nordhaug
2000-10-09 20:07         ` metafun talk in ntg-context list (was Re: mpost: cutbefore/cutafter) Ed L Cashin

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