<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161677</link>
    <title>MATLAB Central Newsreader - Intersect circle and irregular shape</title>
    <description>Feed for thread: Intersect circle and irregular shape</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2008 by The MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>The MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Wed, 09 Jan 2008 23:16:02 -0500</pubDate>
      <title>Re: Intersect circle and irregular shape</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161677#408795</link>
      <author>Joaquim Luis</author>
      <description>"Roger &lt;br&gt;
Stafford" &amp;lt;ellieandrogerxyzzy@mindspring.com.invalid&amp;gt; wrote &lt;br&gt;
in message &amp;lt;fm3igl$kmn$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&lt;br&gt;
&amp;gt; -----------&lt;br&gt;
&amp;gt;   Joaquim, if I interpret Guillaume Jacquenot's m-file &lt;br&gt;
for the &lt;br&gt;
&amp;gt; "Polygons_intersection" function on the Matlab Central &lt;br&gt;
File Exchange &lt;br&gt;
&amp;gt; correctly, he has to approximate curved shapes like &lt;br&gt;
circles with discrete &lt;br&gt;
&amp;gt; polygons.  His example has the following two lines:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  S(1).P(1).x = [1.5 1.5 0.5 1.5+cos(pi:pi/30:3*pi/2)];&lt;br&gt;
&amp;gt;  S(1).P(1).y = [0.5 1.5 1.5 1.5+sin(pi:pi/30:3*pi/2)];&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; which would contain a quarter circle as approximated by &lt;br&gt;
16 polygonal &lt;br&gt;
&amp;gt; segments.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   The problem of finding the intersection between a line &lt;br&gt;
segment and a circle &lt;br&gt;
&amp;gt; is very straightforward and just involves the solution to &lt;br&gt;
a simple quadratic &lt;br&gt;
&amp;gt; equation, so I don't see why GL can't do it that way &lt;br&gt;
directly, rather than mess &lt;br&gt;
&amp;gt; around with such approximations.&lt;br&gt;
&lt;br&gt;
Roger,&lt;br&gt;
Yes, that's right but in his first message he mentioned&lt;br&gt;
&lt;br&gt;
"I am looking for ways to calculate the percentage of the &lt;br&gt;
circumference of a circle enclosed within an intersecting &lt;br&gt;
irregular polygon."&lt;br&gt;
&lt;br&gt;
So I guess that the clipping polygons solution is, at &lt;br&gt;
least, easier to use.&lt;br&gt;
&lt;br&gt;
Joaquim Luis &lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 22:40:38 -0500</pubDate>
      <title>Re: Intersect circle and irregular shape</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161677#408788</link>
      <author>glaroc</author>
      <description>&amp;gt; &amp;gt; I couldn't find anything in the Matlab file central or&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; anywhere else.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I think this is 99.99[inf]% solution to your problem.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &lt;a href="http://www.mathworks.com/matlabcentral/fileexchange/"&gt;http://www.mathworks.com/matlabcentral/fileexchange/&lt;/a&gt;&lt;br&gt;
&amp;gt; loadFile.do?objectId=18173&amp;objectType=file&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; J. Luis&lt;br&gt;
&lt;br&gt;
Thanks! I was looking for this just before the new year, so I guess&lt;br&gt;
its normal I didn't see that one...&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 22:40:21 -0500</pubDate>
      <title>Re: Intersect circle and irregular shape</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161677#408787</link>
      <author>Roger Stafford</author>
      <description>"Joaquim Luis" &amp;lt;jluis@--ualg--.pt&amp;gt; wrote in message &amp;lt;fm3cmg$r8q&lt;br&gt;
