Boost C++ Libraries: Ticket #10421: Wrong Pt/Box distance/comparable_distance results in spherical CS https://svn.boost.org/trac10/ticket/10421 <p> distance(Pt, Box) and comparable_distance(Pt, Box) returns invalid results in some cases, or at least not-corresponding to the <a class="missing wiki">Pt/Pt</a> versions. E.g. for: </p> <pre class="wiki"> point target(10.932501600000000, 59.922640600000001); point pt(10.7535660, 59.9131705); point pmin(10.187599199999999, 59.747306700000003); point pmax(10.753619700000000, 59.917844000000002); box bounding_box(pmin, pmax); bool target_inside_box = bg::covered_by(target, bounding_box); bool point_inside_box = bg::covered_by(pt, bounding_box); // the same for bg::comparable_distance() double dp = bg::distance(target, pt); double db = bg::distance(target, bounding_box); double dm = bg::distance(target, pmax); </pre><p> The results are: </p> <pre class="wiki"> target inside box = FALSE point inside box = TRUE target to point = 0.00157408 target to box = 0.178946 target to max = 0.00156704 </pre><p> Since the point lies inside the box and target outside the box the distance from target to box should be smaller than from target to point. </p> <p> This bug affects the R-tree and is related with this ticket: <a class="ext-link" href="https://svn.boost.org/trac/boost/ticket/9759"><span class="icon">​</span>boost::geometry::index::rtree does not work properly spherical_equatorial</a>. </p> <p> EDIT: The algorithm uses the cartesian pythagoras_point_box strategy to calculate the distance. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10421 Trac 1.4.3 awulkiew Fri, 29 Aug 2014 12:13:26 GMT attachment set https://svn.boost.org/trac10/ticket/10421 https://svn.boost.org/trac10/ticket/10421 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">spherical_pt_box_distance_test.cpp</span> </li> </ul> <p> Isolated failing test case. </p> Ticket awulkiew Fri, 29 Aug 2014 12:14:26 GMT attachment set https://svn.boost.org/trac10/ticket/10421 https://svn.boost.org/trac10/ticket/10421 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">test_boost_geo2_index.cc</span> </li> </ul> <p> The R-tree test exposing the bug. </p> Ticket awulkiew Fri, 29 Aug 2014 12:38:08 GMT attachment set https://svn.boost.org/trac10/ticket/10421 https://svn.boost.org/trac10/ticket/10421 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">test_boost_geo2_data.h</span> </li> </ul> <p> The file containing data required by the R-tree test. The original ~30k named Points trimmed to fit the trac requirements. </p> Ticket awulkiew Fri, 29 Aug 2014 13:18:21 GMT description changed https://svn.boost.org/trac10/ticket/10421#comment:1 https://svn.boost.org/trac10/ticket/10421#comment:1 <ul> <li><strong>description</strong> modified (<a href="/trac10/ticket/10421?action=diff&amp;version=1">diff</a>) </li> </ul> Ticket awulkiew Sat, 18 Oct 2014 15:42:54 GMT status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/10421#comment:2 https://svn.boost.org/trac10/ticket/10421#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> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.57.0</span> </li> </ul> Ticket