Boost C++ Libraries: Ticket #13353: Distance segment-box wrong result for spherical CS https://svn.boost.org/trac10/ticket/13353 <p> The distance algorithm for segment-box for spherical CS does not treat correctly some cases. For example when the segment endpoints are not inside the box but the segment intersects it (because of curvature, segment follow a geodesic/great circle but box horizontal segment not). An example code follows: </p> <pre class="wiki">#include &lt;iostream&gt; #include &lt;boost/geometry.hpp&gt; #include &lt;boost/geometry/geometries/point_xy.hpp&gt; namespace bg = boost::geometry; template &lt;typename point, typename CT&gt; void test_all_geometry_types(CT radius_multiplier) { bg::model::segment&lt;point&gt; s; bg::model::box&lt;point&gt; b; std::cout.precision(15); { bg::read_wkt("SEGMENT(10 9.99, 20 9.99)", s); bg::read_wkt("BOX(10 10, 20 20)", b); std::cout &lt;&lt; "dist=" &lt;&lt; bg::distance(b, s) * radius_multiplier &lt;&lt; std::endl; std::cout &lt;&lt; "disj=" &lt;&lt; bg::disjoint(b, s) &lt;&lt; std::endl; } { bg::read_wkt("SEGMENT(10 10, 20 10)", s); bg::read_wkt("BOX(10 10, 20 20)", b); std::cout &lt;&lt; "dist=" &lt;&lt; bg::distance(b, s) * radius_multiplier &lt;&lt; std::endl; std::cout &lt;&lt; "disj=" &lt;&lt; bg::disjoint(b, s) &lt;&lt; std::endl; } } int main() { typedef double CT; std::cout &lt;&lt; "Cartesian" &lt;&lt; std::endl; typedef bg::model::point&lt;CT, 2, bg::cs::cartesian &gt; cpoint; test_all_geometry_types&lt;cpoint&gt;(1); std::cout &lt;&lt; "Spherical" &lt;&lt; std::endl; typedef bg::model::point&lt;CT, 2, bg::cs::spherical_equatorial&lt;bg::degree&gt; &gt; spoint; test_all_geometry_types&lt;spoint&gt;(bg::formula::mean_radius&lt;CT&gt;(bg::srs::spheroid&lt;CT&gt;())); return 0; } </pre><p> the output in my system (i.e. gcc version 4.8.5 (Ubuntu 4.8.5-2ubuntu1~14.04.1)) is </p> <pre class="wiki">Cartesian dist=0.00999999999999979 disj=1 dist=0 disj=0 Spherical dist=63710.0877141492 disj=0 dist=0 disj=0 </pre><p> the case where dist=63710.0877141492 and disj=0 is wrong since the objects intersect but the distance is not 0. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13353 Trac 1.4.3