Boost C++ Libraries: Ticket #7462: geometry::union_ yields degenerated results https://svn.boost.org/trac10/ticket/7462 <p> The following data gives wrong results with geometry::union. </p> <pre class="wiki">float data1[][2] = {{0,0}, {-0.3681253195,0.9297761917}, {2.421203136,2.034152031}, {2.789328575,1.104375958}, {0,0}}; float data2[][2] = {{2.76143527,1.093332171}, {2.076887131,1.822299719}, {4.263789177,3.875944376}, {4.948337555,3.146976948}, {2.76143527,1.093332171}}; polygon_t p1, p2; boost::geometry::append(p1, data1); boost::geometry::append(p2, data2); std::vector&lt;polygon_t&gt; output; boost::geometry::union_(p1, p2, output); </pre><p> Please find attached the whole main file and program output. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7462 Trac 1.4.3 Danvil <danvil@…> Tue, 02 Oct 2012 22:26:42 GMT attachment set https://svn.boost.org/trac10/ticket/7462 https://svn.boost.org/trac10/ticket/7462 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_geometry_union_bug.cpp</span> </li> </ul> Ticket Danvil <danvil@…> Tue, 02 Oct 2012 22:27:44 GMT attachment set https://svn.boost.org/trac10/ticket/7462 https://svn.boost.org/trac10/ticket/7462 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_geometry_union_bug_output.txt</span> </li> </ul> Ticket Danvil <danvil@…> Tue, 02 Oct 2012 22:31:04 GMT <link>https://svn.boost.org/trac10/ticket/7462#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7462#comment:1</guid> <description> <p> Actually union(p1,p2) yields a degenerated polygon while union(p2,p1) gives the correct result. In my use case, wrong results occur in ~0.5% of the cases. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Barend Gehrels</dc:creator> <pubDate>Sun, 17 Mar 2013 21:26:03 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7462#comment:2 https://svn.boost.org/trac10/ticket/7462#comment:2 <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> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/83481" title="[geometry] Fix ticket 7462, degenerate union for float. This was ...">[83481]</a>) [geometry] Fix ticket 7462, degenerate union for float. This was caused by two distances being wrong (by floating point precision). We now use earlier the alternative sort method (sorting on left/right), using relaxed_epsilon. This fixes the cause. </p> Ticket Barend Gehrels Sun, 17 Mar 2013 21:31:23 GMT <link>https://svn.boost.org/trac10/ticket/7462#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7462#comment:3</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/83482" title="[geometry] Fix ticket 7462, (unit tests)">[83482]</a>) [geometry] Fix ticket 7462, (unit tests) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Tue, 19 Mar 2013 14:03:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7462#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7462#comment:4</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/7462#comment:3" title="Comment 3">barendgehrels</a>: </p> <blockquote class="citation"> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/83482" title="[geometry] Fix ticket 7462, (unit tests)">[83482]</a>) [geometry] Fix ticket 7462, (unit tests) </p> </blockquote> <p> Thanks for fixing this! </p> </description> <category>Ticket</category> </item> </channel> </rss>