Boost C++ Libraries: Ticket #12663: geometry::equals fails when points differ by small value https://svn.boost.org/trac10/ticket/12663 <p> It seems the geometry::equals function is very strict when dealing w/ floating point precision. I have 2 polygons that are the same except for one point (15.0, 10.0) vs (14.9999999999, 10.0), but geometry::equals returns false. I don't know if this is a bug or the expected behavior. What is the tolerance and is there a way to specify it? </p> <p> bg_polygon polygon1; boost::geometry::read_wkt("POLYGON((10.0 10.0, 10.0 20.0, 15.0 20.0, 14.9999999999 10.0, 10.0 10.0))", polygon1); </p> <p> bg_polygon polygon2; boost::geometry::read_wkt("POLYGON((10.0 10.0, 10.0 20.0, 15.0 20.0, 15.0 10.0, 10.0 10.0))", polygon2); </p> <p> boost::geometry::equals(polygon1, polygon2); --&gt; returns false </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12663 Trac 1.4.3 awulkiew Wed, 28 Dec 2016 13:30:20 GMT type changed https://svn.boost.org/trac10/ticket/12663#comment:1 https://svn.boost.org/trac10/ticket/12663#comment:1 <ul> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Support Requests</span> </li> </ul> <p> Yes, this is expected. Points are compared WRT machine epsilon scaled by the greater coordinate absolute value. Currently it's not possible to pass user-defined epsilon value into algorithms which could be used in Point comparisons. It'd be possible to implement custom coordinate type with comparison operator using greater epsilon but this way this comparison method would be used in every case, not only when Points were compared. </p> Ticket