• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Boost.Geometry
2 // Unit Test
3 
4 // Copyright (c) 2016 Oracle and/or its affiliates.
5 
6 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
7 
8 // Use, modification and distribution is subject to the Boost Software License,
9 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
11 
12 #ifndef BOOST_GEOMETRY_TEST_INTERSECTION_CASES_HPP
13 #define BOOST_GEOMETRY_TEST_INTERSECTION_CASES_HPP
14 
15 struct coordinates
16 {
17     double lon;
18     double lat;
19 };
20 
21 struct expected_result
22 {
23     double lon;
24     double lat;
25 };
26 
27 struct expected_results
28 {
29     coordinates p1;
30     coordinates p2;
31     coordinates q1;
32     coordinates q2;
33     expected_result gnomonic_vincenty;
34     expected_result gnomonic_thomas;
35     expected_result sjoberg_vincenty;
36     expected_result sjoberg_thomas;
37     expected_result sjoberg_andoyer;
38     expected_result great_elliptic;
39 };
40 
41 #define ND 1000
42 
43 expected_results expected[] =
44 {
45     {
46         { -1, -1 },{ 1, 1 },
47         { -1, 1 },{ 1, -1 },
48         { 0.0000000000000000, 0.0000000000000000 },
49         { 0.0000000000000000, 0.0000000000000000 },
50         { 0.0000000000626537, -0.0000000000000000 },
51         { -0.0000000187861002, -0.0000000000000000 },
52         { -0.0000055778585615, -0.0000000000000000 },
53         { -0.0000000000000000, -0.0000000000000000 }
54     },{
55         // TODO: Newton method in Sjoberg formula is not used in this case
56         //    due to f1 - f2 == 0. The other method is used instead.
57         //    Hence different results. Look into this.
58         { 1, 1 },{ -1, -1 },
59         { -1, 1 },{ 1, -1 },
60         { 0.0000000000000000, 0.0000000000000000 },
61         { 0.0000000000000000, 0.0000000000000000 },
62         { 0.0000000000000000, 0.0000000000626632 },
63         { -0.0000000000000006, -0.0000000187889745 },
64         { -0.0000000000000001, -0.0000055787431353 },
65         { -0.0000000000000000, 0.0000000000000000 }
66     },{
67         // TODO: Newton method in Sjoberg formula is not used in this case
68         //    due to f1 - f2 == 0. The other method is used instead.
69         //    Hence different results. Look into this.
70         { -1, -1 },{ 1, 1 },
71         { 1, -1 },{ -1, 1 },
72         { 0.0000000000000000, 0.0000000000000000 },
73         { 0.0000000000000000, 0.0000000000000000 },
74         { -0.0000000000000000, -0.0000000000626632 },
75         { -0.0000000000000004, 0.0000000187889746 },
76         { 0.0000000000000001, 0.0000055787431353 },
77         { 0.0000000000000000, 0.0000000000000000 }
78     },{
79         { 1, 1 },{ -1, -1 },
80         { 1, -1 },{ -1, 1 },
81         { 0.0000000000000000, 0.0000000000000000 },
82         { 0.0000000000000000, 0.0000000000000000 },
83         { -0.0000000000626537, -0.0000000000000000 },
84         { 0.0000000187860994, 0.0000000000000001 },
85         { 0.0000055778585615, -0.0000000000000000 },
86         { -0.0000000000000000, 0.0000000000000000 }
87     },{
88         { 0, 0 },{ 1, 1 },
89         { 0, 1 },{ 1, 0 },
90         { 0.5000000000000000, 0.5000573755188470 },
91         { 0.5000000000000000, 0.5000573755109839 },
92         { 0.5000000000313266, 0.5000573755188389 },
93         { 0.4999999906069524, 0.5000573755152582 },
94         { 0.4999972102164753, 0.5000573755151276 },
95         { 0.4999999999999999, 0.5000571197534014 }
96     },{
97         { 1, 1 },{ 0, 0 },
98         { 0, 1 },{ 1, 0 },
99         { 0.5000000000000000, 0.5000573755188470 },
100         { 0.5000000000000000, 0.5000573755109839 },
101         { 0.5000000000000000, 0.5000573755501669 },
102         { 0.4999999999999996, 0.5000573661218464 },
103         { 0.4999999999999999, 0.5000545856093679 },
104         { 0.4999999999999999, 0.5000571197534014 }
105     },{
106         { 0, 0 },{ 1, 1 },
107         { 1, 0 },{ 0, 1 },
108         { 0.5000000000000000, 0.5000573755188470 },
109         { 0.5000000000000000, 0.5000573755109839 },
110         { 0.4999999999999999, 0.5000573754875109 },
111         { 0.4999999999999999, 0.5000573849086647 },
112         { 0.5000000000000000, 0.5000601654208935 },
113         { 0.4999999999999999, 0.5000571197534014 }
114     },{
115         { 1, 1 },{ 0, 0 },
116         { 1, 0 },{ 0, 1 },
117         { 0.5000000000000000, 0.5000573755188470 },
118         { 0.5000000000000000, 0.5000573755109839 },
119         { 0.4999999999686731, 0.5000573755188389 },
120         { 0.5000000093930521, 0.5000573755152582 },
121         { 0.5000027897835244, 0.5000573755151276 },
122         { 0.4999999999999999, 0.5000571197534014 }
123     },{
124         { 1, 1 }, {2, 2},
125         {-2, -1}, {-1, -1},
126         { ND, ND },
127         { ND, ND },
128         { -0.9981650042162076, -0.999999718164758 },
129         { ND, ND },
130         { ND, ND },
131         { -0.9981731758085121, -0.9999997213000095 }
132     },{
133         {-25, -31}, {3, 44},
134         {-66, -14}, {-1, -1},
135         { ND, ND },
136         { ND, ND },
137         { -15.83269406235058, -4.87746450262433 },
138         { ND, ND },
139         { ND, ND },
140         { -15.82846301029918, -4.869650527718342 }
141     },{
142         {-47, -8}, {-1, -4},
143         {-40, -5}, {-5, -5},
144         { ND, ND },
145         { ND, ND },
146         { -10.28209064194141, -5.124101297536392 },
147         { ND, ND },
148         { ND, ND },
149         { -10.29663941896089, -5.123527178300465 }
150     }, {
151         {-43, -8}, {3, -4},
152         {-43, -5}, {3, -7},
153         { ND, ND },
154         { ND, ND },
155         { -19.95519754153282, -6.521540589691206 },
156         { ND, ND },
157         { ND, ND },
158         { -19.95535387979888, -6.517861579906892 }
159     }, {
160         {-1, -17}, {-5, 3},
161         {-40, -5}, {-1, -5},
162         { ND, ND },
163         { ND, ND },
164         { -3.424525475838061, -5.070550173747042 },
165         { ND, ND },
166         { ND, ND },
167         { -3.424493504575876, -5.070060631936228 }
168     }, {
169         {-29, -4}, {-1, -5},
170         {-40, -5}, {-1, -5},
171         { ND, ND },
172         { ND, ND },
173         { -0.9999999978280006, -5.00000000000684 },
174         { ND, ND },
175         { ND, ND },
176         { -0.9999999999999919, -5 }
177     }, {
178         {-4, -6}, {-40, -5},
179         {-40, -5}, {-1, -5},
180         { ND, ND },
181         { ND, ND },
182         { -40.00000000470697, -4.999999999854269 },
183         { ND, ND },
184         { ND, ND },
185         { -40.00000000000003, -4.999999999999998 }
186     }, {
187         {5, -4}, {-25, -5},
188         {-40, -5}, {-1, -5},
189         { ND, ND },
190         { ND, ND },
191         { -40.04870859732954, -4.998490166905039 },
192         { ND, ND },
193         { ND, ND },
194         { -39.87674154148858, -5.003778171392734 }
195     }, {
196         {-44, -1}, {38, -7},
197         {-54, -10}, {27, 3},
198         { ND, ND },
199         { ND, ND },
200         { -12.49994722584679, -4.492062263169279 },
201         { ND, ND },
202         { ND, ND },
203         { -12.49786552878283, -4.48224349980724 }
204     }, {
205         {-29, -5}, {10, -5},
206         {-40, -5}, {-1, -5},
207         { ND, ND },
208         { ND, ND },
209         { -14.99999999880286, -5.280237387890117 },
210         { ND, ND },
211         { ND, ND },
212         { -14.99999999999999, -5.278284829442087 }
213     }, {
214         {-29, -5}, {7, -5},
215         {-40, -5}, {-1, -5},
216         { ND, ND },
217         { ND, ND },
218         { -12.68814198534678, -5.255404335144863 },
219         { ND, ND },
220         { ND, ND },
221         { -12.68883814704657, -5.253634733357015 }
222     }, {
223         {-29, -5}, {2, -5},
224         {-40, -5}, {-1, -5},
225         { ND, ND },
226         { ND, ND },
227         { -6.793546728871506, -5.153444544719724 },
228         { ND, ND },
229         { ND, ND },
230         { -6.794933162619669, -5.152409434095275 }
231     }, {
232         {-29, -5}, {2, -5},
233         {-30, -5}, {-1, -5},
234         { ND, ND },
235         { ND, ND },
236         { -22.13104411461423, -5.130155316882458 },
237         { ND, ND },
238         { ND, ND },
239         { -22.13016591567375, -5.129277412801533 }
240     }, {
241         {-29, -5}, {2, -5},
242         {-32, -5}, {-1, -5},
243         { ND, ND },
244         { ND, ND },
245         { -14.99999999908104, -5.187213913248173 },
246         { ND, ND },
247         { ND, ND },
248         { -15.00000000000009, -5.185931965560752 }
249     }, {
250         {-92, -24}, {44, 19},
251         {-78, -5}, {50, -5},
252         { ND, ND },
253         { ND, ND },
254         { -31.65127861442256, -10.84411293410938 },
255         { ND, ND },
256         { ND, ND },
257         { -31.65294079308247, -10.76785432928444 }
258     }, {
259         {-93, -15}, {22, 3},
260         {-78, -5}, {50, -5},
261         { ND, ND },
262         { ND, ND },
263         { -32.33383382062637, -10.80295061031259 },
264         { ND, ND },
265         { ND, ND },
266         { -32.26069578187354, -10.73176059393484 }
267     }, {
268         {-93, -15}, {28, 3},
269         {-78, -5}, {50, -5},
270         { ND, ND },
271         { ND, ND },
272         { -25.71257598566304, -11.13752154787724 },
273         { ND, ND },
274         { ND, ND },
275         { -25.67761999514295, -11.05881610957402 }
276     }, {
277         {-54, -21}, {20, 17},
278         {-59, -5}, {13, -5},
279         { ND, ND },
280         { ND, ND },
281         { -22.96397490169162, -6.181426780426698 },
282         { ND, ND },
283         { ND, ND },
284         { -22.95999443662035, -6.172089364736989 }
285     }, {
286         {-31, -10}, {-31, -2},
287         {-37, -10}, {-25, -2},
288         { ND, ND },
289         { ND, ND },
290         { -31.00000000000001, -6.062729839503469 },
291         { ND, ND },
292         { ND, ND },
293         { -31, -6.062411484514648 }
294     }, {
295         {-26, -10}, {-26, 13},
296         {-37, -4}, {-18, -4},
297         { ND, ND },
298         { ND, ND },
299         { -25.99999999999969, -4.05441766735837 },
300         { ND, ND },
301         { ND, ND },
302         { -26, -4.05405101510235 }
303     }, {
304         {-26, -10}, {154, 78},
305         {-46, 41}, {-13, 36},
306         { ND, ND },
307         { ND, ND },
308         { -26, 39.19492836828103 },
309         { ND, ND },
310         { ND, ND },
311         { -26, 39.19004133747198 }
312     }, {
313         {-26, -10}, {154, 68},
314         {-85, 79}, {22, 80},
315         { ND, ND },
316         { ND, ND },
317         { -26.00000000000013, 83.7164889918963 },
318         { ND, ND },
319         { ND, ND },
320         { -26.00000000000002, 83.71603758698208 }
321     }, {
322         {-25, 55}, {155, 68},
323         {178, 79}, {124, 80},
324         { ND, ND },
325         { ND, ND },
326         { 155, 80.55982670305147 },
327         { ND, ND },
328         { ND, ND },
329         { 155, 80.55961176607357 }
330     }
331 };
332 
333 size_t const expected_size = sizeof(expected) / sizeof(expected_results);
334 
335 #endif // BOOST_GEOMETRY_TEST_INTERSECTION_CASES_HPP
336