]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/strategies/spherical/azimuth.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / geometry / strategies / spherical / azimuth.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2016-2017 Oracle and/or its affiliates.
4 // Contributed and/or modified by Vissarion Fisikopoulos, on behalf of Oracle
5 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
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_SPHERICAL_AZIMUTH_HPP
12 #define BOOST_GEOMETRY_STRATEGIES_SPHERICAL_AZIMUTH_HPP
13
14
15 #include <boost/geometry/strategies/azimuth.hpp>
16 #include <boost/geometry/formulas/spherical.hpp>
17
18 #include <boost/mpl/if.hpp>
19 #include <boost/type_traits/is_void.hpp>
20
21
22 namespace boost { namespace geometry
23 {
24
25 namespace strategy { namespace azimuth
26 {
27
28 template
29 <
30 typename CalculationType = void
31 >
32 class spherical
33 {
34 public :
35
36 inline spherical()
37 {}
38
39 template <typename T>
40 static inline void apply(T const& lon1_rad, T const& lat1_rad,
41 T const& lon2_rad, T const& lat2_rad,
42 T& a1, T& a2)
43 {
44 typedef typename boost::mpl::if_
45 <
46 boost::is_void<CalculationType>, T, CalculationType
47 >::type calc_t;
48
49 geometry::formula::result_spherical<calc_t>
50 result = geometry::formula::spherical_azimuth<calc_t, true>(
51 calc_t(lon1_rad), calc_t(lat1_rad),
52 calc_t(lon2_rad), calc_t(lat2_rad));
53
54 a1 = result.azimuth;
55 a2 = result.reverse_azimuth;
56 }
57
58 template <typename T>
59 inline void apply(T const& lon1_rad, T const& lat1_rad,
60 T const& lon2_rad, T const& lat2_rad,
61 T& a1) const
62 {
63 typedef typename boost::mpl::if_
64 <
65 boost::is_void<CalculationType>, T, CalculationType
66 >::type calc_t;
67
68 geometry::formula::result_spherical<calc_t>
69 result = geometry::formula::spherical_azimuth<calc_t, false>(
70 calc_t(lon1_rad), calc_t(lat1_rad),
71 calc_t(lon2_rad), calc_t(lat2_rad));
72
73 a1 = result.azimuth;
74 }
75
76 };
77
78 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
79
80 namespace services
81 {
82
83 template <typename CalculationType>
84 struct default_strategy<spherical_equatorial_tag, CalculationType>
85 {
86 typedef strategy::azimuth::spherical<CalculationType> type;
87 };
88
89 /*
90 template <typename CalculationType>
91 struct default_strategy<spherical_polar_tag, CalculationType>
92 {
93 typedef strategy::azimuth::spherical<CalculationType> type;
94 };
95 */
96 }
97
98 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
99
100 }} // namespace strategy::azimuth
101
102
103 }} // namespace boost::geometry
104
105 #endif // BOOST_GEOMETRY_STRATEGIES_SPHERICAL_AZIMUTH_HPP