Subject: [Boost-bugs] [Boost C++ Libraries] #11917: geometry default geographic (andoyer) antipodal distance is zero
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-01-17 08:43:11
#11917: geometry default geographic (andoyer) antipodal distance is zero
---------------------------------------+---------------------------
Reporter: Ken Barker <ken.barker@â¦> | Owner: barendgehrels
Type: Bugs | Status: new
Milestone: To Be Determined | Component: geometry
Version: Boost 1.61.0 | Severity: Problem
Keywords: wgs84 distance andoyer |
---------------------------------------+---------------------------
When calling the default (andoyer) `boost::geometry::distance()` function,
with `boost::geometry::cs::geographic` points that are close to being
antipodal
(e.g. the North and South poles or points that are diametrically opposed
around the equator),
it returns reasonable results. However, when called with antipodal points
it returns zero, e.g.:
{{{
Andoyer distance near poles: 20003917.164970
near opposite equatorial points: 20037508.151445
Andoyer distance at poles: 0.000000
opposite equatorial points: 0.000000
}}}
Here the code I used to obtain the results above:
{{{#!c++
std::cout.setf(std::ios::fixed);
typedef boost::geometry::cs::geographic<boost::geometry::radian>
Wgs84Coords;
typedef boost::geometry::model::point<double, 2, Wgs84Coords>
GeographicPoint;
// Min value for delta. 0.000000014 causes Andoyer to fail.
const double DELTA(0.000000015);
// Note boost points are Long & Lat NOT Lat & Long
GeographicPoint near_north_pole (0.0, M_PI_2 - DELTA);
GeographicPoint near_south_pole (0.0, -M_PI_2 + DELTA);
double andoyer_minor(boost::geometry::distance(north_pole,
south_pole));
std::cout << "Andoyer distance near poles: " << andoyer_minor <<
"\n";
GeographicPoint near_equator_east ( M_PI_2 - DELTA, 0.0);
GeographicPoint near_equator_west (-M_PI_2 + DELTA, 0.0);
double andoyer_major(boost::geometry::distance(near_equator_east,
near_equator_west));
std::cout << "near opposite equatorial points: " << andoyer_major <<
"\n\n";
GeographicPoint north_pole (0.0, M_PI_2);
GeographicPoint south_pole (0.0, -M_PI_2);
andoyer_minor = boost::geometry::distance(north_pole, south_pole);
std::cout << "Andoyer distance at poles: " << andoyer_minor << "\n";
GeographicPoint equator_east ( M_PI_2, 0.0);
GeographicPoint equator_west (-M_PI_2, 0.0);
andoyer_major = boost::geometry::distance(equator_east, equator_west);
std::cout << "opposite equatorial points: " << andoyer_major <<
std::endl;
}}}
This is clearly a bug. The distance between the antipodal points should be
slightly larger than the distance
between the other points, and definitely NOT zero!
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11917> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC