From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/50042 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: How can I compare picture variables in metapost? Date: Tue, 5 May 2009 19:28:41 -0400 (EDT) Message-ID: 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> <4A006F29.70801@elvenkind.com> <4A00B2B0.2080008@gmx.net> 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 1241566204 20823 80.91.229.12 (5 May 2009 23:30:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 May 2009 23:30:04 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed May 06 01:29:54 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 1M1U5A-0007Ry-I7 for gctc-ntg-context-518@m.gmane.org; Wed, 06 May 2009 01:29:52 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 80D781FCD3; Wed, 6 May 2009 01:29:50 +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 26440-03; Wed, 6 May 2009 01:29:16 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 74C6A1FC84; Wed, 6 May 2009 01:29:15 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 9EB4C1FC84 for ; Wed, 6 May 2009 01:29:14 +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 26819-07 for ; Wed, 6 May 2009 01:29:06 +0200 (CEST) Original-Received: from filter2-nij.mf.surf.net (filter2-nij.mf.surf.net [195.169.124.153]) by ronja.ntg.nl (Postfix) with ESMTP id CC7561FC83 for ; Wed, 6 May 2009 01:29:06 +0200 (CEST) Original-Received: from tombraider.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.93.161]) by filter2-nij.mf.surf.net (8.13.8/8.13.8/Debian-3) with ESMTP id n45NT5vQ020733 for ; Wed, 6 May 2009 01:29:06 +0200 Original-Received: FROM [192.168.2.8] (c-76-127-178-8.hsd1.ct.comcast.net [76.127.178.8]) By tombraider.mr.itd.umich.edu ID 4A00CBBF.76A95.15900 ; Authuser adityam; 5 May 2009 19:29:03 EDT In-Reply-To: <4A00B2B0.2080008@gmx.net> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=141.211.93.161; country=US; region=MI; city=Ann Arbor; postalcode=48109; latitude=42.2923; longitude=-83.7145; metrocode=505; areacode=734; http://maps.google.com/maps?q=42.2923,-83.7145&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 219830477 - 30a9ee15656a - 20090506 X-Scanned-By: CanIt (www . roaringpenguin . com) on 195.169.124.153 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:50042 Archived-At: On Tue, 5 May 2009, Peter Rolf wrote: > Taco Hoekwater schrieb: >> 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: >> > Mhh... isn't it easier to just test, if the distance (centerpoint to > centerpoint) from the new circle > to all already found circles is greater (or equal) than the sum of the radii? Depends on what you mean by "does not intersect". Taco's solution only checks if the curves intersect or not. So, it is possible to have two concentric circles. If you check for distance you get circles which do not overlap. Of course, in case of circles, non-overlap can also be tested mathmeaticically. if |c_1 - c_2| < max(r_1, r_2) then |c_1 - c_2| < |r_1 - r_2| else |c_1 - c_2| > r_1 + r_2 end > Anyhow an interesting and hard problem (I guess O(n!) ? ). I think it is O(n^3).You only have to check all combinations (which is O(n^2)) and do that for each point that you add add. Aditya ___________________________________________________________________________________ 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 ___________________________________________________________________________________