Latest SVN version of geos seems to be incomplete: no libtool and lt-main.sh.<br>Also, the nightly release appears to be a broken tar file (at least I cannot open it in my pc)...<br> cheers,<br>            Jo<br><br><div class="gmail_quote">
2009/7/19  <span dir="ltr">&lt;<a href="mailto:geos-devel-request@lists.osgeo.org">geos-devel-request@lists.osgeo.org</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Send geos-devel mailing list submissions to<br>
        <a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://lists.osgeo.org/mailman/listinfo/geos-devel" target="_blank">http://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
or, via email, send a message with subject or body &#39;help&#39; to<br>
        <a href="mailto:geos-devel-request@lists.osgeo.org">geos-devel-request@lists.osgeo.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:geos-devel-owner@lists.osgeo.org">geos-devel-owner@lists.osgeo.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than &quot;Re: Contents of geos-devel digest...&quot;<br>
<br>
<br>
Today&#39;s Topics:<br>
<br>
   1. Computational Geometry Problem (Jo)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Sun, 19 Jul 2009 22:56:53 +0100<br>
From: Jo &lt;<a href="mailto:doublebyte@gmail.com">doublebyte@gmail.com</a>&gt;<br>
Subject: [geos-devel] Computational Geometry Problem<br>
To: <a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>
Message-ID:<br>
        &lt;<a href="mailto:23ab5f0a0907191456l5f8d648i4dce9666abf3dcf8@mail.gmail.com">23ab5f0a0907191456l5f8d648i4dce9666abf3dcf8@mail.gmail.com</a>&gt;<br>
Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<br>
<br>
Hi Sanak,<br>
Thanks a lot for the modified code: it worked on perfection!<br>
Here is a screenshot of a run with my shapefile:<br>
<br>
<a href="http://ladybug.no-ip.org/files/inCircleFinal.png" target="_blank">http://ladybug.no-ip.org/files/inCircleFinal.png</a><br>
<br>
        Have a good rest of the weekend!<br>
                                                             Jo<br>
