id summary reporter owner description type status milestone component version severity resolution keywords cc
13353 Distance segment-box wrong result for spherical CS Vissarion Fisikopoulos Barend Gehrels "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:
{{{
#include
#include
#include
namespace bg = boost::geometry;
template
void test_all_geometry_types(CT radius_multiplier)
{
bg::model::segment s;
bg::model::box 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 << ""dist="" << bg::distance(b, s) * radius_multiplier << std::endl;
std::cout << ""disj="" << bg::disjoint(b, s) << std::endl;
}
{
bg::read_wkt(""SEGMENT(10 10, 20 10)"", s);
bg::read_wkt(""BOX(10 10, 20 20)"", b);
std::cout << ""dist="" << bg::distance(b, s) * radius_multiplier << std::endl;
std::cout << ""disj="" << bg::disjoint(b, s) << std::endl;
}
}
int main()
{
typedef double CT;
std::cout << ""Cartesian"" << std::endl;
typedef bg::model::point cpoint;
test_all_geometry_types(1);
std::cout << ""Spherical"" << std::endl;
typedef bg::model::point > spoint;
test_all_geometry_types(bg::formula::mean_radius(bg::srs::spheroid()));
return 0;
}
}}}
the output in my system (i.e. gcc version 4.8.5 (Ubuntu 4.8.5-2ubuntu1~14.04.1)) is
{{{
Cartesian
dist=0.00999999999999979
disj=1
dist=0
disj=0
Spherical
dist=63710.0877141492
disj=0
dist=0
disj=0
}}}
the case where dist=63710.0877141492 and disj=0 is wrong since the objects intersect but the distance is not 0. " Bugs new To Be Determined geometry Boost Development Trunk Problem