From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/50038 Path: news.gmane.org!not-for-mail From: Taco Hoekwater Newsgroups: gmane.comp.tex.context Subject: Re: How can I compare picture variables in metapost? Date: Tue, 05 May 2009 18:54:01 +0200 Message-ID: <4A006F29.70801@elvenkind.com> References: <769ba7780905050527o4f42f9acod279bcce641189c@mail.gmail.com> <4A00366A.1040907@elvenkind.com> <769ba7780905050651l6c8601aer421b04c1b7e1c20c@mail.gmail.com> <4A00556C.5000503@elvenkind.com> <769ba7780905050819o68b79a5ek4741bfbb6fded7b6@mail.gmail.com> <4A0063F6.3050408@elvenkind.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1241542516 9246 80.91.229.12 (5 May 2009 16:55:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 May 2009 16:55:16 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue May 05 18:55:06 2009 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1M1Nup-0001Nk-Cl for gctc-ntg-context-518@m.gmane.org; Tue, 05 May 2009 18:54:47 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id B604A1FD38; Tue, 5 May 2009 18:54:46 +0200 (CEST) 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 09194-02; Tue, 5 May 2009 18:54:11 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id CD43A1FCFF; Tue, 5 May 2009 18:54:11 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 75D241FCFF for ; Tue, 5 May 2009 18:54:10 +0200 (CEST) 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 28010-01 for ; Tue, 5 May 2009 18:54:02 +0200 (CEST) Original-Received: from filter2-ams.mf.surf.net (filter2-ams.mf.surf.net [192.87.102.70]) by ronja.ntg.nl (Postfix) with ESMTP id DC8F91FCF6 for ; Tue, 5 May 2009 18:54:02 +0200 (CEST) Original-Received: from smtp-vbr12.xs4all.nl (smtp-vbr12.xs4all.nl [194.109.24.32]) by filter2-ams.mf.surf.net (8.13.8/8.13.8/Debian-3) with ESMTP id n45Gs2FX027644 for ; Tue, 5 May 2009 18:54:02 +0200 Original-Received: from [192.168.178.26] (boo.demon.nl [82.161.175.147]) (authenticated bits=0) by smtp-vbr12.xs4all.nl (8.13.8/8.13.8) with ESMTP id n45Gs1a9058584 for ; Tue, 5 May 2009 18:54:02 +0200 (CEST) (envelope-from taco@elvenkind.com) User-Agent: Thunderbird 2.0.0.19 (X11/20090114) In-Reply-To: <4A0063F6.3050408@elvenkind.com> X-Virus-Scanned: by XS4ALL Virus Scanner X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=194.109.24.32; country=NL; region=07; city=Amsterdam; latitude=52.3500; longitude=4.9167; http://maps.google.com/maps?q=52.3500,4.9167&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 219695864 - 2b2031436105 - 20090505 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.70 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.11 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:50038 Archived-At: Taco Hoekwater wrote: > Zhichu Chen wrote: >> >> Seems that I don't have too many choices. Maybe using lua to do the >> math and throwing the result to metapost is faster? I think I can do >> this, but I don't know how. The documents are a little limited. > > For circles, probably lua calculations will be faster because the > data manipulation will be a bit easier. But for non-circle paths, > you are better off with a metapost solution because of lua not > knowing about the actual paths. linear search does seem to do that badly, here is a stub: path p[]; path m; pair n; i := 0; forever: exitif i > 99; m := fullcircle scaled (uniformdeviate 20) shifted (uniformdeviate 100, uniformdeviate 100); n := (-1,-1); if i<>0: for j = 0 upto (i-1): n := m intersectiontimes p[j]; exitif (xpart n)>=0; endfor; fi if (xpart n)<0: p[i] := m ; i := i + 1; message(decimal(i)); fi endfor; beginfig(1); for i:=0 upto 99: fill p[i]; endfor; currentpicture := currentpicture scaled 5; endfig; end. ___________________________________________________________________________________ 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________