Boost C++ Libraries: Ticket #10234: boost::geometry::covered_by wrong results https://svn.boost.org/trac10/ticket/10234 <p> I have a problem with boost::geometry::covered_by method to determine if point is inside polygon or not. In the example below I have point that is exactly out of polygon. Point is far away from polygon by x coordinate (0.1377). The 3rd point of polygon has y-coordinate (4.9999999999999982). And this leads to problem I think. When I change 4.9999999999999982 to 5.00 all is OK. What to do? </p> <pre class="wiki">#include &lt;boost/geometry.hpp&gt; #include &lt;boost/geometry/geometries/point_xy.hpp&gt; #include &lt;boost/geometry/geometries/polygon.hpp&gt; #include &lt;boost/geometry/io/wkt/wkt.hpp&gt; int main() { typedef boost::geometry::model::d2::point_xy&lt;double&gt; bg_point; typedef boost::geometry::model::polygon&lt; bg_point, false, true &gt; bg_polygon; // point is tested (out of polygon) bg_point p(0.1377, 5.00); // polygon bg_polygon poly; boost::geometry::read_wkt("POLYGON((0.1277 4.97, 0.1277 5.00, 0.1278 4.9999999999999982, 0.1278 4.97, 0.1277 4.97))", poly); bool inside; // inside = true here (ERROR!) inside = boost::geometry::covered_by(p, poly); // change 4.9999999999999982 to 5.00 boost::geometry::read_wkt("POLYGON((0.1277 4.97, 0.1277 5.00, 0.1278 5.00, 0.1278 4.97, 0.1277 4.97))", poly); // inside = false here (OK) inside = boost::geometry::covered_by(p, poly); return 0; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10234 Trac 1.4.3 Barend Gehrels Sat, 26 Jul 2014 08:42:55 GMT owner, milestone changed https://svn.boost.org/trac10/ticket/10234#comment:1 https://svn.boost.org/trac10/ticket/10234#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Barend Gehrels</span> to <span class="trac-author">awulkiew</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.56.0</span> </li> </ul> <p> Thanks for the report. Adam, most probably similar problem as you recently solved, can you confirm that? If so, it will be fixed in 1.56 </p> Ticket awulkiew Mon, 04 Aug 2014 12:14:42 GMT <link>https://svn.boost.org/trac10/ticket/10234#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10234#comment:2</guid> <description> <p> Yes, it's fixed. The cause is the same as in <a class="ext-link" href="https://svn.boost.org/trac/boost/ticket/9628"><span class="icon">​</span>https://svn.boost.org/trac/boost/ticket/9628</a>. </p> <p> I also added a test, just in case: <a class="ext-link" href="https://github.com/boostorg/geometry/commit/42cf08658ce632014c14a3bfd70ef020832b296b"><span class="icon">​</span>https://github.com/boostorg/geometry/commit/42cf08658ce632014c14a3bfd70ef020832b296b</a> </p> <p> Should this be resolved as fixed or duplicate? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Barend Gehrels</dc:creator> <pubDate>Mon, 04 Aug 2014 20:19:28 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10234#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10234#comment:3</guid> <description> <p> I would set it to fixed, they have the same cause but this issue states covered_by, the other within, so it is from user-perspective another algorithm that is fixed, and you added a testcase (thanks) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>awulkiew</dc:creator> <pubDate>Tue, 05 Aug 2014 22:05:15 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/10234#comment:4 https://svn.boost.org/trac10/ticket/10234#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket