3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // This file was modified by Oracle on 2015.
6 // Modifications copyright (c) 2015 Oracle and/or its affiliates.
8 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
10 // Use, modification and distribution is subject to the Boost Software License,
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt)
14 #ifndef BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_THOMAS_HPP
15 #define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_THOMAS_HPP
18 #include <boost/geometry/core/coordinate_type.hpp>
19 #include <boost/geometry/core/radian_access.hpp>
21 #include <boost/geometry/strategies/distance.hpp>
23 #include <boost/geometry/util/promote_floating_point.hpp>
24 #include <boost/geometry/util/select_calculation_type.hpp>
26 #include <boost/geometry/algorithms/detail/thomas_inverse.hpp>
28 namespace boost { namespace geometry
31 namespace strategy { namespace distance
35 \brief The solution of the inverse problem of geodesics on latlong coordinates,
36 Forsyth-Andoyer-Lambert type approximation with second order terms.
38 \tparam Spheroid The reference spheroid model
39 \tparam CalculationType \tparam_calculation
41 - Technical Report: PAUL D. THOMAS, MATHEMATICAL MODELS FOR NAVIGATION SYSTEMS, 1965
42 http://www.dtic.mil/docs/citations/AD0627893
43 - Technical Report: PAUL D. THOMAS, SPHEROIDAL GEODESICS, REFERENCE SYSTEMS, AND LOCAL GEOMETRY, 1970
44 http://www.dtic.mil/docs/citations/AD703541
49 typename CalculationType = void
54 template <typename Point1, typename Point2>
55 struct calculation_type
56 : promote_floating_point
58 typename select_calculation_type
67 typedef Spheroid model_type;
73 explicit inline thomas(Spheroid const& spheroid)
74 : m_spheroid(spheroid)
77 template <typename Point1, typename Point2>
78 inline typename calculation_type<Point1, Point2>::type
79 apply(Point1 const& point1, Point2 const& point2) const
81 return geometry::detail::thomas_inverse
83 typename calculation_type<Point1, Point2>::type,
85 >::apply(get_as_radian<0>(point1),
86 get_as_radian<1>(point1),
87 get_as_radian<0>(point2),
88 get_as_radian<1>(point2),
92 inline Spheroid const& model() const
101 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
105 template <typename Spheroid, typename CalculationType>
106 struct tag<thomas<Spheroid, CalculationType> >
108 typedef strategy_tag_distance_point_point type;
112 template <typename Spheroid, typename CalculationType, typename P1, typename P2>
113 struct return_type<thomas<Spheroid, CalculationType>, P1, P2>
114 : thomas<Spheroid, CalculationType>::template calculation_type<P1, P2>
118 template <typename Spheroid, typename CalculationType>
119 struct comparable_type<thomas<Spheroid, CalculationType> >
121 typedef thomas<Spheroid, CalculationType> type;
125 template <typename Spheroid, typename CalculationType>
126 struct get_comparable<thomas<Spheroid, CalculationType> >
128 static inline thomas<Spheroid, CalculationType> apply(thomas<Spheroid, CalculationType> const& input)
134 template <typename Spheroid, typename CalculationType, typename P1, typename P2>
135 struct result_from_distance<thomas<Spheroid, CalculationType>, P1, P2 >
137 template <typename T>
138 static inline typename return_type<thomas<Spheroid, CalculationType>, P1, P2>::type
139 apply(thomas<Spheroid, CalculationType> const& , T const& value)
146 } // namespace services
147 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
150 }} // namespace strategy::distance
153 }} // namespace boost::geometry
156 #endif // BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_THOMAS_HPP