<div dir="ltr"><div><span id="result_box" class="" lang="en"><span class="">Hello</span> <span class="">guys,<br></span></span><br clear="all"><span id="result_box" class="" lang="en"><span class="">I need to find</span> <span class="">a point within</span> <span class=""></span></span>&quot;MultiPolygon&quot;. <span id="result_box" class="" lang="en"><span class=""></span> <span class="">I&#39;m trying to</span> <span class="">apply the same</span> <span class="">logic of</span> <span class="">the</span> <span class="">&quot;polygon&quot;</span> <span class="">example</span><span>:<br>
<br><a href="http://www.boost.org/doc/libs/1_54_0/libs/geometry/doc/html/geometry/reference/algorithms/within/within_2.html">http://www.boost.org/doc/libs/1_54_0/libs/geometry/doc/html/geometry/reference/algorithms/within/within_2.html</a><br>
<br></span></span><span id="result_box" class="" lang="en"><span><span id="result_box" class="" lang="en"><span class="">But</span> <span class="">not</span> <span class="">to the point</span> <span class="">the result</span> <span class="">is always</span> <span class="">not found. </span></span></span></span><span id="result_box" class="" lang="en"><span class="">Could someone help me</span><span class="">?<br>
<br></span></span><span id="result_box" class="" lang="en"><span class="">The following</span> <span class="">code</span><span>:</span></span><br><br>---------------------------------------------------------------------------------------------------------------<br>
#include &lt;QtCore&gt;<br>#include &lt;QDebug&gt;<br><br>#include &lt;boost/geometry.hpp&gt;<br>#include &lt;boost/geometry/geometries/point_xy.hpp&gt;<br>#include &lt;boost/geometry/geometries/polygon.hpp&gt;<br>#include &lt;boost/geometry/multi/geometries/multi_polygon.hpp&gt;<br>
#include &lt;boost/geometry/algorithms/within.hpp&gt;<br><br>#include &lt;iostream&gt;<br><br>int main( int argc, char* argv[] )<br>{<br>� QCoreApplication app( argc, argv );<br><br>� typedef boost::geometry::model::d2::point_xy&lt;int&gt; point_xy;<br>
� typedef boost::geometry::model::polygon&lt;point_xy&gt; polygon;<br>� typedef boost::geometry::model::multi_polygon&lt;polygon&gt; multi_polygon;<br><br>� multi_polygon p_multi;<br><br>� boost::geometry::read_wkt( &quot;MULTIPOLYGON(((0 0, 0 10, 10 10, 10 0, 0 0)), ((10 5, 10 15, 20 15, 20 5, 10 5)))&quot;, p_multi );<br>
<br>� int x = 10;<br>� int y = 10;<br><br>� point_xy p( x, y );<br><br>� std::cout &lt;&lt; &quot;Within: &quot; &lt;&lt; ( boost::geometry::within( p, p_multi ) ? &quot;Yes&quot; : &quot;No&quot; ) &lt;&lt; std::endl;<br>
� return app.exec();<br>}<br><br>---------------------------------------------------------------------------------------------------------------<br><br><span id="result_box" class="" lang="en"><span class="">Always results</span> <span class="">(</span></span><span id="result_box" class="" lang="en"><span class="">Within: No) for any</span> <span class="">geometric</span> <span class="">point</span><span class="">!</span></span><br>
</div><br>Boost Version: 1.54.0<br><div><br></div><div>Regards,<br><br>EDM.<br></div><div><br>-- <br>Ederson de Moura<br><a href="http://sites.google.com/site/edersondemoura/">http://sites.google.com/site/edersondemoura/</a>
</div></div>