Boost C++ Libraries: Ticket #11242: Accuray issue with geometry::difference() in version Boost 1.57 (and 1.58) https://svn.boost.org/trac10/ticket/11242 <p> I'm having an accuracy issue with geometry::difference() in Boost v1.57 (and v1.58) that I didn't see with v1.55. The test program is listed below. I compiled using g++ 4.4.7 on Ubuntu 12.04. </p> <p> Result using Boost v1.55: </p> <pre class="wiki"> 249.232 761.09 249.232 760.98 265.89 760.98 265.89 729.219 94.021 729.219 94.021 761.09 249.232 761.09 </pre><p> Result using Boost v1.57 (and v1.58): </p> <pre class="wiki">249.232003466816 761.09 249.232 760.98 265.89 760.979984987659 265.89 729.219 94.021 729.219 94.021 761.09 249.232003466816 761.09 </pre><p> Apparently, it is related to the rescaling policy introduced in v1.56. I can mitigate the issue by defining the BOOST_GEOMETRY_NO_ROBUSTNESS. </p> <p> Best regards, </p> <p> Mikkel B. Stegmann </p> <hr /> <pre class="wiki">#include &lt;boost/foreach.hpp&gt; #include &lt;boost/geometry/geometries/point_xy.hpp&gt; #include &lt;boost/geometry.hpp&gt; #include &lt;cstdio&gt; #include &lt;assert.h&gt; int main() { // 2D point with double precision typedef boost::geometry::model::d2::point_xy&lt;double&gt; BoostPoint; // 2D polygon, ring type: clockwise, closed ("the first point must be spatially equal to the last point") typedef boost::geometry::model::polygon&lt;BoostPoint&gt; BoostPolygon; BoostPolygon rectangleA; rectangleA.outer().push_back(BoostPoint( 94.021, 729.219)); // clock-wise points rectangleA.outer().push_back(BoostPoint( 94.021, 761.090)); rectangleA.outer().push_back(BoostPoint(265.890, 761.090)); rectangleA.outer().push_back(BoostPoint(265.890, 729.219)); rectangleA.outer().push_back(BoostPoint( 94.021, 729.219)); // close BoostPolygon rectangleB; rectangleB.outer().push_back(BoostPoint(249.232, 760.980)); // clock-wise points rectangleB.outer().push_back(BoostPoint(249.232, 780.980)); rectangleB.outer().push_back(BoostPoint(319.232, 780.980)); rectangleB.outer().push_back(BoostPoint(319.232, 760.980)); rectangleB.outer().push_back(BoostPoint(249.232, 760.980)); // close std::list&lt;BoostPolygon&gt; differencePolygons; boost::geometry::difference(rectangleA, rectangleB, differencePolygons); assert(differencePolygons.size()==1); BOOST_FOREACH(const BoostPoint &amp;point, differencePolygons.front().outer()) { printf("%16.15g %16.15g\n", point.x(), point.y()); } return 0; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11242 Trac 1.4.3