]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/strategies/line_interpolate/spherical.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / geometry / strategies / line_interpolate / spherical.hpp
1 // Boost.Geometry
2
3 // Copyright (c) 2021, Oracle and/or its affiliates.
4
5 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
6
7 // Licensed under the Boost Software License version 1.0.
8 // http://www.boost.org/users/license.html
9
10 #ifndef BOOST_GEOMETRY_STRATEGIES_LINE_INTERPOLATE_SPHERICAL_HPP
11 #define BOOST_GEOMETRY_STRATEGIES_LINE_INTERPOLATE_SPHERICAL_HPP
12
13
14 #include <boost/geometry/strategies/detail.hpp>
15 #include <boost/geometry/strategies/distance/detail.hpp>
16 #include <boost/geometry/strategies/line_interpolate/services.hpp>
17
18 #include <boost/geometry/strategies/spherical/distance_haversine.hpp>
19 #include <boost/geometry/strategies/spherical/line_interpolate.hpp>
20
21
22 namespace boost { namespace geometry
23 {
24
25 namespace strategies { namespace line_interpolate
26 {
27
28 template
29 <
30 typename RadiusTypeOrSphere = double,
31 typename CalculationType = void
32 >
33 class spherical
34 : public strategies::detail::spherical_base<RadiusTypeOrSphere>
35 {
36 using base_t = strategies::detail::spherical_base<RadiusTypeOrSphere>;
37
38 public:
39 spherical() = default;
40
41 template <typename RadiusOrSphere>
42 explicit spherical(RadiusOrSphere const& radius_or_sphere)
43 : base_t(radius_or_sphere)
44 {}
45
46 template <typename Geometry1, typename Geometry2>
47 auto distance(Geometry1 const&, Geometry2 const&,
48 distance::detail::enable_if_pp_t<Geometry1, Geometry2> * = nullptr) const
49 {
50 return strategy::distance::haversine
51 <
52 typename base_t::radius_type, CalculationType
53 >(base_t::radius());
54 }
55
56 template <typename Geometry>
57 auto line_interpolate(Geometry const&) const
58 {
59 // NOTE: radius is ignored, but pass it just in case
60 return strategy::line_interpolate::spherical<CalculationType>(base_t::radius());
61 }
62 };
63
64
65 namespace services
66 {
67
68 template <typename Geometry>
69 struct default_strategy<Geometry, spherical_equatorial_tag>
70 {
71 using type = strategies::line_interpolate::spherical<>;
72 };
73
74
75 template <typename CT, typename DS>
76 struct strategy_converter<strategy::line_interpolate::spherical<CT, DS> >
77 {
78 static auto get(strategy::line_interpolate::spherical<CT, DS> const& s)
79 {
80 typedef typename strategy::line_interpolate::spherical<CT, DS>::radius_type radius_type;
81 return strategies::line_interpolate::spherical<radius_type, CT>(s.radius());
82 }
83 };
84
85 } // namespace services
86
87 }} // namespace strategies::line_interpolate
88
89 }} // namespace boost::geometry
90
91 #endif // BOOST_GEOMETRY_STRATEGIES_LINE_INTERPOLATE_SPHERICAL_HPP