$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I think this is 99.99[inf]% solution to your problem.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;a href="http://www.mathworks.com/matlabcentral/fileexchange/"&gt;http://www.mathworks.com/matlabcentral/fileexchange/&lt;/a&gt;&lt;br&gt;
&amp;gt; loadFile.do?objectId=18173&amp;objectType=file&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; J. Luis&lt;br&gt;
-----------&lt;br&gt;
&amp;nbsp;&amp;nbsp;Joaquim, if I interpret Guillaume Jacquenot's m-file for the &lt;br&gt;
"Polygons_intersection" function on the Matlab Central File Exchange &lt;br&gt;
correctly, he has to approximate curved shapes like circles with discrete &lt;br&gt;
polygons.  His example has the following two lines:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;S(1).P(1).x = [1.5 1.5 0.5 1.5+cos(pi:pi/30:3*pi/2)];&lt;br&gt;
&amp;nbsp;S(1).P(1).y = [0.5 1.5 1.5 1.5+sin(pi:pi/30:3*pi/2)];&lt;br&gt;
&lt;br&gt;
which would contain a quarter circle as approximated by 16 polygonal &lt;br&gt;
segments.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;The problem of finding the intersection between a line segment and a circle &lt;br&gt;
is very straightforward and just involves the solution to a simple quadratic &lt;br&gt;
equation, so I don't see why GL can't do it that way directly, rather than mess &lt;br&gt;
around with such approximations.&lt;br&gt;
&lt;br&gt;
Roger Stafford&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 22:38:44 -0500</pubDate>
      <title>Re: Intersect circle and irregular shape</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161677#408786</link>
      <author>glaroc</author>
      <description>&amp;gt; &amp;gt; I couldn't find anything in the Matlab file central or&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; anywhere else.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I think this is 99.99[inf]% solution to your problem.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &lt;a href="http://www.mathworks.com/matlabcentral/fileexchange/"&gt;http://www.mathworks.com/matlabcentral/fileexchange/&lt;/a&gt;&lt;br&gt;
&amp;gt; loadFile.do?objectId=18173&amp;objectType=file&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; J. Luis&lt;br&gt;
&lt;br&gt;
Thanks! I was looking for this just before the new year, so I guess&lt;br&gt;
its normal I didn't see that one...&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 22:33:27 -0500</pubDate>
      <title>Re: Intersect circle and irregular shape</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161677#408785</link>
      <author>glaroc</author>
      <description>&amp;gt; &amp;gt; I couldn't find anything in the Matlab file central or&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; anywhere else.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I think this is 99.99[inf]% solution to your problem.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &lt;a href="http://www.mathworks.com/matlabcentral/fileexchange/"&gt;http://www.mathworks.com/matlabcentral/fileexchange/&lt;/a&gt;&lt;br&gt;
&amp;gt; loadFile.do?objectId=18173&amp;objectType=file&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; J. Luis&lt;br&gt;
&lt;br&gt;
Thanks! I was looking for this just before the new year, so I guess&lt;br&gt;
its normal I didn't see that one...&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 22:27:13 -0500</pubDate>
      <title>Re: Intersect circle and irregular shape</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161677#408784</link>
      <author>glaroc</author>
      <description>&amp;gt; &amp;gt; I couldn't find anything in the Matlab file central or&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; anywhere else.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I think this is 99.99[inf]% solution to your problem.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &lt;a href="http://www.mathworks.com/matlabcentral/fileexchange/"&gt;http://www.mathworks.com/matlabcentral/fileexchange/&lt;/a&gt;&lt;br&gt;
&amp;gt; loadFile.do?objectId=18173&amp;objectType=file&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; J. Luis&lt;br&gt;
&lt;br&gt;
Thanks! I was looking for this just before the new year, so I guess&lt;br&gt;
its normal I didn't see that one...&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 22:26:52 -0500</pubDate>
      <title>Re: Intersect circle and irregular shape</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161677#408783</link>
      <author>glaroc</author>
      <description>&amp;gt; &amp;gt; I couldn't find anything in the Matlab file central or&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; anywhere else.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I think this is 99.99[inf]% solution to your problem.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &lt;a href="http://www.mathworks.com/matlabcentral/fileexchange/"&gt;http://www.mathworks.com/matlabcentral/fileexchange/&lt;/a&gt;&lt;br&gt;
&amp;gt; loadFile.do?objectId=18173&amp;objectType=file&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; J. Luis&lt;br&gt;
&lt;br&gt;
Thanks! I was looking for this just before the new year, so I guess&lt;br&gt;
its normal I didn't see that one...&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 21:05:05 -0500</pubDate>
      <title>Re: Intersect circle and irregular shape</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161677#408775</link>
      <author>Charles Cuell</author>
      <description>"Roger Stafford" &lt;br&gt;
