From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/23503 Path: news.gmane.org!not-for-mail From: Giuseppe Bilotta Newsgroups: gmane.comp.tex.context Subject: Re[2]: Drawing oriented paths in MetaFun Date: Wed, 16 Nov 2005 16:46:04 +0100 Message-ID: <1606851465.20051116164604@iol.it> References: <934068063.20051116154847@iol.it> <1685015719.20051116164044@iol.it> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1132156257 27362 80.91.229.2 (16 Nov 2005 15:50:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 16 Nov 2005 15:50:57 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Wed Nov 16 16:50:56 2005 Return-path: Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1EcPUw-0001lB-S6 for gctc-ntg-context-518@m.gmane.org; Wed, 16 Nov 2005 16:46:58 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 93CBC127F6; Wed, 16 Nov 2005 16:46:58 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 18191-01-4; Wed, 16 Nov 2005 16:46:54 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 66D95127F8; Wed, 16 Nov 2005 16:46:54 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id E1D28127F8 for ; Wed, 16 Nov 2005 16:46:52 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 18191-01-3 for ; Wed, 16 Nov 2005 16:46:52 +0100 (CET) Original-Received: from smtp0.libero.it (smtp0.libero.it [193.70.192.33]) by ronja.ntg.nl (Postfix) with ESMTP id 06979127F6 for ; Wed, 16 Nov 2005 16:46:51 +0100 (CET) Original-Received: from localhost (172.16.1.78) by smtp0.libero.it (7.0.027-DD01) id 4378A4660030E925 for ntg-context@ntg.nl; Wed, 16 Nov 2005 16:46:51 +0100 Original-Received: from smtp0.libero.it ([172.16.1.76]) by localhost (asav20.libero.it [193.70.193.7]) (amavisd-new, port 10024) with ESMTP id 10262-10-9 for ; Wed, 16 Nov 2005 16:46:51 +0100 (CET) Original-Received: from OBLOMOV (adsl-ull-229-179.44-151.net24.it [151.44.179.229]) by smtp0.libero.it (Postfix) with ESMTP id D163DB0924 for ; Wed, 16 Nov 2005 16:46:50 +0100 (MET) X-Mailer: The Bat! (v3.5.25) Professional X-Priority: 3 (Normal) Original-To: mailing list for ConTeXt users In-Reply-To: <1685015719.20051116164044@iol.it> X-Scanned: with antispam and antivirus automated system at libero.it X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:23503 Archived-At: Wednesday, November 16, 2005 Giuseppe Bilotta wrote: > Wednesday, November 16, 2005 Giuseppe Bilotta wrote: >> Does MetaFun provide some macro to draw oriented paths? I >> would like it to basically add a small arrow *in the middle* >> of the path? Such a macro >> draworiented somepath somespecs ; >> would have to act like >> drawarrow firsthalf(somepath) somespecs ; >> draw secondhalf(somepath) somespecs ; >> Is it available already, or should I roll my own? > Hm. I came up with > def draworiented expr c = > path _c_ ; _c_ := c ; > do_draworiented > enddef ; > def do_draworiented text t = > draw _c_ t ; > drawarrow subpath(0, length(_c_)/2) of _c_ ; > enddef; > which works, although I have to do > draworiented (reverse p1) > Is there an easy way to have it work with > draworiented reverse p1 ? Oh sorry it works ... however, it traces half of the curve twice. So I came up with the next: def draworiented expr c = path _c_ ; _c_ := c ; do_draworiented enddef ; def do_draworiented text t = drawarrow subpath(0, length(_c_)/2) of _c_ t ; draw subpath(length(_c_)/2, length(_c_)) of _c_ t ; enddef; This still isn't perfect, but it works. It needs a little tuning so that the arrow is more centered, and of course it could be improved to put the arrow at any arbitrary point on the path. -- Giuseppe "Oblomov" Bilotta