]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/cs_undefined/setops.cpp
3 // Copyright (c) 2019, Oracle and/or its affiliates.
5 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
7 // Licensed under the Boost Software License version 1.0.
8 // http://www.boost.org/users/license.html
12 #include <boost/geometry/algorithms/difference.hpp>
13 #include <boost/geometry/algorithms/intersection.hpp>
14 #include <boost/geometry/algorithms/sym_difference.hpp>
15 #include <boost/geometry/algorithms/union.hpp>
17 template <typename G1
, typename G2
, typename G3
, typename S
>
18 inline void set_idsu(G1
const& g1
, G2
const& g2
, G3
& g3
, S
const& s
)
20 bg::intersection(g1
, g2
, g3
, s
);
21 bg::difference(g1
, g2
, g3
, s
);
22 bg::sym_difference(g1
, g2
, g3
, s
);
23 bg::union_(g1
, g2
, g3
, s
);
26 template <typename G1
, typename G2
, typename G3
, typename S
>
27 inline void set_ids(G1
const& g1
, G2
const& g2
, G3
& g3
, S
const& s
)
29 bg::intersection(g1
, g2
, g3
, s
);
30 bg::difference(g1
, g2
, g3
, s
);
31 bg::sym_difference(g1
, g2
, g3
, s
);
34 template <typename G1
, typename G2
, typename G3
, typename S
>
35 inline void set_id(G1
const& g1
, G2
const& g2
, G3
& g3
, S
const& s
)
37 bg::intersection(g1
, g2
, g3
, s
);
38 bg::difference(g1
, g2
, g3
, s
);
41 template <typename G1
, typename G2
, typename G3
, typename S
>
42 inline void set_i(G1
const& g1
, G2
const& g2
, G3
& g3
, S
const& s
)
44 bg::intersection(g1
, g2
, g3
, s
);
47 template <typename G1
, typename G2
, typename G3
, typename S
>
48 inline void set_d(G1
const& g1
, G2
const& g2
, G3
& g3
, S
const& s
)
50 bg::difference(g1
, g2
, g3
, s
);
53 template <typename G1
, typename G2
, typename G3
>
54 inline void set_idsu_pp(G1
const& g1
, G2
const& g2
, G3
& g3
)
56 ::set_idsu(g1
, g2
, g3
, bg::strategy::within::cartesian_point_point());
57 ::set_idsu(g1
, g2
, g3
, bg::strategy::within::spherical_point_point());
60 template <typename G1
, typename G2
, typename G3
>
61 inline void set_idsu_ps(G1
const& g1
, G2
const& g2
, G3
& g3
)
63 typedef typename
bg::point_type
<G1
>::type point_type
;
64 ::set_idsu(g1
, g2
, g3
, bg::strategy::within::cartesian_winding
<point_type
>());
65 ::set_idsu(g1
, g2
, g3
, bg::strategy::within::spherical_winding
<point_type
>());
66 ::set_idsu(g1
, g2
, g3
, bg::strategy::within::geographic_winding
<point_type
>());
69 template <typename G1
, typename G2
, typename G3
>
70 inline void set_idsu_ss(G1
const& g1
, G2
const& g2
, G3
& g3
)
72 ::set_idsu(g1
, g2
, g3
, bg::strategy::intersection::cartesian_segments
<>());
73 ::set_idsu(g1
, g2
, g3
, bg::strategy::intersection::spherical_segments
<>());
74 ::set_idsu(g1
, g2
, g3
, bg::strategy::intersection::geographic_segments
<>());
77 template <typename G1
, typename G2
, typename G3
>
78 inline void set_ids_pp(G1
const& g1
, G2
const& g2
, G3
& g3
)
80 ::set_ids(g1
, g2
, g3
, bg::strategy::within::cartesian_point_point());
81 ::set_ids(g1
, g2
, g3
, bg::strategy::within::spherical_point_point());
84 template <typename G1
, typename G2
, typename G3
>
85 inline void set_ids_ps(G1
const& g1
, G2
const& g2
, G3
& g3
)
87 typedef typename
bg::point_type
<G1
>::type point_type
;
88 ::set_ids(g1
, g2
, g3
, bg::strategy::within::cartesian_winding
<point_type
>());
89 ::set_ids(g1
, g2
, g3
, bg::strategy::within::spherical_winding
<point_type
>());
90 ::set_ids(g1
, g2
, g3
, bg::strategy::within::geographic_winding
<point_type
>());
93 template <typename G1
, typename G2
, typename G3
>
94 inline void set_ids_ss(G1
const& g1
, G2
const& g2
, G3
& g3
)
96 ::set_ids(g1
, g2
, g3
, bg::strategy::intersection::cartesian_segments
<>());
97 ::set_ids(g1
, g2
, g3
, bg::strategy::intersection::spherical_segments
<>());
98 ::set_ids(g1
, g2
, g3
, bg::strategy::intersection::geographic_segments
<>());
101 template <typename G1
, typename G2
, typename G3
>
102 inline void set_id_pp(G1
const& g1
, G2
const& g2
, G3
& g3
)
104 ::set_id(g1
, g2
, g3
, bg::strategy::within::cartesian_point_point());
105 ::set_id(g1
, g2
, g3
, bg::strategy::within::spherical_point_point());
108 template <typename G1
, typename G2
, typename G3
>
109 inline void set_id_ps(G1
const& g1
, G2
const& g2
, G3
& g3
)
111 typedef typename
bg::point_type
<G1
>::type point_type
;
112 ::set_id(g1
, g2
, g3
, bg::strategy::within::cartesian_winding
<point_type
>());
113 ::set_id(g1
, g2
, g3
, bg::strategy::within::spherical_winding
<point_type
>());
114 ::set_id(g1
, g2
, g3
, bg::strategy::within::geographic_winding
<point_type
>());
117 template <typename G1
, typename G2
, typename G3
>
118 inline void set_id_ss(G1
const& g1
, G2
const& g2
, G3
& g3
)
120 ::set_id(g1
, g2
, g3
, bg::strategy::intersection::cartesian_segments
<>());
121 ::set_id(g1
, g2
, g3
, bg::strategy::intersection::spherical_segments
<>());
122 ::set_id(g1
, g2
, g3
, bg::strategy::intersection::geographic_segments
<>());
125 template <typename G1
, typename G2
, typename G3
>
126 inline void set_i_pp(G1
const& g1
, G2
const& g2
, G3
& g3
)
128 ::set_i(g1
, g2
, g3
, bg::strategy::within::cartesian_point_point());
129 ::set_i(g1
, g2
, g3
, bg::strategy::within::spherical_point_point());
132 template <typename G1
, typename G2
, typename G3
>
133 inline void set_i_ps(G1
const& g1
, G2
const& g2
, G3
& g3
)
135 typedef typename
bg::point_type
<G1
>::type point_type
;
136 ::set_i(g1
, g2
, g3
, bg::strategy::within::cartesian_winding
<point_type
>());
137 ::set_i(g1
, g2
, g3
, bg::strategy::within::spherical_winding
<point_type
>());
138 ::set_i(g1
, g2
, g3
, bg::strategy::within::geographic_winding
<point_type
>());
141 template <typename G1
, typename G2
, typename G3
>
142 inline void set_i_ss(G1
const& g1
, G2
const& g2
, G3
& g3
)
144 ::set_i(g1
, g2
, g3
, bg::strategy::intersection::cartesian_segments
<>());
145 ::set_i(g1
, g2
, g3
, bg::strategy::intersection::spherical_segments
<>());
146 ::set_i(g1
, g2
, g3
, bg::strategy::intersection::geographic_segments
<>());
149 template <typename G1
, typename G2
, typename G3
>
150 inline void set_d_pp(G1
const& g1
, G2
const& g2
, G3
& g3
)
152 ::set_d(g1
, g2
, g3
, bg::strategy::within::cartesian_point_point());
153 ::set_d(g1
, g2
, g3
, bg::strategy::within::spherical_point_point());
156 template <typename G1
, typename G2
, typename G3
>
157 inline void set_d_ps(G1
const& g1
, G2
const& g2
, G3
& g3
)
159 typedef typename
bg::point_type
<G1
>::type point_type
;
160 ::set_d(g1
, g2
, g3
, bg::strategy::within::cartesian_winding
<point_type
>());
161 ::set_d(g1
, g2
, g3
, bg::strategy::within::spherical_winding
<point_type
>());
162 ::set_d(g1
, g2
, g3
, bg::strategy::within::geographic_winding
<point_type
>());
165 template <typename G1
, typename G2
, typename G3
>
166 inline void set_d_ss(G1
const& g1
, G2
const& g2
, G3
& g3
)
168 ::set_d(g1
, g2
, g3
, bg::strategy::intersection::cartesian_segments
<>());
169 ::set_d(g1
, g2
, g3
, bg::strategy::intersection::spherical_segments
<>());
170 ::set_d(g1
, g2
, g3
, bg::strategy::intersection::geographic_segments
<>());
173 int test_main(int, char*[])
178 ::set_idsu_pp(g
.pt
, g
.pt
, g
.mpt
);
179 ::set_idsu_pp(g
.pt
, g
.mpt
, g
.mpt
);
180 ::set_idsu_pp(g
.mpt
, g
.mpt
, g
.mpt
);
183 ::set_id_ps(g
.pt
, g
.s
, g
.mpt
);
184 ::set_id_ps(g
.pt
, g
.ls
, g
.mpt
);
185 ::set_id_ps(g
.pt
, g
.mls
, g
.mpt
);
186 ::set_id_ps(g
.mpt
, g
.s
, g
.mpt
);
187 ::set_id_ps(g
.mpt
, g
.ls
, g
.mpt
);
188 ::set_id_ps(g
.mpt
, g
.mls
, g
.mpt
);
191 // no intersection nor difference
192 //::set_id_ps(g.pt, g.r, g.mpt);
193 //::set_id_ps(g.pt, g.po, g.mpt);
194 //::set_id_ps(g.pt, g.mpo, g.mpt);
195 //::set_id_ps(g.mpt, g.r, g.mpt);
196 //::set_id_ps(g.mpt, g.po, g.mpt);
197 //::set_id_ps(g.mpt, g.mpo, g.mpt);
200 ::set_ids_ss(g
.s
, g
.s
, g
.mpt
);
201 //::set_i_ss(g.s, g.ls, g.mpt); // no intersection nor difference
202 //::set_i_ss(g.s, g.mls, g.mpt); // no intersection nor difference
203 //::set_i_ss(g.ls, g.s, g.mpt); // no intersection nor difference
204 ::set_ids_ss(g
.ls
, g
.ls
, g
.mpt
);
205 ::set_i_ss(g
.ls
, g
.mls
, g
.mpt
); // no difference nor sym_difference
206 //::set_i_ss(g.mls, g.s, g.mpt); // no intersection nor difference
207 ::set_i_ss(g
.mls
, g
.ls
, g
.mpt
); // no difference nor sym_difference
208 ::set_ids_ss(g
.mls
, g
.mls
, g
.mpt
);
211 //::set_ids_ss(g.s, g.s, g.mls); // union not implemented, missing specialization
212 //::set_idsu_ss(g.s, g.ls, g.mls); // missing specialization
213 //::set_idsu_ss(g.s, g.mls, g.mls); // missing specialization
214 //::set_idsu_ss(g.ls, g.s, g.mls); // missing specialization
215 ::set_idsu_ss(g
.ls
, g
.ls
, g
.mls
);
216 ::set_idsu_ss(g
.ls
, g
.mls
, g
.mls
);
217 //::set_idsu_ss(g.mls, g.s, g.mls); // missing specialization
218 ::set_idsu_ss(g
.mls
, g
.ls
, g
.mls
);
219 ::set_idsu_ss(g
.mls
, g
.mls
, g
.mls
);
226 //::set_ids_ss(g.s, g.r, g.mpt); // no intersection
227 //::set_ids_ss(g.s, g.po, g.mpt); // no intersection
228 //::set_ids_ss(g.s, g.mpo, g.mpt); // no intersection
229 ::set_ids_ss(g
.ls
, g
.r
, g
.mpt
);
230 ::set_ids_ss(g
.ls
, g
.po
, g
.mpt
);
231 ::set_ids_ss(g
.ls
, g
.mpo
, g
.mpt
);
232 ::set_ids_ss(g
.mls
, g
.r
, g
.mpt
);
233 ::set_ids_ss(g
.mls
, g
.po
, g
.mpt
);
234 ::set_ids_ss(g
.mls
, g
.mpo
, g
.mpt
);
237 //::set_id_ss(g.s, g.r, g.mls); // no intersection
238 //::set_id_ss(g.s, g.po, g.mls); // no intersection
239 //::set_id_ss(g.s, g.mpo, g.mls); // no intersection
240 ::set_id_ss(g
.ls
, g
.r
, g
.mls
);
241 ::set_id_ss(g
.ls
, g
.po
, g
.mls
);
242 ::set_id_ss(g
.ls
, g
.mpo
, g
.mls
);
243 ::set_id_ss(g
.mls
, g
.r
, g
.mls
);
244 ::set_id_ss(g
.mls
, g
.po
, g
.mls
);
245 ::set_id_ss(g
.mls
, g
.mpo
, g
.mls
);
248 ::set_i_ss(g
.r
, g
.r
, g
.mpt
);
249 ::set_i_ss(g
.r
, g
.po
, g
.mpt
);
250 ::set_i_ss(g
.r
, g
.mpo
, g
.mpt
);
251 ::set_i_ss(g
.po
, g
.r
, g
.mpt
);
252 ::set_i_ss(g
.po
, g
.po
, g
.mpt
);
253 ::set_i_ss(g
.po
, g
.mpo
, g
.mpt
);
254 ::set_i_ss(g
.mpo
, g
.r
, g
.mpt
);
255 ::set_i_ss(g
.mpo
, g
.po
, g
.mpt
);
256 ::set_i_ss(g
.mpo
, g
.mpo
, g
.mpt
);
259 ::set_i_ss(g
.r
, g
.r
, g
.mls
);
260 ::set_i_ss(g
.r
, g
.po
, g
.mls
);
261 ::set_i_ss(g
.r
, g
.mpo
, g
.mls
);
262 ::set_i_ss(g
.po
, g
.r
, g
.mls
);
263 ::set_i_ss(g
.po
, g
.po
, g
.mls
);
264 ::set_i_ss(g
.po
, g
.mpo
, g
.mls
);
265 ::set_i_ss(g
.mpo
, g
.r
, g
.mls
);
266 ::set_i_ss(g
.mpo
, g
.po
, g
.mls
);
267 ::set_i_ss(g
.mpo
, g
.mpo
, g
.mls
);
270 ::set_idsu_ss(g
.r
, g
.r
, g
.mpo
);
271 ::set_idsu_ss(g
.r
, g
.po
, g
.mpo
);
272 ::set_idsu_ss(g
.r
, g
.mpo
, g
.mpo
);
273 ::set_idsu_ss(g
.po
, g
.r
, g
.mpo
);
274 ::set_idsu_ss(g
.po
, g
.po
, g
.mpo
);
275 ::set_idsu_ss(g
.po
, g
.mpo
, g
.mpo
);
276 ::set_idsu_ss(g
.mpo
, g
.r
, g
.mpo
);
277 ::set_idsu_ss(g
.mpo
, g
.po
, g
.mpo
);
278 ::set_idsu_ss(g
.mpo
, g
.mpo
, g
.mpo
);