]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/algorithms/detail/distance/linear_or_areal_to_areal.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / geometry / algorithms / detail / distance / linear_or_areal_to_areal.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2014, Oracle and/or its affiliates.
4
5 // Contributed and/or modified by Menelaos Karavelas, 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_ALGORITHMS_DETAIL_DISTANCE_LINEAR_OR_AREAL_TO_AREAL_HPP
11 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISTANCE_LINEAR_OR_AREAL_TO_AREAL_HPP
12
13 #include <boost/geometry/core/point_type.hpp>
14
15 #include <boost/geometry/strategies/distance.hpp>
16
17 #include <boost/geometry/algorithms/intersects.hpp>
18
19 #include <boost/geometry/algorithms/detail/distance/linear_to_linear.hpp>
20
21
22 namespace boost { namespace geometry
23 {
24
25 #ifndef DOXYGEN_NO_DETAIL
26 namespace detail { namespace distance
27 {
28
29
30 template <typename Linear, typename Areal, typename Strategy>
31 struct linear_to_areal
32 {
33 typedef typename strategy::distance::services::return_type
34 <
35 Strategy,
36 typename point_type<Linear>::type,
37 typename point_type<Areal>::type
38 >::type return_type;
39
40 static inline return_type apply(Linear const& linear,
41 Areal const& areal,
42 Strategy const& strategy)
43 {
44 if ( geometry::intersects(linear, areal) )
45 {
46 return 0;
47 }
48
49 return linear_to_linear
50 <
51 Linear, Areal, Strategy
52 >::apply(linear, areal, strategy, false);
53 }
54
55
56 static inline return_type apply(Areal const& areal,
57 Linear const& linear,
58 Strategy const& strategy)
59 {
60 return apply(linear, areal, strategy);
61 }
62 };
63
64
65 template <typename Areal1, typename Areal2, typename Strategy>
66 struct areal_to_areal
67 {
68 typedef typename strategy::distance::services::return_type
69 <
70 Strategy,
71 typename point_type<Areal1>::type,
72 typename point_type<Areal2>::type
73 >::type return_type;
74
75 static inline return_type apply(Areal1 const& areal1,
76 Areal2 const& areal2,
77 Strategy const& strategy)
78 {
79 if ( geometry::intersects(areal1, areal2) )
80 {
81 return 0;
82 }
83
84 return linear_to_linear
85 <
86 Areal1, Areal2, Strategy
87 >::apply(areal1, areal2, strategy, false);
88 }
89 };
90
91
92 }} // namespace detail::distance
93 #endif // DOXYGEN_NO_DETAIL
94
95
96 #ifndef DOXYGEN_NO_DISPATCH
97 namespace dispatch
98 {
99
100 template <typename Linear, typename Areal, typename Strategy>
101 struct distance
102 <
103 Linear, Areal, Strategy,
104 linear_tag, areal_tag,
105 strategy_tag_distance_point_segment, false
106 >
107 : detail::distance::linear_to_areal
108 <
109 Linear, Areal, Strategy
110 >
111 {};
112
113
114 template <typename Areal, typename Linear, typename Strategy>
115 struct distance
116 <
117 Areal, Linear, Strategy,
118 areal_tag, linear_tag,
119 strategy_tag_distance_point_segment, false
120 >
121 : detail::distance::linear_to_areal
122 <
123 Linear, Areal, Strategy
124 >
125 {};
126
127
128 template <typename Areal1, typename Areal2, typename Strategy>
129 struct distance
130 <
131 Areal1, Areal2, Strategy,
132 areal_tag, areal_tag,
133 strategy_tag_distance_point_segment, false
134 >
135 : detail::distance::areal_to_areal
136 <
137 Areal1, Areal2, Strategy
138 >
139 {};
140
141
142 } // namespace dispatch
143 #endif // DOXYGEN_NO_DISPATCH
144
145 }} // namespace boost::geometry
146
147 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISTANCE_LINEAR_OR_AREAL_TO_AREAL_HPP