From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/2916 Path: main.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: mpost: cutbefore/cutafter Date: Sat, 07 Oct 2000 23:26:27 +0200 Sender: owner-ntg-context@let.uu.nl Message-ID: <3.0.6.32.20001007232627.008cf800@pop.wxs.nl> References: <20001006121204.A10194@cs.ucc.ie> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: main.gmane.org 1035393691 12834 80.91.224.250 (23 Oct 2002 17:21:31 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Oct 2002 17:21:31 +0000 (UTC) Cc: Mailing List Original-To: Marc van Dongen In-Reply-To: <20001006121204.A10194@cs.ucc.ie> Xref: main.gmane.org gmane.comp.tex.context:2916 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:2916 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 -------------------------------------------------------------------------