]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/strategies/geographic/distance_karney.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / geometry / strategies / geographic / distance_karney.hpp
1 // Boost.Geometry
2
3 // Copyright (c) 2018 Adeel Ahmad, Islamabad, Pakistan.
4
5 // Contributed and/or modified by Adeel Ahmad, as part of Google Summer of Code 2018 program.
6
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
10
11 #ifndef BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_KARNEY_HPP
12 #define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_KARNEY_HPP
13
14
15 #include <boost/geometry/strategies/geographic/distance.hpp>
16 #include <boost/geometry/strategies/geographic/parameters.hpp>
17
18
19 namespace boost { namespace geometry
20 {
21
22 namespace strategy { namespace distance
23 {
24
25 /*!
26 \brief The solution of the inverse problem of geodesics on latlong coordinates,
27 after Karney (2011).
28 \ingroup distance
29 \tparam Spheroid The reference spheroid model
30 \tparam CalculationType \tparam_calculation
31 \author See
32 - Charles F.F Karney, Algorithms for geodesics, 2011
33 https://arxiv.org/pdf/1109.4448.pdf
34 */
35 template
36 <
37 typename Spheroid = srs::spheroid<double>,
38 typename CalculationType = void
39 >
40 class karney
41 : public strategy::distance::geographic
42 <
43 strategy::karney, Spheroid, CalculationType
44 >
45 {
46 typedef strategy::distance::geographic
47 <
48 strategy::karney, Spheroid, CalculationType
49 > base_type;
50
51 public:
52 inline karney()
53 : base_type()
54 {}
55
56 explicit inline karney(Spheroid const& spheroid)
57 : base_type(spheroid)
58 {}
59 };
60
61 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
62 namespace services
63 {
64
65 template <typename Spheroid, typename CalculationType>
66 struct tag<karney<Spheroid, CalculationType> >
67 {
68 typedef strategy_tag_distance_point_point type;
69 };
70
71
72 template <typename Spheroid, typename CalculationType, typename P1, typename P2>
73 struct return_type<karney<Spheroid, CalculationType>, P1, P2>
74 : karney<Spheroid, CalculationType>::template calculation_type<P1, P2>
75 {};
76
77
78 template <typename Spheroid, typename CalculationType>
79 struct comparable_type<karney<Spheroid, CalculationType> >
80 {
81 typedef karney<Spheroid, CalculationType> type;
82 };
83
84
85 template <typename Spheroid, typename CalculationType>
86 struct get_comparable<karney<Spheroid, CalculationType> >
87 {
88 static inline karney<Spheroid, CalculationType> apply(karney<Spheroid, CalculationType> const& input)
89 {
90 return input;
91 }
92 };
93
94 template <typename Spheroid, typename CalculationType, typename P1, typename P2>
95 struct result_from_distance<karney<Spheroid, CalculationType>, P1, P2 >
96 {
97 template <typename T>
98 static inline typename return_type<karney<Spheroid, CalculationType>, P1, P2>::type
99 apply(karney<Spheroid, CalculationType> const& , T const& value)
100 {
101 return value;
102 }
103 };
104
105
106 } // namespace services
107 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
108
109
110 }} // namespace strategy::distance
111
112
113 }} // namespace boost::geometry
114
115
116 #endif // BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_KARNEY_HPP