]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/test/algorithms/set_operations/union/union.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / set_operations / union / union.cpp
CommitLineData
7c673cae
FG
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2// Unit Test
3
4// Copyright (c) 2007-2016 Barend Gehrels, Amsterdam, the Netherlands.
5// Copyright (c) 2008-2016 Bruno Lalande, Paris, France.
6// Copyright (c) 2009-2016 Mateusz Loskot, London, UK.
7
b32b8144
FG
8// This file was modified by Oracle on 2016,2017.
9// Modifications copyright (c) 2016-2017, Oracle and/or its affiliates.
7c673cae
FG
10// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
11
12// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
13// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
14
15// Use, modification and distribution is subject to the Boost Software License,
16// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
17// http://www.boost.org/LICENSE_1_0.txt)
18
19#include <iostream>
20#include <string>
21
22#include "test_union.hpp"
23#include <algorithms/test_overlay.hpp>
24
25#include <algorithms/overlay/overlay_cases.hpp>
26#include <boost/geometry/geometries/point_xy.hpp>
27
28
29
30template <typename Ring, typename Polygon>
31void test_areal()
32{
33 typedef typename bg::coordinate_type<Polygon>::type ct;
34
7c673cae
FG
35 test_one<Polygon, Polygon, Polygon>("simplex_normal",
36 simplex_normal[0], simplex_normal[1],
37 1, 0, 13, 11.526367);
38
39 test_one<Polygon, Polygon, Polygon>("simplex_with_empty_1",
40 simplex_normal[0], polygon_empty,
41 1, 0, 4, 8.0);
42 test_one<Polygon, Polygon, Polygon>("simplex_with_empty_2",
43 polygon_empty, simplex_normal[0],
44 1, 0, 4, 8.0);
45
46 test_one<Polygon, Polygon, Polygon>("star_ring", example_star, example_ring,
47 1, 0, 23, 5.67017141);
48
49 // This sample was selected because of the border case, and ttmath generates one point more.
50 test_one<Polygon, Polygon, Polygon>("star_poly", example_star, example_polygon,
51 1, 1,
52 if_typed_tt<ct>(28, 27), 5.647949);
53
54 // Pseudo-box as Polygon
55 // (note, internally, the intersection points is different, so yes,
56 // it has to be tested)
57 test_one<Polygon, Polygon, Polygon>("box_poly3", "POLYGON((1.5 1.5 , 1.5 2.5 , 4.5 2.5 , 4.5 1.5 , 1.5 1.5))",
58 "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,5.3 2.5,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3))",
59 1, 1, 15, 5.93625);
60
61 test_one<Polygon, Polygon, Polygon>("first_within_second",
62 first_within_second[0], first_within_second[1],
63 1, 0, 5, 25.0);
64
65 test_one<Polygon, Polygon, Polygon>("second_within_first",
66 first_within_second[1], first_within_second[0],
67 1, 0, 5, 25.0);
68
69 test_one<Polygon, Polygon, Polygon>("first_within_hole_of_second",
70 first_within_hole_of_second[0], first_within_hole_of_second[1],
71 2, 1, 15, 17.0);
72
73 test_one<Polygon, Polygon, Polygon>("new_hole",
74 new_hole[0], new_hole[1],
75 1, 1, 14, 23.0);
76
77 test_one<Polygon, Polygon, Polygon>("side_side",
78 side_side[0], side_side[1], 1, 0, 7, 2.0);
79
80 test_one<Polygon, Polygon, Polygon>("identical",
81 identical[0], identical[1], 1, 0, 5, 1.0);
82
83 test_one<Polygon, Polygon, Polygon>("disjoint",
84 disjoint[0], disjoint[1], 2, 0, 10, 2.0);
85
86 test_one<Polygon, Polygon, Polygon>("intersect_holes_intersect",
87 intersect_holes_intersect[0], intersect_holes_intersect[1],
88 1, 1, 14, 39.75);
89
90 test_one<Polygon, Polygon, Polygon>("intersect_holes_intersect_and_disjoint",
91 intersect_holes_intersect_and_disjoint[0], intersect_holes_intersect_and_disjoint[1],
92 1, 1, 14, 39.75);
93
94 test_one<Polygon, Polygon, Polygon>("intersect_holes_intersect_and_touch",
95 intersect_holes_intersect_and_touch[0], intersect_holes_intersect_and_touch[1],
96 1, 1, 14, 39.75);
97
98 test_one<Polygon, Polygon, Polygon>("intersect_holes_new_ring",
99 intersect_holes_new_ring[0], intersect_holes_new_ring[1],
100 1, 2, 15, 253.8961);
101
102 test_one<Polygon, Polygon, Polygon>("intersect_holes_disjoint",
103 intersect_holes_disjoint[0],
104 intersect_holes_disjoint[1],
105 1, 0, 9, 40.0);
106
107 test_one<Polygon, Polygon, Polygon>("within_holes_disjoint",
108 within_holes_disjoint[0], within_holes_disjoint[1],
109 1, 0, 5, 49.0);
110
111 test_one<Polygon, Polygon, Polygon>("winded",
112 winded[0], winded[1],
113 1, 5, 30, 114.0);
114
115 test_one<Polygon, Polygon, Polygon>("two_bends",
116 two_bends[0], two_bends[1],
117 1, 0, 7, 40.0);
118
119 test_one<Polygon, Polygon, Polygon>("star_comb_15",
120 star_comb_15[0], star_comb_15[1],
121 1, 27, 204, 898.09693338);
122
123 test_one<Polygon, Polygon, Polygon>("equal_holes_disjoint",
124 equal_holes_disjoint[0], equal_holes_disjoint[1],
125 1, 1, 10, 81 - 3 * 7);
126
127 test_one<Polygon, Polygon, Polygon>("only_hole_intersections1",
128 only_hole_intersections[0], only_hole_intersections[1],
129 1, 2, 13, 190.9090909);
130 test_one<Polygon, Polygon, Polygon>("only_hole_intersections2",
131 only_hole_intersections[0], only_hole_intersections[2],
132 1, 2, 13, 190.9090909);
133
134 test_one<Polygon, Polygon, Polygon>("intersect_exterior_and_interiors_winded",
135 intersect_exterior_and_interiors_winded[0], intersect_exterior_and_interiors_winded[1],
136 1, 1, 26, 66.5333333);
137
138 test_one<Polygon, Polygon, Polygon>("crossed",
139 crossed[0], crossed[1],
140 1, 3, 17, 23.5); // Area from SQL Server - was somehow wrong before
141
142 test_one<Polygon, Polygon, Polygon>("fitting",
143 fitting[0], fitting[1],
144 1, 0, 5, 25);
145
146 test_one<Polygon, Polygon, Polygon>("distance_zero",
147 distance_zero[0], distance_zero[1],
148 1, 0, if_typed<ct, float>(9, 11), 9.0098387);
149
150 test_one<Polygon, Polygon, Polygon>("wrapped_a",
151 wrapped[0], wrapped[1],
152 1, 1, 16, 16);
153 test_one<Polygon, Polygon, Polygon>("wrapped_b",
154 wrapped[0], wrapped[2],
155 1, 1, 16, 16);
156
157 test_one<Polygon, Polygon, Polygon>("9",
158 case_9[0], case_9[1], 2, 0, 8, 11);
159 test_one<Polygon, Polygon, Polygon>("22",
160 case_22[0], case_22[1], 2, 0, 8, 9.5);
161 test_one<Polygon, Polygon, Polygon>("25",
162 case_25[0], case_25[1], 2, 0, 8, 7);
163 test_one<Polygon, Polygon, Polygon>("26",
164 case_26[0], case_26[1], 2, 0, 9, 7.5);
165 test_one<Polygon, Polygon, Polygon>("31",
166 case_31[0], case_31[1], 2, 0, 8, 4.5);
167 test_one<Polygon, Polygon, Polygon>("32",
168 case_32[0], case_32[1], 2, 0, 8, 4.5);
169 test_one<Polygon, Polygon, Polygon>("33",
170 case_33[0], case_33[1], 2, 0, 8, 4.5);
171 test_one<Polygon, Polygon, Polygon>("36",
172 case_36[0], case_36[1], 1, 1, 10, 14.375);
173 test_one<Polygon, Polygon, Polygon>("40",
174 case_40[0], case_40[1], 2, 0, 18, 11);
175
176 // Test rings which should be generated by assemble
177 test_one<Polygon, Polygon, Polygon>("53_iet",
178 case_53[0], case_53[2], 1, 1, 16, 16);
179 test_one<Polygon, Polygon, Polygon>("58_iet",
180 case_58[0], case_58[2], 1, 3, 20, 12.16666);
181
182 test_one<Polygon, Polygon, Polygon>("59_iet",
183 case_59[0], case_59[2], 1, 1, 14, 17.20833);
184
185 test_one<Polygon, Polygon, Polygon>("80",
186 case_80[0], case_80[1], 2, 2, 18, 129.0);
187
188 test_one<Polygon, Polygon, Polygon>("81",
189 case_81[0], case_81[1], 1, 2, 15, 163.5);
190
191 test_one<Polygon, Polygon, Polygon>("82",
192 case_82[0], case_82[1], 1, 1, 21, 19.75);
193
194 test_one<Polygon, Polygon, Polygon>("83",
195 case_83[0], case_83[1], 1, 0, 7, 20.0);
196
197 test_one<Polygon, Polygon, Polygon>("90",
198 case_90[0], case_90[1], 1, 2, 17, 221.3688);
199
200 test_one<Polygon, Polygon, Polygon>("91",
201 case_91[0], case_91[1], 1, 1, 9, 147.5);
202
203 test_one<Polygon, Polygon, Polygon>("92",
204 case_92[0], case_92[1], 2, 0, 9, 175.0);
205
206 test_one<Polygon, Polygon, Polygon>("93",
207 case_93[0], case_93[1], 1, 2, 12, 172.9167);
208
209 test_one<Polygon, Polygon, Polygon>("94",
210 case_94[0], case_94[1], 2, 0, 12, 170.0);
211
212 // Has two separate but touching interior rings
213 test_one<Polygon, Polygon, Polygon>("95",
214 case_95[0], case_95[1], 1, 2, 15, 1320.0);
215
216 test_one<Polygon, Polygon, Polygon>("96",
217 case_96[0], case_96[1], 1, 1, 10, 1500.0);
218
219 test_one<Polygon, Polygon, Polygon>("97",
220 case_97[0], case_97[1], 1, 0, 10, 286.799);
221
222 test_one<Polygon, Polygon, Polygon>("98",
223 case_98[0], case_98[1], 1, 1, 14, 653.067);
224
225 test_one<Polygon, Polygon, Polygon>("99",
226 case_99[0], case_99[1], 1, 0, 5, 1600.0);
227
228 test_one<Polygon, Polygon, Polygon>("100",
229 case_100[0], case_100[1], 1, 1, 13, 19.125);
230
b32b8144
FG
231 test_one<Polygon, Polygon, Polygon>("101",
232 case_101[0], case_101[1], 1, 0, 9, 21.0);
233
234 test_one<Polygon, Polygon, Polygon>("102",
235 case_102[0], case_102[1], 1, 1, 17, 8.75);
236
237 test_one<Polygon, Polygon, Polygon>("103",
238 case_103[0], case_103[1],
239 1, 0, 5, 1.0);
240 test_one<Polygon, Polygon, Polygon>("104",
241 case_104[0], case_104[1],
242 1, 0, 5, 100.0);
243
244 test_one<Polygon, Polygon, Polygon>("105",
245 case_105[0], case_105[1], 1, 0, 5, 100);
246
247 test_one<Polygon, Polygon, Polygon>("108",
248 case_108[0], case_108[1], 1, 0, 13, 5.0);
249
7c673cae
FG
250 /*
251 test_one<Polygon, Polygon, Polygon>(102,
252 simplex_normal[0], simplex_reversed[1],
253 1, 0, 7, X);
254
255 test_one<Polygon, Polygon, Polygon>(103,
256 simplex_reversed[0], simplex_normal[1],
257 1, 0, 7, 24.0);
258
259 test_one<Polygon, Polygon, Polygon>(104,
260 simplex_reversed[0], simplex_reversed[1],
261 1, 0, 7, 24.0);
262
263 test_one<Polygon, Polygon, Polygon>(100,
264 star_15, comb_15,
265 1, 10, 7, 24.0);
266 */
267
268 // test some other input/output types
269
270 // 1 input Ring
271 test_one<Polygon, Polygon, Ring>("identical_pr", identical[0], identical[1], 1, 0, 5, 1.0);
272 test_one<Polygon, Ring, Polygon>("identical_rp", identical[0], identical[1], 1, 0, 5, 1.0);
273
274 // 2 input rings
275 test_one<Polygon, Ring, Ring>("identical_rr", identical[0], identical[1], 1, 0, 5, 1.0);
276
277 // output is also Ring
278 test_one<Ring, Ring, Ring>("identical_rrr", identical[0], identical[1], 1, 0, 5, 1.0);
279
280 // "new hole", tested with Ring -> the newly formed hole will be omitted
281 test_one<Ring, Ring, Ring>("new_hole_discarded", new_hole[0], new_hole[1], 1, 0, 9, 24.0);
282
283 test_one<Polygon, Polygon, Polygon>("ggl_list_20110306_javier",
284 ggl_list_20110306_javier[0], ggl_list_20110306_javier[1],
285 1, 1, 16, 80456.4904910401);
286
287 test_one<Polygon, Polygon, Polygon>("ggl_list_20110307_javier",
288 ggl_list_20110307_javier[0], ggl_list_20110307_javier[1],
289 1, 1, 13, 20016.4);
290
291#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
292 test_one<Polygon, Polygon, Polygon>("ggl_list_20110627_phillip",
293 ggl_list_20110627_phillip[0], ggl_list_20110627_phillip[1],
294 1, 0, 8, 14729.07145);
295#endif
296
297 test_one<Polygon, Polygon, Polygon>("ggl_list_20110716_enrico",
298 ggl_list_20110716_enrico[0], ggl_list_20110716_enrico[1],
299 1, 1, 15, 129904.197692871);
300
301#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
302 test_one<Polygon, Polygon, Polygon>("ggl_list_20110820_christophe",
303 ggl_list_20110820_christophe[0], ggl_list_20110820_christophe[1],
304 -1, // Either 1 or 2, depending if the intersection/turn point (eps.region) is missed
305 0,
306 if_typed_tt<ct>(9, 8),
307 67.3550722317627);
308#endif
309
310 {
311 ut_settings settings;
312 settings.percentage = 0.1;
313#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
314 settings.test_validity = false;
315#endif
316
317 test_one<Polygon, Polygon, Polygon>("isovist",
318 isovist1[0], isovist1[1],
319 1,
320 0,
321 -1,
322 313.36036462, settings);
323
324 // SQL Server gives: 313.360374193241
325 // PostGIS gives: 313.360364623393
326 }
327
328 // Ticket 5103 https://svn.boost.org/trac/boost/ticket/5103
329 // This ticket was actually reported for Boost.Polygon
330 // We check it for Boost.Geometry as well.
331 // SQL Server gives: 2515271331437.69
332 // PostGIS gives: 2515271327070.52
333 // Boost.Geometry gives: 2515271327070.5237746891 (ttmath)
334 // 2515271327070.5156 (double)
335 // 2515271320603.0000 (int)
336 // Note the int-test was tested outside of this unit test.
337 // It is in two points 0.37 off (logical for an int).
338 // Because of the width of the polygon (400000 meter)
339 // this causes a substantial difference.
340
341 test_one<Polygon, Polygon, Polygon>("ticket_5103",
342 ticket_5103[0], ticket_5103[1],
343 1, 0, 25, 2515271327070.5);
344
345 test_one<Polygon, Polygon, Polygon>("ticket_8310a", ticket_8310a[0], ticket_8310a[1],
346 1, 0, 5, 10.5000019595);
347 test_one<Polygon, Polygon, Polygon>("ticket_8310b", ticket_8310b[0], ticket_8310b[1],
348 1, 0, 5, 10.5000019595);
349 test_one<Polygon, Polygon, Polygon>("ticket_8310c", ticket_8310c[0], ticket_8310c[1],
350 1, 0, 5, 10.5000019595);
351
352 test_one<Polygon, Polygon, Polygon>("ticket_9081_15",
353 ticket_9081_15[0], ticket_9081_15[1],
354 1, 0, 10, 0.0403425433);
355
356 test_one<Polygon, Polygon, Polygon>("ticket_9563", ticket_9563[0], ticket_9563[1],
357 1, 0, 13, 150.0);
358
359 test_one<Polygon, Polygon, Polygon>("ticket_9756", ticket_9756[0], ticket_9756[1],
360 1, 0, 10, 1289.08374);
361
362#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
363 test_one<Polygon, Polygon, Polygon>("ticket_10108_a", ticket_10108_a[0], ticket_10108_a[1],
364 1, 0, 8, 0.0435229);
365#else
366 test_one<Polygon, Polygon, Polygon>("ticket_10108_a", ticket_10108_a[0], ticket_10108_a[1],
367 2, 0, 8, 0.0435229);
368#endif
369
370#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
371 test_one<Polygon, Polygon, Polygon>("ticket_10108_b", ticket_10108_b[0], ticket_10108_b[1],
372 1, 0, 10, 2424.3449);
373#endif
374
375 test_one<Polygon, Polygon, Polygon>("ticket_10866", ticket_10866[0], ticket_10866[1],
376 1, 0, 14, 332760303.5);
377
378 test_one<Polygon, Polygon, Polygon>("ticket_11725", ticket_11725[0], ticket_11725[1],
379 1, 1, 10, 7.5);
380
b32b8144
FG
381 {
382 ut_settings ignore_validity;
383 ignore_validity.test_validity = false;
384 test_one<Polygon, Polygon, Polygon>("geos_1", geos_1[0], geos_1[1],
385 1, 0, -1, 3461.3203125,
386 ignore_validity);
387 }
7c673cae
FG
388 test_one<Polygon, Polygon, Polygon>("geos_2", geos_2[0], geos_2[1],
389 1, 0, -1, 350.55102539);
390 test_one<Polygon, Polygon, Polygon>("geos_3", geos_3[0], geos_3[1],
391 1, 0, -1, 29391548.4998779);
392 test_one<Polygon, Polygon, Polygon>("geos_4", geos_4[0], geos_4[1],
393 1, 0, -1, 2304.4163115);
394
395 test_one<Polygon, Polygon, Polygon>("buffer_rt_a", buffer_rt_a[0], buffer_rt_a[1],
396 1, 0, 265, 19.280667);
397
398 // Robustness issues, followed out buffer-robustness-tests, test them also reverse
399#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
400 test_one<Polygon, Polygon, Polygon>("buffer_rt_f", buffer_rt_f[0], buffer_rt_f[1],
b32b8144 401 1, 0, 23, 4.60853);
7c673cae 402 test_one<Polygon, Polygon, Polygon>("buffer_rt_f_rev", buffer_rt_f[1], buffer_rt_f[0],
b32b8144 403 1, 0, 23, 4.60853);
7c673cae
FG
404 test_one<Polygon, Polygon, Polygon>("buffer_rt_g", buffer_rt_g[0], buffer_rt_g[1],
405 1, 0, if_typed<ct, float>(18, 17), 16.571);
406 test_one<Polygon, Polygon, Polygon>("buffer_rt_g_rev", buffer_rt_g[1], buffer_rt_g[0],
407 1, 0, if_typed<ct, float>(18, 17), 16.571);
7c673cae
FG
408 test_one<Polygon, Polygon, Polygon>("buffer_rt_i", buffer_rt_i[0], buffer_rt_i[1],
409 1, 0, if_typed<ct, float>(14, 13), 13.6569);
7c673cae
FG
410 test_one<Polygon, Polygon, Polygon>("buffer_rt_i_rev", buffer_rt_i[1], buffer_rt_i[0],
411 1, 0, 13, 13.6569);
b32b8144 412#endif
7c673cae
FG
413
414 test_one<Polygon, Polygon, Polygon>("buffer_rt_j", buffer_rt_j[0], buffer_rt_j[1],
415 1, 0, -1, 16.5711);
416 test_one<Polygon, Polygon, Polygon>("buffer_rt_j_rev", buffer_rt_j[1], buffer_rt_j[0],
417 1, 0, -1, 16.5711);
418
419#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
420 test_one<Polygon, Polygon, Polygon>("buffer_rt_l", buffer_rt_l[0], buffer_rt_l[1],
421 1, 0, -1, 19.3995);
422 test_one<Polygon, Polygon, Polygon>("buffer_rt_l_rev", buffer_rt_l[1], buffer_rt_l[0],
423 1, 0, -1, 19.3995);
424#endif
425
426 test_one<Polygon, Polygon, Polygon>("buffer_rt_m1", buffer_rt_m1[0], buffer_rt_m1[1],
427 1, 0, if_typed_tt<ct>(14, 13), 19.4852);
428 test_one<Polygon, Polygon, Polygon>("buffer_rt_m1_rev", buffer_rt_m1[1], buffer_rt_m1[0],
429 1, 0, if_typed_tt<ct>(14, 13), 19.4852);
430
431 test_one<Polygon, Polygon, Polygon>("buffer_rt_m2", buffer_rt_m2[0], buffer_rt_m2[1],
432 1, 0, if_typed_tt<ct>(20, 19), 21.4853);
433 test_one<Polygon, Polygon, Polygon>("buffer_rt_m2_rev", buffer_rt_m2[1], buffer_rt_m2[0],
434 1, 0, if_typed_tt<ct>(20, 19), 21.4853);
435
b32b8144 436#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
7c673cae
FG
437 test_one<Polygon, Polygon, Polygon>("buffer_rt_q", buffer_rt_q[0], buffer_rt_q[1],
438 1, 0, 18, 18.5710);
439 test_one<Polygon, Polygon, Polygon>("buffer_rt_q_rev", buffer_rt_q[1], buffer_rt_q[0],
440 1, 0, 18, 18.5710);
7c673cae
FG
441 test_one<Polygon, Polygon, Polygon>("buffer_rt_r", buffer_rt_r[0], buffer_rt_r[1],
442 1, 0, 19, 21.07612);
443 test_one<Polygon, Polygon, Polygon>("buffer_rt_r_rev", buffer_rt_r[1], buffer_rt_r[0],
444 1, 0, if_typed_tt<ct>(20, 19), 21.07612);
445#endif
446
447#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
448 test_one<Polygon, Polygon, Polygon>("buffer_rt_t", buffer_rt_t[0], buffer_rt_t[1],
449 1, 0, if_typed_tt<ct>(16, 14), 15.6569);
450 test_one<Polygon, Polygon, Polygon>("buffer_rt_t_rev", buffer_rt_t[1], buffer_rt_t[0],
451 1, 0, if_typed_tt<ct>(16, if_typed<ct, float>(15, 14)), 15.6569);
452#endif
453
454 test_one<Polygon, Polygon, Polygon>("buffer_mp1", buffer_mp1[0], buffer_mp1[1],
455 1, 0, if_typed_tt<ct>(93, 91), 22.815);
456
457 test_one<Polygon, Polygon, Polygon>("buffer_mp2", buffer_mp2[0], buffer_mp2[1],
458#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
b32b8144 459 1, 0, 217, 36.752837);
7c673cae
FG
460#else
461 1, 1, 217, 36.752837);
462#endif
463
464 test_one<Polygon, Polygon, Polygon>("mysql_21964079_1",
465 mysql_21964079_1[0], mysql_21964079_1[1],
466 2, 1, -1, 234.5);
467 test_one<Polygon, Polygon, Polygon>("mysql_21964079_2",
468 mysql_21964079_2[0], mysql_21964079_2[1],
469 2, 1, -1, 112.0);
470
471 test_one<Polygon, Polygon, Polygon>("mysql_23023665_1",
472 mysql_23023665_1[0], mysql_23023665_1[1],
473 2, 1, -1, 92.0 + 142.5);
474 test_one<Polygon, Polygon, Polygon>("mysql_23023665_2",
475 mysql_23023665_2[0], mysql_23023665_2[1],
476 2, 1, -1, 96.0 + 16.0);
477 test_one<Polygon, Polygon, Polygon>("mysql_23023665_3",
478 mysql_23023665_3[0], mysql_23023665_3[1],
479 2, 1, -1, 225.0 + 66.0);
480 test_one<Polygon, Polygon, Polygon>("mysql_21964049",
481 mysql_21964049[0], mysql_21964049[1],
482 1, 1, -1, 220.5);
483}
484
485template <typename P>
486void test_all()
487{
488 typedef bg::model::polygon<P> polygon;
489 typedef bg::model::ring<P> ring;
490 typedef bg::model::box<P> box;
491
492 test_areal<ring, polygon>();
493
b32b8144 494#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
7c673cae
FG
495 // Open
496 test_areal<bg::model::ring<P, true, false>, bg::model::polygon<P, true, false> >();
497
498 // Counter clockwise
499 test_areal<bg::model::ring<P, false>, bg::model::polygon<P, false> >();
500
7c673cae
FG
501 // Counter clockwise and open
502 test_areal<bg::model::ring<P, false, false>, bg::model::polygon<P, false, false> >();
503#endif
504
505 test_one<polygon, box, polygon>("box_ring", example_box, example_ring,
506 1, 1, 15, 6.38875);
507
508 test_one<polygon, box, polygon>("box_poly", example_box, example_polygon,
509 1, 3, 23, 6.30983);
510
511
512 test_one<polygon, box, polygon>("box_poly1", example_box,
513 "POLYGON((3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2))",
514 1, 1, 15, 6.38875);
515 test_one<polygon, box, polygon>("box_poly2", example_box,
516 "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,5.3 2.5,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3))",
517 1, 1, 15, 5.93625);
518
519 // 3: see areal
520
521 test_one<polygon, box, polygon>("box_poly4", example_box,
522 "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,4.5 2.5,4.5 1.2,4.9 0.8,2.9 0.7,2 1.3))",
523 1, 1, 15, 4.651245);
524
525 test_one<polygon, box, polygon>("box_poly5", example_box,
526 "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,4.5 2.5,4.5 2.3,5.0 2.3,5.0 2.1,4.5 2.1,4.5 1.9,4.0 1.9,4.5 1.2,4.9 0.8,2.9 0.7,2 1.3))",
527 1, 1, 21, 4.7191);
528
529 test_one<polygon, box, polygon>("box_poly6", example_box,
530 "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,4.5 1.2,2.9 0.7,2 1.3))",
531 1, 1, 15, 4.2174);
532
533 test_one<polygon, box, polygon>("box_poly7", example_box,
534 "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.0 3.0,5.0 2.0,2.9 0.7,2 1.3))",
535 1, 1, 17, 4.270554);
536
537 test_one<polygon, box, polygon>("box_poly8", "box(0 0, 3 3)",
538 "POLYGON((2 2, 1 4, 2 4, 3 3, 2 2))",
539 1, 0, 8, 10.25);
540}
541
542
543int test_main(int, char* [])
544{
545 test_all<bg::model::d2::point_xy<double> >();
546
547#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
548
549#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
550 test_all<bg::model::d2::point_xy<float> >();
551 test_all<bg::model::d2::point_xy<long double> >();
552#endif
553
554#if defined(HAVE_TTMATH)
555 std::cout << "Testing TTMATH" << std::endl;
556 test_all<bg::model::d2::point_xy<ttmath_big> >();
557#endif
558#endif
559
560 return 0;
561}