<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>"MultiPolygon". <span id="result_box" class="" lang="en"><span class=""></span> <span class="">I'm trying to</span> <span class="">apply the same</span> <span class="">logic of</span> <span class="">the</span> <span class="">"polygon"</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 <QtCore><br>#include <QDebug><br><br>#include <boost/geometry.hpp><br>#include <boost/geometry/geometries/point_xy.hpp><br>#include <boost/geometry/geometries/polygon.hpp><br>#include <boost/geometry/multi/geometries/multi_polygon.hpp><br> #include <boost/geometry/algorithms/within.hpp><br><br>#include <iostream><br><br>int main( int argc, char* argv[] )<br>{<br>� QCoreApplication app( argc, argv );<br><br>� typedef boost::geometry::model::d2::point_xy<int> point_xy;<br> � typedef boost::geometry::model::polygon<point_xy> polygon;<br>� typedef boost::geometry::model::multi_polygon<polygon> multi_polygon;<br><br>� multi_polygon p_multi;<br><br>� boost::geometry::read_wkt( "MULTIPOLYGON(((0 0, 0 10, 10 10, 10 0, 0 0)), ((10 5, 10 15, 20 15, 20 5, 10 5)))", p_multi );<br> <br>� int x = 10;<br>� int y = 10;<br><br>� point_xy p( x, y );<br><br>� std::cout << "Within: " << ( boost::geometry::within( p, p_multi ) ? "Yes" : "No" ) << 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>