Boost C++ Libraries: Ticket #9563: boost::geometry:sym_difference fails when called with two polygons with almost identical points https://svn.boost.org/trac10/ticket/9563 <p> Dear Boost Contributors, </p> <p> First of all thanks a lot for all your great work. </p> <p> I ran into a special case which seems to fail using e.g. boost::geometry:sym_difference. </p> <p> In the below example I have the two polygons shown in the attached image. Their points are distributed like on an ellipse. The first polygon having 6 points, while the second have 12 points on an ellipse with "almost" identical parameters. </p> <p> Now using those two polygons causes e.g sym_difference to wrongly returns 0 polygons. </p> <p> void Test_SymDifference() { </p> <blockquote> <p> typedef boost::geometry::model::polygon&lt;boost::geometry::model::d2::point_xy&lt;double&gt; &gt; polygon; </p> </blockquote> <blockquote> <p> polygon Poly1, Poly2; </p> </blockquote> <blockquote> <p> boost::geometry::read_wkt("POLYGON((16.4030230586813990 21.4147098480789640, 17.3451877762964380 14.8677773110138890, 11.9421647176150360 6.4530674629349205, 5.5969769413186015 4.5852901519210345, 4.6548122237035621 11.1322226889861170, 10.0578352823849610 19.5469325370650790, 16.4030230586813990 21.4147098480789640, 16.4030230586813990 21.4147098480789640))", Poly1); </p> </blockquote> <p> </p> <blockquote> <p> boost::geometry::read_wkt("POLYGON((16.4030230586814020 21.414709848078967, 17.7828326880709360 18.936596729241124, 17.3451877762964410 14.867777311013885, 15.2073549240394820 10.298488470659295, 11.9421647176150340 6.4530674629349125, 8.4245222359685457 4.3618917414181650, 5.5969769413185944 4.5852901519210292, 4.2171673119290620 7.0634032707588670, 4.6548122237035567 11.132222688986115, 6.7926450759605128 15.701511529340699, 10.0578352823849570 19.546932537065082, 13.5754777640314510 21.638108258581831, 16.4030230586814020 21.414709848078967))", Poly2); </p> </blockquote> <blockquote> <p> boost::geometry::model::multi_polygon&lt;polygon&gt; Result; </p> </blockquote> <blockquote> <p> sym_difference(Poly1, Poly2, Result); </p> </blockquote> <blockquote> <p> _ASSERTE(Result.size() &gt; 0); </p> </blockquote> <p> } </p> <p> If it is something I am doing wrong or if I can be of additional help please let me know </p> <p> Best regards </p> <p> Johan </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9563 Trac 1.4.3 Johan Doré <jdh@…> Sun, 12 Jan 2014 13:32:03 GMT attachment set https://svn.boost.org/trac10/ticket/9563 https://svn.boost.org/trac10/ticket/9563 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">TwoPolygons.jpg</span> </li> </ul> <p> Plot showing the two polygons </p> Ticket Barend Gehrels Sat, 18 Jan 2014 17:19:30 GMT status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/9563#comment:1 https://svn.boost.org/trac10/ticket/9563#comment:1 <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> <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 your report and for your nice words. </p> <p> I was able to reproduce your issue on the development branch, so indeed it fails in Boost 1.55 and all lower versions. </p> <p> There was already a current action to make all overlay operations more robust, which is done in a separate git-branch. Your cases is tested there, and added as a standard unit test. It is already fixed by these actions, so that is good news. </p> <p> I mark this bug as fixed, though it still has to be merged back (somewhere coming weeks) in the development branch and (later) master branch. But it will be available in Boost 1.56 </p> Ticket anonymous Wed, 06 Aug 2014 19:47:10 GMT <link>https://svn.boost.org/trac10/ticket/9563#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9563#comment:2</guid> <description> <p> Great. </p> <p> I downloaded the 1.56 beta and checked that it is now working. </p> <p> Thanks a lot for all your great work. </p> <p> Best regards </p> <p> Johan </p> </description> <category>Ticket</category> </item> </channel> </rss>