&amp;lt;ellieandrogerxyzzy@mindspring.com.invalid&amp;gt; wrote in &lt;br&gt;
message &amp;lt;fm3b02$giu$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; "Charles Cuell" &amp;lt;cuell@math.usask.ca&amp;gt; wrote in message &lt;br&gt;
&amp;lt;fm36sq$2m2&lt;br&gt;
&amp;gt; $1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; I would just go for coffee, or lunch, or a vacation :)&lt;br&gt;
&amp;gt; &amp;gt; Point taken, anyway.&lt;br&gt;
&amp;gt; &amp;gt; Charles&lt;br&gt;
&amp;gt; --------&lt;br&gt;
&amp;gt;   It would be a very long coffee break, Charles, if GL &lt;br&gt;
were to attempt to &lt;br&gt;
&amp;gt; extract all the accuracy out of his computations that &lt;br&gt;
matlab's double &lt;br&gt;
&amp;gt; precision is capable of, using the 10^k method.  It would &lt;br&gt;
require something &lt;br&gt;
&amp;gt; of the order of 10^16 divisions of the full circle and &lt;br&gt;
therefore a like number &lt;br&gt;
&amp;gt; of calls on inpolygon to achieve that.  That way I figure &lt;br&gt;
he might have his &lt;br&gt;
&amp;gt; computer occupied for several hundred years on each &lt;br&gt;
circle.  With the web &lt;br&gt;
&amp;gt; example GL showed, there would only be four calls on &lt;br&gt;
inpolygon and six calls &lt;br&gt;
&amp;gt; on roots with the intersection method.  It seems to me a &lt;br&gt;
better practice, both &lt;br&gt;
&amp;gt; from a computation efficiency point of view, and from an &lt;br&gt;
esthetic one too, to &lt;br&gt;
&amp;gt; find all the intersections between the circle and the &lt;br&gt;
polygon precisely and &lt;br&gt;
&amp;gt; work from there.  The computations should all be accurate &lt;br&gt;
to the full one part &lt;br&gt;
&amp;gt; in 10^16 that way.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Roger Stafford&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
Ouch.  Even with a government job, that's a long coffee &lt;br&gt;
break.  Thanks for the info.  &lt;br&gt;
&lt;br&gt;
Charles.&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 21:01:04 -0500</pubDate>
      <title>Re: Intersect circle and irregular shape</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161677#408773</link>
      <author>Joaquim Luis</author>
      <description>&lt;br&gt;
&amp;gt; I couldn't find anything in the Matlab file central or &lt;br&gt;
anywhere else.&lt;br&gt;
&lt;br&gt;
I think this is 99.99[inf]% solution to your problem.&lt;br&gt;
&lt;br&gt;
&lt;a href="http://www.mathworks.com/matlabcentral/fileexchange/"&gt;http://www.mathworks.com/matlabcentral/fileexchange/&lt;/a&gt;&lt;br&gt;
loadFile.do?objectId=18173&amp;objectType=file&lt;br&gt;
&lt;br&gt;
J. Luis&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 20:32:02 -0500</pubDate>
      <title>Re: Intersect circle and irregular shape</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161677#408768</link>
      <author>Roger Stafford</author>
      <description>"Charles Cuell" &amp;lt;cuell@math.usask.ca&amp;gt; wrote in message &amp;lt;fm36sq$2m2&lt;br&gt;
$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I would just go for coffee, or lunch, or a vacation :)&lt;br&gt;
&amp;gt; Point taken, anyway.&lt;br&gt;
&amp;gt; Charles&lt;br&gt;
--------&lt;br&gt;
&amp;nbsp;&amp;nbsp;It would be a very long coffee break, Charles, if GL were to attempt to &lt;br&gt;
extract all the accuracy out of his computations that matlab's double &lt;br&gt;
precision is capable of, using the 10^k method.  It would require something &lt;br&gt;
of the order of 10^16 divisions of the full circle and therefore a like number &lt;br&gt;
of calls on inpolygon to achieve that.  That way I figure he might have his &lt;br&gt;
computer occupied for several hundred years on each circle.  With the web &lt;br&gt;
example GL showed, there would only be four calls on inpolygon and six calls &lt;br&gt;
on roots with the intersection method.  It seems to me a better practice, both &lt;br&gt;
from a computation efficiency point of view, and from an esthetic one too, to &lt;br&gt;
find all the intersections between the circle and the polygon precisely and &lt;br&gt;
work from there.  The computations should all be accurate to the full one part &lt;br&gt;
in 10^16 that way.&lt;br&gt;
&lt;br&gt;
Roger Stafford&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 19:22:02 -0500</pubDate>
      <title>Re: Intersect circle and irregular shape</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161677#408759</link>
      <author>Charles Cuell</author>
      <description>glaroc &amp;lt;glaroc@gmail.com&amp;gt; wrote in message &amp;lt;1c0f9a46-130e-&lt;br&gt;