<br>
2009/7/19 &lt;<a href="mailto:geos-devel-request@lists.osgeo.org">geos-devel-request@lists.osgeo.org</a>&gt;<br>
<br>
&gt; Send geos-devel mailing list submissions to<br>
&gt;        <a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>
&gt;<br>
&gt; To subscribe or unsubscribe via the World Wide Web, visit<br>
&gt;        <a href="http://lists.osgeo.org/mailman/listinfo/geos-devel" target="_blank">http://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
&gt; or, via email, send a message with subject or body &#39;help&#39; to<br>
&gt;        <a href="mailto:geos-devel-request@lists.osgeo.org">geos-devel-request@lists.osgeo.org</a><br>
&gt;<br>
&gt; You can reach the person managing the list at<br>
&gt;        <a href="mailto:geos-devel-owner@lists.osgeo.org">geos-devel-owner@lists.osgeo.org</a><br>
&gt;<br>
&gt; When replying, please edit your Subject line so it is more specific<br>
&gt; than &quot;Re: Contents of geos-devel digest...&quot;<br>
&gt;<br>
&gt;<br>
&gt; Today&#39;s Topics:<br>
&gt;<br>
&gt;   1. Re: Re: Computational Geometry Problem (Sanak Goe)<br>
&gt;<br>
&gt;<br>
&gt; ----------------------------------------------------------------------<br>
&gt;<br>
&gt; Message: 1<br>
&gt; Date: Sun, 19 Jul 2009 21:24:34 +0900<br>
&gt; From: Sanak Goe &lt;<a href="mailto:geosanak@gmail.com">geosanak@gmail.com</a>&gt;<br>
&gt; Subject: Re: [geos-devel] Re: Computational Geometry Problem<br>
&gt; To: GEOS Development List &lt;<a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a>&gt;<br>
&gt; Message-ID:<br>
&gt;        &lt;<a href="mailto:5f9be0a0907190524n5a8de434y38731cf04e7770d0@mail.gmail.com">5f9be0a0907190524n5a8de434y38731cf04e7770d0@mail.gmail.com</a>&gt;<br>
&gt; Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<br>
&gt;<br>
&gt; Skipped content of type multipart/alternative-------------- next part<br>
&gt; --------------<br>
&gt; #include &lt;locale.h&gt;<br>
&gt; #include &lt;iostream&gt;<br>
&gt; #include &lt;vector&gt;<br>
&gt; #include &lt;algorithm&gt;<br>
&gt; #include &lt;stdexcept&gt;<br>
&gt; #include &lt;map&gt; // added by sanak 2009.07.19<br>
&gt; #ifdef _MSC_VER<br>
&gt; #include &lt;io.h&gt;<br>
&gt; #endif // _MSC_VER<br>
&gt;<br>
&gt; //Geos<br>
&gt; #include &lt;geos_c.h&gt;<br>
&gt;<br>
&gt; #include &lt;geos/algorithm/CGAlgorithms.h&gt;<br>
&gt; #include &lt;geos/algorithm/HCoordinate.h&gt;<br>
&gt; #include &lt;geos/geom/Coordinate.h&gt;<br>
&gt; #include &lt;geos/geom/CoordinateArraySequence.h&gt;<br>
&gt; #include &lt;geos/geom/LineString.h&gt;<br>
&gt; #include &lt;geos/geom/MultiPoint.h&gt;<br>
&gt; #include &lt;geos/geom/Point.h&gt;<br>
&gt; #include &lt;geos/geom/Polygon.h&gt;<br>
&gt; #include &lt;geos/io/WKTReader.h&gt;<br>
&gt; #include &lt;geos/io/WKTWriter.h&gt;<br>
&gt;<br>
&gt; // &lt;-- modified by sanak 2009.07.19<br>
&gt; //const double epsilonArea = 100.0;<br>
&gt; const double epsilonRadius = 0.1;<br>
&gt; // --&gt; modified by sanak 2009.07.19<br>
&gt;<br>
&gt; // &lt;-- Boost code<br>
&gt; template &lt; class BidirectionalIterator &gt;<br>
&gt; bool next_combination ( BidirectionalIterator first1 ,<br>
&gt;  BidirectionalIterator last1 ,<br>
&gt;  BidirectionalIterator first2 ,<br>
&gt;  BidirectionalIterator last2 )<br>
&gt; {<br>
&gt;  if (( first1 == last1 ) || ( first2 == last2 )) {<br>
&gt;    return false ;<br>
&gt;  }<br>
&gt;  BidirectionalIterator m1 = last1 ;<br>
&gt;  BidirectionalIterator m2 = last2 ; --m2;<br>
&gt;  while (--m1 != first1 &amp;&amp; !(* m1 &lt; *m2 )){<br>
&gt;  }<br>
&gt;  bool result = (m1 == first1 ) &amp;&amp; !(* first1 &lt; *m2 );<br>
&gt;  if (! result ) {<br>
&gt;    while ( first2 != m2 &amp;&amp; !(* m1 &lt; * first2 )) {<br>
&gt;      ++ first2 ;<br>
&gt;    }<br>
&gt;    first1 = m1;<br>
&gt;    std :: iter_swap (first1 , first2 );<br>
&gt;    ++ first1 ;<br>
&gt;    ++ first2 ;<br>
&gt;  }<br>
&gt;  if (( first1 != last1 ) &amp;&amp; ( first2 != last2 )) {<br>
&gt;    m1 = last1 ; m2 = first2 ;<br>
&gt;    while (( m1 != first1 ) &amp;&amp; (m2 != last2 )) {<br>
&gt;      std :: iter_swap (--m1 , m2 );<br>
&gt;      ++ m2;<br>
&gt;    }<br>
&gt;    std :: reverse (first1 , m1 );<br>
&gt;    std :: reverse (first1 , last1 );<br>
&gt;    std :: reverse (m2 , last2 );<br>
&gt;    std :: reverse (first2 , last2 );<br>
&gt;  }<br>
&gt;  return ! result ;<br>
&gt; }<br>
&gt;<br>
&gt; template &lt; class BidirectionalIterator &gt;<br>
&gt; bool next_combination ( BidirectionalIterator first ,<br>
&gt;  BidirectionalIterator middle ,<br>
&gt;  BidirectionalIterator last )<br>
&gt; {<br>
&gt;  return next_combination (first , middle , middle , last );<br>
&gt; }<br>
&gt; // Boost Code --&gt;<br>
&gt;<br>
&gt; bool computeIncircle(<br>
&gt;                                         const geos::geom::Polygon* poly,<br>
&gt;                                         const geos::geom::Polygon* negbuf,<br>
&gt;                                         geos::geom::Coordinate&amp; center,<br>
&gt;                                         double&amp; radius)<br>
&gt; {<br>
&gt;        radius = 0.0;<br>
&gt;<br>
&gt;        if (negbuf == NULL)<br>
&gt;        {<br>
&gt;                negbuf = poly;<br>
&gt;        }<br>
&gt;<br>
&gt;        try<br>
&gt;        {<br>
&gt;<br>
&gt;                if (!negbuf-&gt;isValid())<br>
&gt;                {<br>
&gt;                        throw std::runtime_error(&quot;Invalid polygon.&quot;);<br>
&gt;                }<br>
&gt;<br>
&gt;                if (negbuf-&gt;getNumInteriorRing() &gt; 0)<br>
&gt;                {<br>
&gt;                        throw std::runtime_error(&quot;This sample only supports<br>
&gt; non-holes polygon.&quot;);<br>
&gt;                }<br>
&gt;<br>
&gt;                const geos::geom::LineString* shell =<br>
&gt; negbuf-&gt;getExteriorRing();<br>
&gt;                geos::geom::CoordinateArraySequence* coords =<br>
&gt; static_cast&lt;geos::geom::CoordinateArraySequence*&gt;(shell-&gt;getCoordinates());<br>
&gt;<br>
&gt;                // compute orientation of ring<br>
&gt;                if (!geos::algorithm::CGAlgorithms::isCCW(coords))<br>
&gt;                {<br>
&gt;                        coords-&gt;reverse(coords);<br>
&gt;                }<br>
&gt;<br>
&gt;                // compute angle bisector of every  continuous three points<br>
&gt; in polygon<br>
&gt;                size_t cnt = coords-&gt;size() - 1;<br>
&gt;                // &lt;-- modified by sanak 2009.07.19<br>
&gt;                //std::vector&lt;geos::algorithm::HCoordinate*&gt; bisects;<br>
&gt;                std::vector&lt;size_t&gt; bisectids;<br>
&gt;                std::map&lt;size_t, geos::algorithm::HCoordinate*&gt; bisects;<br>
&gt;                // --&gt; modified by sanak 2009.07.19<br>
&gt;                for (size_t i = 0; i &lt; cnt; i++)<br>
&gt;                {<br>
&gt;                        size_t prev = (i == 0) ? cnt - 1 : i - 1;<br>
&gt;                        size_t curr = i;<br>
&gt;                        size_t next = (i == cnt - 1) ? 0 : i + 1;<br>
&gt;<br>
&gt;                        // &lt;-- JTS 1.10 Code<br>
&gt;                        geos::geom::Coordinate a = coords-&gt;getAt(prev);<br>
&gt;                        geos::geom::Coordinate b = coords-&gt;getAt(curr);<br>
&gt;                        geos::geom::Coordinate c = coords-&gt;getAt(next);<br>
&gt;<br>
&gt;                        double len0 = b.distance(a);<br>
&gt;                        double len2 = b.distance(c);<br>
&gt;                        double frac = len0 / (len0 + len2);<br>
&gt;                        double dx = c.x - a.x;<br>
&gt;                        double dy = c.y - a.y;<br>
&gt;<br>
&gt;                        geos::geom::Coordinate splitPt =<br>
&gt; geos::geom::Coordinate(a.x + frac * dx, a.y + frac * dy);<br>
&gt;                        // --&gt; JTS 1.10 Code<br>
&gt;                        // &lt;-- modified by sanak 2009.07.19<br>
&gt;                        //bisects.push_back(new<br>
&gt; geos::algorithm::HCoordinate(b, splitPt));<br>
&gt;                        bisectids.push_back(i);<br>
&gt;                        bisects.insert(std::pair&lt;size_t,<br>
&gt; geos::algorithm::HCoordinate*&gt;(i, new geos::algorithm::HCoordinate(b,<br>
&gt; splitPt)));<br>
&gt;                        // --&gt; modified by sanak 2009.07.19<br>
&gt;                }<br>
&gt;<br>
&gt;                // get intersection points of angle bisectors<br>
&gt;                geos::geom::CoordinateArraySequence intsects;<br>
&gt;                do<br>
&gt;                {<br>
&gt;                        // &lt;-- modified by sanak 2009.07.19<br>
&gt;                        //geos::algorithm::HCoordinate* hc0 = bisects[0];<br>
&gt;                        //geos::algorithm::HCoordinate* hc1 = bisects[1];<br>
&gt;                        geos::algorithm::HCoordinate* hc0 =<br>
&gt; bisects[bisectids[0]];<br>
&gt;                        geos::algorithm::HCoordinate* hc1 =<br>
&gt; bisects[bisectids[1]];<br>
&gt;                        // --&gt; modified by sanak 2009.07.19<br>
&gt;                        geos::algorithm::HCoordinate* hcoord = new<br>
&gt; geos::algorithm::HCoordinate(*hc0, *hc1);<br>
&gt;                        try<br>
&gt;                        {<br>
&gt;                                // get intersection<br>
&gt;                                geos::geom::Coordinate coord =<br>
&gt; geos::geom::Coordinate(hcoord-&gt;getX(), hcoord-&gt;getY());<br>
&gt;<br>
&gt;                                // TODO:remove duplicate point<br>
&gt;                                intsects.add(coord);<br>
&gt;                        }<br>
&gt;                        catch (std::exception&amp; ex)<br>
&gt;                        {<br>
&gt;                                // no intersection<br>
&gt;                        }<br>
&gt;                        if (hcoord)<br>
&gt;                        {<br>
&gt;                                delete hcoord;<br>
&gt;                        }<br>
&gt;                }<br>
&gt;                // &lt;-- modified by sanak 2009.07.19<br>
&gt;                //while (next_combination(bisects.begin(), bisects.begin() +<br>
&gt; 2, bisects.end()));<br>
&gt;                while (next_combination(bisectids.begin(), bisectids.begin()<br>
&gt; + 2, bisectids.end()));<br>
&gt;                // --&gt; modified by sanak 2009.07.19<br>
&gt;<br>
&gt;                // clean up<br>
&gt;                if (bisects.size() &gt; 0)<br>
&gt;                {<br>
&gt;                        std::cout &lt;&lt; &quot;bissects ok.&quot; &lt;&lt; std::endl;<br>
&gt;                        // &lt;-- modified by sanak 2009.07.19<br>
&gt;<br>
&gt;  //std::vector&lt;geos::algorithm::HCoordinate*&gt;::iterator it;<br>
&gt;                        //for (it = bisects.begin(); it != bisects.end();<br>
&gt; it++)<br>
&gt;                        //{<br>
&gt;                        //      delete *it;<br>
&gt;                        //}<br>
&gt;                        std::map&lt;size_t,<br>
&gt; geos::algorithm::HCoordinate*&gt;::iterator it;<br>
&gt;                        for (it = bisects.begin(); it != bisects.end();<br>
&gt; it++)<br>
&gt;                        {<br>
&gt;                                delete it-&gt;second;<br>
&gt;                        }<br>
&gt;                        // --&gt; modified by sanak 2009.07.19<br>
&gt;                }<br>
&gt;                else<br>
&gt;                std::cout &lt;&lt; &quot;No bissects.&quot; &lt;&lt; std::endl;<br>
&gt;<br>
&gt;                std::cout &lt;&lt; &quot;intsects.size()&quot; &lt;&lt; intsects.size() &lt;&lt;<br>
&gt;  std::endl;<br>
&gt;                if (intsects.size() &gt; 0)<br>
&gt;                {<br>
&gt;                        std::cout &lt;&lt; &quot;intsects ok.&quot; &lt;&lt; std::endl;<br>
&gt;<br>
&gt;                        geos::geom::Point* incenter = NULL;<br>
&gt;<br>
&gt;                        geos::geom::GeometryFactory factory;<br>
&gt;                        const geos::geom::LineString* line =<br>
&gt; poly-&gt;getExteriorRing();<br>
&gt;                        //geos::geom::MultiPoint* rcpoints =<br>
&gt; factory.createMultiPoint(intsects); // for debug<br>
&gt;<br>
&gt;                        std::vector&lt;geos::geom::Coordinate*&gt;::iterator it;<br>
&gt;                        for (size_t i = 0; i &lt; intsects.size(); i++)<br>
&gt;                        {<br>
&gt;                                geos::geom::Coordinate coord = intsects[i];<br>
&gt;                                // exclude points that are outer of polygon<br>
&gt;                                if<br>
&gt; (geos::algorithm::CGAlgorithms::isPointInRing(coord, coords))<br>
&gt;                                {<br>
&gt;                                        geos::geom::Point* point =<br>
&gt; factory.createPoint(coord);<br>
&gt;                                        // compute distance from every<br>
&gt; candidates of centres to polygon, and choose largest one<br>
&gt;                                        double distance =<br>
&gt; line-&gt;distance(point);<br>
&gt;                                        if (radius &lt; distance)<br>
&gt;                                        {<br>
&gt;                                                radius = distance;<br>
&gt;                                                incenter = point;<br>
&gt;                                        }<br>
&gt;                                }<br>
&gt;                                //else std::cout &lt;&lt; &quot;Point not in Ring.&quot; &lt;&lt;<br>
&gt; std::endl;<br>
&gt;                        }<br>
&gt;<br>
&gt;                        if (incenter != NULL &amp;&amp; radius != 0.0)<br>
&gt;                        {<br>
&gt;                                        geos::io::WKTWriter writer;<br>
&gt;                                        std::cout &lt;&lt; &quot;wkt : &quot; &lt;&lt;<br>
&gt; writer.write(incenter) &lt;&lt; std::endl;<br>
&gt;                                        std::cout &lt;&lt; &quot;radius : &quot; &lt;&lt; radius<br>
&gt; &lt;&lt; std::endl;<br>
&gt;<br>
&gt;                                center.x = incenter-&gt;getX();<br>
&gt;                                center.y = incenter-&gt;getY();<br>
&gt;                                //return true; // deleted by sanak<br>
&gt; 2009.07.19<br>
&gt;                        }<br>
&gt;                        // &lt;-- added by sanak 2009.07.19<br>
&gt;                        else<br>
&gt;                        {<br>
&gt;                                geos::geom::Point* intPt =<br>
&gt; negbuf-&gt;getInteriorPoint();<br>
&gt;                                center.x = intPt-&gt;getX();<br>
&gt;                                center.y = intPt-&gt;getY();<br>
&gt;                                radius = line-&gt;distance(intPt);<br>
&gt;                        }<br>
&gt;                        return true;<br>
&gt;                        // --&gt; added by sanak 2009.07.19<br>
&gt;                }<br>
&gt;                else<br>
&gt;                {<br>
&gt;                        std::cout &lt;&lt; &quot;No intsects.&quot; &lt;&lt; std::endl;<br>
&gt;                        throw std::runtime_error(&quot;Couldn&#39;t get incenter.&quot;);<br>
&gt;                }<br>
&gt;        }<br>
&gt;        catch (std::exception&amp; ex)<br>
&gt;        {<br>
&gt;                std::cerr &lt;&lt; &quot;Exception : &quot; &lt;&lt; ex.what() &lt;&lt; std::endl;<br>
&gt;                throw ex;<br>
&gt;                return false;<br>
&gt;        }<br>
&gt;        return false;<br>
&gt; }<br>
&gt;<br>
&gt; int main(int argc, char* argv[])<br>
&gt; {<br>
&gt;        // check stdin<br>
&gt; #ifdef _MSC_VER<br>
&gt;        if (::_isatty(fileno(stdin)))<br>
&gt; #else<br>
&gt;        if (::isatty(fileno(stdin)))<br>
&gt; #endif // _MSC_VER<br>
&gt;        {<br>
&gt;                std::cerr &lt;&lt; &quot;Usage: %s &lt; [wktfile(polygon)]&quot; &lt;&lt; std::endl;<br>
&gt;                return -1;<br>
&gt;        }<br>
&gt;<br>
&gt;        std::string line;<br>
&gt;        geos::io::WKTReader reader;<br>
&gt;        std::vector&lt;geos::geom::Polygon*&gt; g;<br>
&gt;        while (getline(std::cin, line, &#39;\n&#39;))<br>
&gt;        {<br>
&gt;                //std::cout &lt;&lt; line &lt;&lt; std::endl;<br>
&gt;                geos::geom::Polygon* geom =<br>
&gt;                static_cast&lt;geos::geom::Polygon*&gt;(reader.read(line));<br>
&gt;<br>
&gt;                if (geom == NULL &amp;&amp; geom-&gt;getGeometryType() != &quot;Polygon&quot;)<br>
&gt;                {<br>
&gt;                        throw std::runtime_error(&quot;This sample only supports<br>
&gt; polygon geometry&quot;);<br>
&gt;                }<br>
&gt;<br>
&gt;                geos::geom::Polygon* poly =<br>
&gt; static_cast&lt;geos::geom::Polygon*&gt;(geom);<br>
&gt;                if (!poly-&gt;isValid())<br>
&gt;                {<br>
&gt;                        throw std::runtime_error(&quot;Invalid polygon.&quot;);<br>
&gt;                }<br>
&gt;<br>
&gt;                if (poly-&gt;getNumInteriorRing() &gt; 0)<br>
&gt;                {<br>
&gt;                        throw std::runtime_error(&quot;This sample only supports<br>
&gt; non-holes polygon.&quot;);<br>
&gt;                }<br>
&gt;<br>
&gt;                g.push_back(poly);<br>
&gt;        }<br>
&gt;<br>
&gt;<br>
&gt;        try<br>
&gt;        {<br>
&gt;<br>
&gt;                for (int i=0 ; i &lt; g.size(); ++i)<br>
&gt;                {<br>
&gt;                        geos::geom::Polygon* negbuf = NULL;<br>
&gt;                        double prevRadius = 0.0; // added by sanak<br>
&gt; 2009.07.19<br>
&gt;                        while (true)<br>
&gt;                        {<br>
&gt;                                geos::geom::Coordinate center;<br>
&gt;                                double radius = 0.0;<br>
&gt;                                if (computeIncircle(g[i], negbuf, center,<br>
&gt; radius))<br>
&gt;                                {<br>
&gt;                                        // &lt;-- modified by sanak 2009.07.19<br>
&gt;                                        //negbuf =<br>
&gt; static_cast&lt;geos::geom::Polygon*&gt;(g[i]-&gt;buffer(-radius));<br>
&gt;                                        //if (negbuf == NULL &amp;&amp;<br>
&gt; negbuf-&gt;getGeometryType() != &quot;Polygon&quot;)<br>
&gt;                                        //{<br>
&gt;                                        //      // TODO:<br>
&gt;                                        //      throw<br>
&gt; std::runtime_error(&quot;Intercepted!!!!!!!&quot;);<br>
&gt;                                        //}<br>
&gt;                                        //double area = negbuf-&gt;getArea();<br>
&gt;<br>
&gt;                                        //if (area &lt; epsilonArea)<br>
&gt;                                        geos::geom::Geometry* buf =<br>
&gt; g[i]-&gt;buffer(-(radius));<br>
&gt;                                        std::string buftype =<br>
&gt; buf-&gt;getGeometryType();<br>
&gt;                                        if (buftype == &quot;Polygon&quot;)<br>
&gt;                                        {<br>
&gt;                                                negbuf =<br>
&gt; static_cast&lt;geos::geom::Polygon*&gt;(buf);<br>
&gt;                                        }<br>
&gt;                                        else if (buftype == &quot;MultiPolygon&quot;)<br>
&gt;                                        {<br>
&gt;                                                size_t cnt =<br>
&gt; buf-&gt;getNumGeometries();<br>
&gt;                                                double maxradius = 0.0;<br>
&gt;                                                double tmpradius = 0.0;<br>
&gt;                                                geos::geom::Coordinate<br>
&gt; tmpcenter;<br>
&gt;                                                for (size_t j = 0; j &lt; cnt;<br>
&gt; j++)<br>
&gt;                                                {<br>
&gt;                                                        const<br>
&gt; geos::geom::Polygon* item = static_cast&lt;const<br>
&gt; geos::geom::Polygon*&gt;(buf-&gt;getGeometryN(j));<br>
&gt;                                                        if<br>
&gt; (computeIncircle(g[i], item, tmpcenter, tmpradius))<br>
&gt;                                                        {<br>
&gt;                                                                if<br>
&gt; (tmpradius &gt; maxradius)<br>
&gt;                                                                {<br>
&gt;<br>
&gt;  negbuf = static_cast&lt;geos::geom::Polygon*&gt;(item-&gt;clone());<br>
&gt;<br>
&gt;  center = tmpcenter;<br>
&gt;<br>
&gt;  radius = tmpradius;<br>
&gt;<br>
&gt;  maxradius = tmpradius;<br>
&gt;                                                                }<br>
&gt;                                                        }<br>
&gt;                                                }<br>
&gt;                                        }<br>
&gt;<br>
&gt;                                        if ((radius - prevRadius) &lt;<br>
&gt; epsilonRadius)<br>
&gt;                                        // --&gt; modified by sanak 2009.07.19<br>
&gt;                                        {<br>
&gt;<br>
&gt;                                                std::cout &lt;&lt; &quot;center : &quot; &lt;&lt;<br>
&gt; center.toString() &lt;&lt; std::endl;<br>
&gt;                                                std::cout &lt;&lt; &quot;radius : &quot; &lt;&lt;<br>
&gt; radius &lt;&lt; std::endl;<br>
&gt;                                                geos::geom::GeometryFactory<br>
&gt; factory;<br>
&gt;                                                geos::geom::Point* centerPt<br>
&gt; = factory.createPoint(center);<br>
&gt;                                                geos::geom::Geometry*<br>
&gt; incircle = centerPt-&gt;buffer(radius);<br>
&gt;                                                geos::io::WKTWriter writer;<br>
&gt;                                                std::cout &lt;&lt; &quot;wkt : &quot; &lt;&lt;<br>
&gt; writer.write(incircle) &lt;&lt; std::endl;<br>
&gt;                                                // &lt;-- modified by sanak<br>
&gt; 2009.07.19<br>
&gt;                                                //return 0;<br>
&gt;                                                break;<br>
&gt;                                                // --&gt; modified by sanak<br>
&gt; 2009.07.19<br>
&gt;                                        }<br>
&gt;                                        prevRadius = radius; // added by<br>
&gt; sanak 2009.07.19<br>
&gt;                                }<br>
&gt;                                else<br>
&gt;                                {<br>
&gt;                                        std::cout &lt;&lt; &quot;Could not compute!&quot; &lt;&lt;<br>
&gt; std::endl;<br>
&gt;                                        return -2;<br>
&gt;                                }<br>
&gt;                        }<br>
&gt;                }<br>
&gt;        }<br>
&gt;        catch (std::exception&amp; ex)<br>
&gt;        {<br>
&gt;                std::cerr &lt;&lt; &quot;Exception : &quot; &lt;&lt; ex.what() &lt;&lt; std::endl;<br>
&gt;                return -3;<br>
&gt;        }<br>
&gt;<br>
&gt;        return 0;<br>
&gt; }<br>
&gt;<br>
&gt; ------------------------------<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; geos-devel mailing list<br>
&gt; <a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>
&gt; <a href="http://lists.osgeo.org/mailman/listinfo/geos-devel" target="_blank">http://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
&gt;<br>
&gt; End of geos-devel Digest, Vol 81, Issue 13<br>
&gt; ******************************************<br>
&gt;<br>
<br>
<br>
<br>
--<br>
&quot;#define QUESTION ((bb) || !(bb))&quot;  (Shakespeare)<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.osgeo.org/pipermail/geos-devel/attachments/20090719/f83b16e1/attachment.html" target="_blank">http://lists.osgeo.org/pipermail/geos-devel/attachments/20090719/f83b16e1/attachment.html</a><br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
geos-devel mailing list<br>
<a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/geos-devel" target="_blank">http://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
<br>
End of geos-devel Digest, Vol 81, Issue 14<br>
******************************************<br>
</blockquote></div><br><br clear="all"><br>-- <br>&quot;#define QUESTION ((bb) || !(bb))&quot;  (Shakespeare)<br><br>