Boost C++ Libraries: Ticket #13636: distance calculation can be wrong for rings with collinear segments https://svn.boost.org/trac10/ticket/13636 <p> While unit-testing our code using boost::geometry, I stumbled upon a weird distance calculation: For two rings that are perfect 2d boxes and share the orientation and one segment length, their distance is calculated as zero although they are clearly not intersecting: </p> <p> <a class="ext-link" href="https://wandbox.org/permlink/Z9DMLo52IdhZRCFb"><span class="icon">​</span>https://wandbox.org/permlink/Z9DMLo52IdhZRCFb</a> </p> <p> I made a rough sketch of the situation: <a class="ext-link" href="https://www.desmos.com/calculator/7jbmeu9jqq"><span class="icon">​</span>https://www.desmos.com/calculator/7jbmeu9jqq</a>. </p> <hr /> <p> Note the line </p> <pre class="wiki">// slightly change the values vehicleRing[2] = Point2D(vehicleRing[2].x() + 1e-10, vehicleRing[2].y() + 1e-10); </pre><p> .. changing vehicleRing<a class="missing changeset" title="No changeset 0 in the repository">[0]</a> or vehicleRing<a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">[1]</a> also results in zero distance, whereas slightly moving vehicleRing<a class="changeset" href="https://svn.boost.org/trac10/changeset/2" title="Add Boost Disclaimer">[2]</a> results in the expected distance. </p> <hr /> <p> Sorry for being lazy and not finding a simpler test-case (resp. simpler numbers), I just copied the values I generated in my own testing pipeline. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13636 Trac 1.4.3 stfn <p1433025@…> Tue, 17 Jul 2018 13:22:07 GMT <link>https://svn.boost.org/trac10/ticket/13636#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13636#comment:1</guid> <description> <p> updated example: <a class="ext-link" href="https://wandbox.org/permlink/837NbUIZ7fNNOKEF"><span class="icon">​</span>https://wandbox.org/permlink/837NbUIZ7fNNOKEF</a> </p> </description> <category>Ticket</category> </item> <item> <author>stfn <p1433025@…></author> <pubDate>Tue, 17 Jul 2018 13:25:31 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/13636#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13636#comment:2</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/13636#comment:1" title="Comment 1">stfn &lt;p1433025@…&gt;</a>: </p> <blockquote class="citation"> <p> updated example: <a class="ext-link" href="https://wandbox.org/permlink/837NbUIZ7fNNOKEF"><span class="icon">​</span>https://wandbox.org/permlink/837NbUIZ7fNNOKEF</a> </p> </blockquote> <p> damn! this one: <a class="ext-link" href="https://wandbox.org/permlink/p51mDlCIKOjOTHcW"><span class="icon">​</span>https://wandbox.org/permlink/p51mDlCIKOjOTHcW</a> </p> </description> <category>Ticket</category> </item> </channel> </rss>