Boost C++ Libraries: Ticket #13571: difference results in invalid output https://svn.boost.org/trac10/ticket/13571 <p> The difference of the following polygons results in invalid output: </p> <p> using point_type = boost::geometry::model::d2::point_xy&lt;double&gt;; typedef boost::geometry::model::ring&lt;point_type, false, true&gt; polygon; <em> ring&lt;Point, <a class="missing wiki">ClockWise</a>, Closed, ..&gt; </em></p> <p> polygon op1, op2; </p> <p> boost::geometry::read_wkt("POLYGON((-5.357134899522904 1.708858148436605, -5.357046447070072 1.70877395054338, -5.210065937318399 -4.255706093497865, -8.65742840572935 -7.877265427733816, -9.246259311414669 -8.490599384498884, -8.647097810281494 -9.763145957490103, -5.287187110528729 -8.539478296007726, 4.07689365108185 -12.90390576571258, 6.997906000870004 3.116694062477888, -3.776939893600782 18.69699618899459, -3.858843408040787 18.57007309862488, -2.981468369027455 17.54675359552481, -4.116369566376584 2.772428265346094, -5.357134899522904 1.708858148436605))", op1); boost::geometry::read_wkt("POLYGON((-8.382184938267567 -5.157754480221099, -11.2072487852155 -5.954897113329205, -12.6412056272337 -8.516183878234685, -11.8440629941256 -11.34124772518262, -9.282776229220117 -12.77520456720082, -6.457712382272181 -11.97806193409271, -5.023755540253982 -9.416775169187234, -5.820898173362086 -6.591711322239298, -8.382184938267567 -5.157754480221099))", op2); boost::geometry::validity_failure_type type0 = boost::geometry::no_failure; bool v0 = boost::geometry::is_valid(op1, type0); </p> <p> boost::geometry::validity_failure_type type1 = boost::geometry::no_failure; bool v1 = boost::geometry::is_valid(op2, type1); </p> <p> std::vector&lt;polygon&gt; polyOutTemp; boost::geometry::difference(op1, op2, polyOutTemp); </p> <p> boost::geometry::validity_failure_type type3 = boost::geometry::no_failure; bool v2 = boost::geometry::is_valid(polyOutTemp<a class="missing changeset" title="No changeset 0 in the repository">[0]</a>, type3); </p> <p> polyOutTemp<a class="missing changeset" title="No changeset 0 in the repository">[0]</a> is invalid because of self intersections. It seems to be a precision issue, since the self intersection occurs in a part of the polygon that should not affected by the difference algorithm. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13571 Trac 1.4.3