summaryrefslogtreecommitdiff
path: root/boost/geometry/formulas/andoyer_inverse.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/geometry/formulas/andoyer_inverse.hpp')
-rw-r--r--boost/geometry/formulas/andoyer_inverse.hpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/boost/geometry/formulas/andoyer_inverse.hpp b/boost/geometry/formulas/andoyer_inverse.hpp
index 57b5ab5384..902fd7d8f6 100644
--- a/boost/geometry/formulas/andoyer_inverse.hpp
+++ b/boost/geometry/formulas/andoyer_inverse.hpp
@@ -1,6 +1,6 @@
// Boost.Geometry
-// Copyright (c) 2015-2016 Oracle and/or its affiliates.
+// Copyright (c) 2015-2017 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -20,9 +20,8 @@
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/util/math.hpp>
-#include <boost/geometry/algorithms/detail/flattening.hpp>
-
#include <boost/geometry/formulas/differential_quantities.hpp>
+#include <boost/geometry/formulas/flattening.hpp>
#include <boost/geometry/formulas/result_inverse.hpp>
@@ -75,7 +74,7 @@ public:
CT const c0 = CT(0);
CT const c1 = CT(1);
CT const pi = math::pi<CT>();
- CT const f = detail::flattening<CT>(spheroid);
+ CT const f = formula::flattening<CT>(spheroid);
CT const dlon = lon2 - lon1;
CT const sin_dlon = sin(dlon);
@@ -97,7 +96,7 @@ public:
CT const d = acos(cos_d); // [0, pi]
CT const sin_d = sin(d); // [-1, 1]
-
+
if ( BOOST_GEOMETRY_CONDITION(EnableDistance) )
{
CT const K = math::sqr(sin_lat1-sin_lat2);
@@ -138,7 +137,14 @@ public:
CT A = c0;
CT U = c0;
- if ( ! math::equals(cos_lat2, c0) )
+ if (math::equals(cos_lat2, c0))
+ {
+ if (sin_lat2 < c0)
+ {
+ A = pi;
+ }
+ }
+ else
{
CT const tan_lat2 = sin_lat2/cos_lat2;
CT const M = cos_lat1*tan_lat2-sin_lat1*cos_dlon;
@@ -149,7 +155,14 @@ public:
CT B = c0;
CT V = c0;
- if ( ! math::equals(cos_lat1, c0) )
+ if (math::equals(cos_lat1, c0))
+ {
+ if (sin_lat1 < c0)
+ {
+ B = pi;
+ }
+ }
+ else
{
CT const tan_lat1 = sin_lat1/cos_lat1;
CT const N = cos_lat2*tan_lat1-sin_lat2*cos_dlon;