4bd6-9918-8238171a5977@k2g2000hse.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; In fact, I already tried this approximation method. The &lt;br&gt;
problem is&lt;br&gt;
&amp;gt; that it is quite slow since I have to do this for &lt;br&gt;
thousands of circle.&lt;br&gt;
&amp;gt; This involves a lot of inpolygon calculations. Roger's &lt;br&gt;
method seems&lt;br&gt;
&amp;gt; longer to code, but will likely be a lot faster.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I will give it a try when I have a minute.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; GL&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; $...@fred.mathworks.com&amp;gt;...&amp;gt; I would take 100 or 1000 &lt;br&gt;
or 10 000 or 10^k evenly spaced&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; points on the circle and calculate the percentage &lt;br&gt;
that lie&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; inside the figure. If the figure is quite irregular, &lt;br&gt;
then&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; perhaps choosing 10^k randomly distibuted points and&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; running the code many times would be best.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; This is only an approximation, of course, but it &lt;br&gt;
should be&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; easy to code, fast and give good results.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Charles&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; -------&lt;br&gt;
&amp;gt; &amp;gt;   Charles, I grant you this would be easier to code, &lt;br&gt;
but if the 10^k value&lt;br&gt;
&amp;gt; &amp;gt; Glaroc choses to select is very large so as to be &lt;br&gt;
accurate, this would mean&lt;br&gt;
&amp;gt; &amp;gt; that same number of calls on inpolygon.  It might not &lt;br&gt;
execute as fast as he&lt;br&gt;
&amp;gt; &amp;gt; would like, as compared with only one call per arc &lt;br&gt;
midpoint using the&lt;br&gt;
&amp;gt; &amp;gt; intersection method.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Roger Stafford&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
I would just go for coffee, or lunch, or a vacation :)&lt;br&gt;
Point taken, anyway.&lt;br&gt;
&lt;br&gt;
Charles&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 19:05:41 -0500</pubDate>
      <title>Re: Intersect circle and irregular shape</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161677#408757</link>
      <author>glaroc</author>
      <description>In fact, I already tried this approximation method. The problem is&lt;br&gt;
that it is quite slow since I have to do this for thousands of circle.&lt;br&gt;
This involves a lot of inpolygon calculations. Roger's method seems&lt;br&gt;
longer to code, but will likely be a lot faster.&lt;br&gt;
&lt;br&gt;
I will give it a try when I have a minute.&lt;br&gt;
&lt;br&gt;
GL&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; $...@fred.mathworks.com&amp;gt;...&amp;gt; I would take 100 or 1000 or 10 000 or 10^k evenly spaced&lt;br&gt;
&amp;gt; &amp;gt; points on the circle and calculate the percentage that lie&lt;br&gt;
&amp;gt; &amp;gt; inside the figure. If the figure is quite irregular, then&lt;br&gt;
&amp;gt; &amp;gt; perhaps choosing 10^k randomly distibuted points and&lt;br&gt;
&amp;gt; &amp;gt; running the code many times would be best.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; This is only an approximation, of course, but it should be&lt;br&gt;
&amp;gt; &amp;gt; easy to code, fast and give good results.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Charles&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; -------&lt;br&gt;
&amp;gt;   Charles, I grant you this would be easier to code, but if the 10^k value&lt;br&gt;
&amp;gt; Glaroc choses to select is very large so as to be accurate, this would mean&lt;br&gt;
&amp;gt; that same number of calls on inpolygon.  It might not execute as fast as he&lt;br&gt;
&amp;gt; would like, as compared with only one call per arc midpoint using the&lt;br&gt;
&amp;gt; intersection method.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Roger Stafford&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 18:56:02 -0500</pubDate>
      <title>Re: Intersect circle and irregular shape</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161677#408754</link>
      <author>Roger Stafford</author>
      <description>"Charles Cuell" &amp;lt;cuell@math.usask.ca&amp;gt; wrote in message &amp;lt;fm33v1$hkn&lt;br&gt;
