Path: news.mathworks.com!not-for-mail
From: "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Intersect circle and irregular shape
Date: Wed, 9 Jan 2008 18:20:18 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 27
Message-ID: <fm3392$h4g$1@fred.mathworks.com>
References: <66c9ae27-c839-41e2-a9a3-d5dcc7f311a7@i12g2000prf.googlegroups.com>  <cfe96c89-937d-4cd8-be63-ed7ceb3607fa@k39g2000hsf.googlegroups.com>
Reply-To: "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1199902818 17552 172.30.248.38 (9 Jan 2008 18:20:18 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 9 Jan 2008 18:20:18 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:445073


glaroc <glaroc@gmail.com> wrote in message <cfe96c89-937d-4cd8-be63-
ed7ceb3607fa@k39g2000hsf.googlegroups.com>...
> Thanks a lot for your detailed response. However, tell me if I am
> wrong, this type of approach would be pretty difficult to apply in a
> situation like this:
> 
> http://bayimg.com/cAimkAAbn
> 
> In an ideal world, I would need something that could handle even more
> complicated polygons.
> 
> GL
-------
  No, that polygon/circle situation should come out fine with the method I 
described.  The bottom polygon segment should produce two real t values 
lying between -1 and +1.  The next segment on the southeast side would 
have two real t's but only one in the above range.  The next segment beyond 
that would have a similar result.  The remaining three segments would have 
only complex-valued t's.  So that leaves you with four actual points of 
intersection.  The midpoint of the arc betweent the first two will lie outside 
the polygon, the next arc midpoint is inside, the third arc midpoint is outside, 
and finally the arc midpoint between the fourth point and the first is again 
inside the polygon.  So you add the arc lengths of the second and fourth of 
these arcs and divide by 2*pi to get your percentage.

Roger Stafford