1 // Boost.Geometry (aka GGL, Generic Geometry Library)
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
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)
11 #ifndef BOOST_GEOMETRY_STRATEGIES_SPHERICAL_AZIMUTH_HPP
12 #define BOOST_GEOMETRY_STRATEGIES_SPHERICAL_AZIMUTH_HPP
15 #include <boost/geometry/strategies/azimuth.hpp>
16 #include <boost/geometry/formulas/spherical.hpp>
18 #include <boost/mpl/if.hpp>
19 #include <boost/type_traits/is_void.hpp>
22 namespace boost { namespace geometry
25 namespace strategy { namespace azimuth
30 typename CalculationType = void
40 static inline void apply(T const& lon1_rad, T const& lat1_rad,
41 T const& lon2_rad, T const& lat2_rad,
44 typedef typename boost::mpl::if_
46 boost::is_void<CalculationType>, T, CalculationType
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));
55 a2 = result.reverse_azimuth;
59 inline void apply(T const& lon1_rad, T const& lat1_rad,
60 T const& lon2_rad, T const& lat2_rad,
63 typedef typename boost::mpl::if_
65 boost::is_void<CalculationType>, T, CalculationType
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));
78 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
83 template <typename CalculationType>
84 struct default_strategy<spherical_equatorial_tag, CalculationType>
86 typedef strategy::azimuth::spherical<CalculationType> type;
90 template <typename CalculationType>
91 struct default_strategy<spherical_polar_tag, CalculationType>
93 typedef strategy::azimuth::spherical<CalculationType> type;
98 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
100 }} // namespace strategy::azimuth
103 }} // namespace boost::geometry
105 #endif // BOOST_GEOMETRY_STRATEGIES_SPHERICAL_AZIMUTH_HPP