$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I would take 100 or 1000 or 10 000 or 10^k evenly spaced &lt;br&gt;
&amp;gt; points on the circle and calculate the percentage that lie &lt;br&gt;
&amp;gt; inside the figure. If the figure is quite irregular, then &lt;br&gt;
&amp;gt; perhaps choosing 10^k randomly distibuted points and &lt;br&gt;
&amp;gt; running the code many times would be best.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; This is only an approximation, of course, but it should be &lt;br&gt;
&amp;gt; easy to code, fast and give good results.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Charles&lt;br&gt;
-------&lt;br&gt;
&amp;nbsp;&amp;nbsp;Charles, I grant you this would be easier to code, but if the 10^k value &lt;br&gt;
Glaroc choses to select is very large so as to be accurate, this would mean &lt;br&gt;
that same number of calls on inpolygon.  It might not execute as fast as he &lt;br&gt;
would like, as compared with only one call per arc midpoint using the &lt;br&gt;
intersection method.&lt;br&gt;
&lt;br&gt;
Roger Stafford&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 18:32:01 -0500</pubDate>
      <title>Re: Intersect circle and irregular shape</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161677#408750</link>
      <author>Charles Cuell</author>
      <description>glaroc &amp;lt;glaroc@gmail.com&amp;gt; wrote in message &amp;lt;66c9ae27-c839-&lt;br&gt;
41e2-a9a3-d5dcc7f311a7@i12g2000prf.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi, I am looking for ways to calculate the percentage of &lt;br&gt;
the&lt;br&gt;
&amp;gt; circumference of a circle enclosed within an intersecting &lt;br&gt;
irregular&lt;br&gt;
&amp;gt; polygon. For example, if I have a circle centered within &lt;br&gt;
a triangle, I&lt;br&gt;
&amp;gt; want to know how much of the circumference of the circle &lt;br&gt;
is contained&lt;br&gt;
&amp;gt; within the triangle. This could be anywhere between 0 and &lt;br&gt;
100. I know&lt;br&gt;
&amp;gt; I can do this in a topological GIS, but I really need &lt;br&gt;
Matlab for this.&lt;br&gt;
&amp;gt; I want to use this to build an edge correction program. I &lt;br&gt;
couldn't&lt;br&gt;
&amp;gt; find anything in the Matlab file central or anywhere else.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thank you for any help you may provide,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; GL&lt;br&gt;
&lt;br&gt;
GL,&lt;br&gt;
&lt;br&gt;
I would take 100 or 1000 or 10 000 or 10^k evenly spaced &lt;br&gt;
points on the circle and calculate the percentage that lie &lt;br&gt;
inside the figure. If the figure is quite irregular, then &lt;br&gt;
perhaps choosing 10^k randomly distibuted points and &lt;br&gt;
running the code many times would be best.&lt;br&gt;
&lt;br&gt;
This is only an approximation, of course, but it should be &lt;br&gt;
easy to code, fast and give good results.&lt;br&gt;
&lt;br&gt;
Charles&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 18:20:18 -0500</pubDate>
      <title>Re: Intersect circle and irregular shape</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161677#408745</link>
      <author>Roger Stafford</author>
      <description>glaroc &amp;lt;glaroc@gmail.com&amp;gt; wrote in message &amp;lt;cfe96c89-937d-4cd8-be63-&lt;br&gt;
ed7ceb3607fa@k39g2000hsf.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; Thanks a lot for your detailed response. However, tell me if I am&lt;br&gt;
&amp;gt; wrong, this type of approach would be pretty difficult to apply in a&lt;br&gt;
&amp;gt; situation like this:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;a href="http://bayimg.com/cAimkAAbn"&gt;http://bayimg.com/cAimkAAbn&lt;/a&gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; In an ideal world, I would need something that could handle even more&lt;br&gt;
&amp;gt; complicated polygons.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; GL&lt;br&gt;
-------&lt;br&gt;
&amp;nbsp;&amp;nbsp;No, that polygon/circle situation should come out fine with the method I &lt;br&gt;
described.  The bottom polygon segment should produce two real t values &lt;br&gt;
lying between -1 and +1.  The next segment on the southeast side would &lt;br&gt;
have two real t's but only one in the above range.  The next segment beyond &lt;br&gt;
that would have a similar result.  The remaining three segments would have &lt;br&gt;
only complex-valued t's.  So that leaves you with four actual points of &lt;br&gt;
intersection.  The midpoint of the arc betweent the first two will lie outside &lt;br&gt;
the polygon, the next arc midpoint is inside, the third arc midpoint is outside, &lt;br&gt;
and finally the arc midpoint between the fourth point and the first is again &lt;br&gt;
inside the polygon.  So you add the arc lengths of the second and fourth of &lt;br&gt;
these arcs and divide by 2*pi to get your percentage.&lt;br&gt;
&lt;br&gt;
Roger Stafford&lt;br&gt;
&lt;br&gt;
</description>
    </item>
  </channel>
</rss>
