From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/60024 Path: news.gmane.org!not-for-mail From: Marco Newsgroups: gmane.comp.tex.context Subject: Re: Metapost: union test of two paths Date: Sun, 4 Jul 2010 01:11:27 +0200 Message-ID: <20100704011127.277ee6ac@vorbis> References: <20100702190137.35aeab6b@vorbis> <4C2EEED4.1010300@elvenkind.com> <4C2F0EB2.1020508@elvenkind.com> <4C2F3C7A.1020603@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" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1278199258 10376 80.91.229.12 (3 Jul 2010 23:20:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 3 Jul 2010 23:20:58 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Sun Jul 04 01:20:54 2010 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OVC0z-0003HI-8b for gctc-ntg-context-518@m.gmane.org; Sun, 04 Jul 2010 01:20:53 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 9AD60C9B66; Sun, 4 Jul 2010 01:20:52 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Shvau5418Qy6; Sun, 4 Jul 2010 01:20:48 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id AA21EC9AF5; Sun, 4 Jul 2010 01:20:48 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id A1D14C9AF5 for ; Sun, 4 Jul 2010 01:20:46 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id lhGdXvb4GIxZ for ; Sun, 4 Jul 2010 01:20:44 +0200 (CEST) Original-Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by balder.ntg.nl (Postfix) with ESMTP id 80D40C9AD9 for ; Sun, 4 Jul 2010 01:20:44 +0200 (CEST) Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OVC0p-0003Fa-Vy for ntg-context@ntg.nl; Sun, 04 Jul 2010 01:20:43 +0200 Original-Received: from 202.58.85.36 ([202.58.85.36]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 04 Jul 2010 01:20:43 +0200 Original-Received: from netuse by 202.58.85.36 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 04 Jul 2010 01:20:43 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 25 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 202.58.85.36 X-Newsreader: Claws Mail 3.7.6 (GTK+ 2.20.1; i486-pc-linux-gnu) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 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 Xref: news.gmane.org gmane.comp.tex.context:60024 Archived-At: Hi Taco! > That is hard. The main problem is the word 'arbitrary'. Sorry, I was too general. The paths are a outline of a relatively simple shape (so border cases should rarely occur) with area >0k, not selfintersecting. > * is a point *on* the path in or out? It doesn't matter in my case. > This one seems ok at first glance (extensive testing will probably > show border cases that are not covered). I did run some tests. It works like a charm, exactly the way I expect. Thank you very much for this piece of code. If I got it right, your basic idea is to count the times the point inside the boundingbox crosses the border of the shape. And the subpath stuff results of the fact that intersectionpoint/times returns only one intersection even if there are more. Very smart. I'm grateful for your support. Kind regards Marco ___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________