]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/include/boost/geometry/strategies/geographic/distance_thomas.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / strategies / geographic / distance_thomas.hpp
CommitLineData
7c673cae
FG
1// Boost.Geometry
2
3// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4
5// This file was modified by Oracle on 2015.
6// Modifications copyright (c) 2015 Oracle and/or its affiliates.
7
8// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
9
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)
13
14#ifndef BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_THOMAS_HPP
15#define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_THOMAS_HPP
16
17
18#include <boost/geometry/core/coordinate_type.hpp>
19#include <boost/geometry/core/radian_access.hpp>
20
21#include <boost/geometry/strategies/distance.hpp>
22
23#include <boost/geometry/util/promote_floating_point.hpp>
24#include <boost/geometry/util/select_calculation_type.hpp>
25
26#include <boost/geometry/algorithms/detail/thomas_inverse.hpp>
27
28namespace boost { namespace geometry
29{
30
31namespace strategy { namespace distance
32{
33
34/*!
35\brief The solution of the inverse problem of geodesics on latlong coordinates,
36 Forsyth-Andoyer-Lambert type approximation with second order terms.
37\ingroup distance
38\tparam Spheroid The reference spheroid model
39\tparam CalculationType \tparam_calculation
40\author See
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
45*/
46template
47<
48 typename Spheroid,
49 typename CalculationType = void
50>
51class thomas
52{
53public :
54 template <typename Point1, typename Point2>
55 struct calculation_type
56 : promote_floating_point
57 <
58 typename select_calculation_type
59 <
60 Point1,
61 Point2,
62 CalculationType
63 >::type
64 >
65 {};
66
67 typedef Spheroid model_type;
68
69 inline thomas()
70 : m_spheroid()
71 {}
72
73 explicit inline thomas(Spheroid const& spheroid)
74 : m_spheroid(spheroid)
75 {}
76
77 template <typename Point1, typename Point2>
78 inline typename calculation_type<Point1, Point2>::type
79 apply(Point1 const& point1, Point2 const& point2) const
80 {
81 return geometry::detail::thomas_inverse
82 <
83 typename calculation_type<Point1, Point2>::type,
84 true, false
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),
89 m_spheroid).distance;
90 }
91
92 inline Spheroid const& model() const
93 {
94 return m_spheroid;
95 }
96
97private :
98 Spheroid m_spheroid;
99};
100
101#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
102namespace services
103{
104
105template <typename Spheroid, typename CalculationType>
106struct tag<thomas<Spheroid, CalculationType> >
107{
108 typedef strategy_tag_distance_point_point type;
109};
110
111
112template <typename Spheroid, typename CalculationType, typename P1, typename P2>
113struct return_type<thomas<Spheroid, CalculationType>, P1, P2>
114 : thomas<Spheroid, CalculationType>::template calculation_type<P1, P2>
115{};
116
117
118template <typename Spheroid, typename CalculationType>
119struct comparable_type<thomas<Spheroid, CalculationType> >
120{
121 typedef thomas<Spheroid, CalculationType> type;
122};
123
124
125template <typename Spheroid, typename CalculationType>
126struct get_comparable<thomas<Spheroid, CalculationType> >
127{
128 static inline thomas<Spheroid, CalculationType> apply(thomas<Spheroid, CalculationType> const& input)
129 {
130 return input;
131 }
132};
133
134template <typename Spheroid, typename CalculationType, typename P1, typename P2>
135struct result_from_distance<thomas<Spheroid, CalculationType>, P1, P2 >
136{
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)
140 {
141 return value;
142 }
143};
144
145
146} // namespace services
147#endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
148
149
150}} // namespace strategy::distance
151
152
153}} // namespace boost::geometry
154
155
156#endif // BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_THOMAS_HPP