• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Boost.Geometry
2 // Unit Test
3 
4 // Copyright (c) 2017 Oracle and/or its affiliates.
5 
6 // Contributed and/or modified by Vissarion Fysikopoulos, 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_VERTEX_LONGITUDE_CASES_HPP
13 #define BOOST_GEOMETRY_TEST_VERTEX_LONGITUDE_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     double andoyer;
32     double thomas;
33     double vincenty;
34     double spherical;
35 };
36 
37 expected_results expected[] =
38 {
39     { //ascenting segments (wrt pole)
40       { 1, 1 },{ 100, 2 },
41       66.25553538,
42       66.25594187,
43       66.25594273,
44       66.39744208
45     },{
46         { 1, 1 },{ 90, 2 },
47         64.09051435,
48         64.09082287,
49         64.09082352,
50         64.24414382
51     },{
52         { 0, 1 },{ 50, 1 },
53         24.99994265,
54         24.99999906,
55         25,
56         25
57     },{
58         { 0, 1 },{ 50, 1.1 },
59         30.79039009,
60         30.79049758,
61         30.79049828,
62         30.83209056
63     },{
64         { 0, 1 },{ 50, 1.2 },
65         35.95625867,
66         35.95640445,
67         35.95640493,
68         36.0343576
69     },{
70         { 0, 1 },{ 50, 1.3 },
71         40.52204781,
72         40.52222064,
73         40.52222094,
74         40.63120292
75     },{
76         { 0, 1 },{ 50, 1.4 },
77         44.53768967,
78         44.53788045,
79         44.53788061,
80         44.6729585
81     },{
82         { 0, 1 },{ 50, 1.5 },
83         48.06382018,
84         48.0640219,
85         48.06402195,
86         48.22088385
87     },{
88         { 0, 1 },{ 50, 1.6 },
89         50,
90         50,
91         50,
92         50
93     },{ //descending segment (wrt pole)
94         { 50, 1 },{ 0, 1.1 },
95         19.20950181,
96         19.20950054,
97         19.20950172,
98         19.16790944
99     },{
100         { 50, 1 },{ 0, 1.2 },
101         14.04365003,
102         14.04359367,
103         14.04359507,
104         13.9656424
105     },{
106         { 50, 1 },{ 0, 1.3 },
107         9.477883847,
108         9.477777483,
109         9.477779056,
110         9.368797077
111     },{
112         { 50, 1 },{ 0, 1.4 },
113         5.462267984,
114         5.462117673,
115         5.462119386,
116         5.327041497
117     },{
118         { 50, 1 },{ 0, 1.5 },
119         1.936164363,
120         1.935976226,
121         1.93597805,
122         1.779116148
123     },{
124         { 3, 5 },{ 150, 0},
125         60.29182988,
126         60.29785309,
127         60.29785255,
128         60
129     },{
130         { 3, 5 },{ 150, 0.5},
131         63.11344576,
132         63.11900045,
133         63.11899891,
134         62.87000766
135     },{
136         { 3, 5 },{ 150, 1},
137         65.51880171,
138         65.52391866,
139         65.52391623,
140         65.31813729
141     },{
142         { 3, 5 },{ 150, 5},
143         76.49727275,
144         76.50000657,
145         76.5,
146         76.5
147     },{ //segments parallel to equator
148         { 0, 1 },{ 4, 1 },
149         1.999999973,
150         1.999999925,
151         2,
152         2
153     },{
154         { 0, 1 },{ 10, 1 },
155         4.999999569,
156         4.999999812,
157         5,
158         5
159     },{
160         { 0, 1 },{ 60, 1 },
161         29.9998978,
162         29.99999887,
163         30,
164         30
165     },{
166         { 0, 1 },{ 90, 1 },
167         44.99960266,
168         45.22272756,//thomas low accuracy
169         45,
170         45
171     },{
172         { 0, 1 },{ 120, 1 },
173         59.99878311,
174         59.99999778,
175         60,
176         60
177     },{
178         { 0, 1 },{ 180, 1 },
179         90,
180         90,
181         90,
182         90
183     },{
184         { 0, 1 },{ 270, 1 },
185         -44.99960266,
186         -45.08931472,//thomas low accuracy
187         -45,
188         -45
189     },{
190         { 0, 1 },{ 290, 1 },
191         -34.9998314,
192         -34.99999868,
193         -35,
194         -35
195     },{
196         { 0, 1 },{ 150, 1 },
197         74.99598515,
198         74.99999794,
199         75,
200         75
201     },{
202         { 0, 1 },{ 180, 1 },
203         90,
204         90,
205         90,
206         90
207     },{ //in equator vertex is any point on segment
208         { 1, 0 },{ 10, 0 },
209         1,
210         1,
211         1,
212         1
213     },{// one point on equator (descending)
214        { 150, 0},{ 3, 1 },
215        60.29513726,
216        60.30158943,
217        60.3015947,
218        60
219     },{// one point on equator (ascending)
220        { 3, 0 },{ 150, 1},
221        92.69840523,
222        92.6984053,
223        92.6984053,
224        93
225     },{ //meridian
226         { 1, 1 },{ 1, 2 },
227         1,
228         1,
229         1,
230         1
231     },{ //nearly meridian
232         { 1, 1 },{ 1.001, 2 },
233         1.001,
234         1.001,
235         1.001,
236         1.001
237     },{ //vertex is a segment's endpoint
238         { 1, 1 },{ 10, 2 },
239         10,
240         10,
241         10,
242         10
243     },{
244         { 10, 1 },{ 1, 2 },
245         1,
246         1,
247         1,
248         1
249     },{ //South hemisphere, ascending
250         { 0, -1 },{ 50, -1.4 },
251         44.53768958,
252         44.53788035,
253         44.53788052,
254         44.6729585
255     },{ //South hemisphere, descending
256         { 0, -1.5 },{ 50, -1 },
257         1.936164356,
258         1.935976219,
259         1.935978042,
260         1.779116148
261     },{ //South hemisphere, same latitude
262         { 0, -1 },{ 50, -1 },
263         24.99994261,
264         24.99999901,
265         24.99999995,
266         25
267     },{//Both hemispheres, vertex on the northern
268        //A desc vertex north
269        { 3, 5 },{ 150, -3},
270        27.357069,
271        27.36422922,
272        27.36423549,
273        26.74999989
274     },{//B asc vertex north
275        { 3, -3 },{ 150, 5},
276        125.6403436,
277        125.6357677,
278        125.6357659,
279        126.2500001
280     },{//C desc vertex south
281        { 3, -5 },{ 150, 3},
282        27.3570679,
283        27.36422812,
284        27.36423439,
285        26.74999989
286     },{//D asc vertex south
287        { 3, 3 },{ 150, -5},
288        125.6403423,
289        125.6357664,
290        125.6357645,
291        126.2500001
292     },{//E asc vertex south
293        { 3, 3 },{ 184, -5},
294        -88.00743796,
295        -88.0660268,
296        -88.0558747,
297        -88.49315894
298     },{
299         { 3, 5 },{ 150, -3.5},
300         17.96722293,
301         17.97322407,
302         17.97323051,
303         17.3742464
304     },{
305         { 3, 5 },{ 150, -1},
306         52.9706038,
307         52.97759463,
308         52.9775964,
309         52.56504545
310     },{ //Both hemispheres, vertex on the southern
311         { 3, 3},{ 5, -5},
312         5,
313         5,
314         5,
315         5
316     },{
317         { 3, -5 },{ 150, 1}, //symmetric to { 3, 5 },{ 150, -1}
318         52.97060093,
319         52.97759176,
320         52.97759353,
321         52.56504545
322     },{// fix p1 lon, lat and p2 lon and vary p2 lat
323        { 3, 5 },{ 150, 1},
324        65.51880171,
325        65.52391866,
326        65.52391623,
327        65.31813729
328     },{
329         { 3, 5 },{ 150, 0},
330         60.29182988,
331         60.29785309,
332         60.29785255,
333         60
334     },{
335         { 3, 5 },{ 150, -0.1},
336         59.66911673,
337         59.67523649,
338         59.67523616,
339         59.36690727
340     },{
341         { 3, 5 },{ 150, -1},
342         52.9706038,
343         52.97759463,
344         52.9775964,
345         52.56504545
346     },{
347         { 3, 5 },{ 150, -4.15},
348         4.481947557,
349         4.485467841,
350         4.485473295,
351         3.981178967
352     },{
353         { 3, 5 },{ 150, -4.2},
354         3,
355         3,
356         3,
357         3
358     },{//symmetry of geodesics:
359            // (i) case A same as C and B same as D
360            // (ii) longitude diff between vertex and p2 in A, C equals
361            //      longitude diff between vertex and p1 in B, D by symmetry
362            // case (A)
363            { 0, 5 },{ 30, 5.5},
364            25.06431998,
365            25.0644277,
366            25.06442787,
367            25.13253724
368         },{// case (B)
369            { 0, 5.5 },{ 30, 5},
370            4.935667094,
371            4.935571216,
372            4.93557213,
373            4.867462762
374         },{// case (C)
375            { 0, -5 },{ 30, -5.5},
376            25.06431885,
377            25.06442657,
378            25.06442674,
379            25.13253724
380         },{// case (D)
381            { 0, -5.5 },{ 30, -5},
382            4.935666841,
383            4.935570963,
384            4.935571877,
385            4.867462762
386         },{//crossing meridian
387            { -10, 1 },{ 50, 1.1},
388            24.68113946,
389            24.68127641,
390            24.68127733,
391            24.71605263
392         },{
393            { 350, 1 },{ 50, 1.1},
394            24.68113946,
395            24.68127641,
396            24.68127733,
397            24.71605263
398         },{//crossing antimeridian
399            { 130, 1 },{ 190, 1.1},
400            164.6811395,
401            164.6812764,
402            164.6812773,
403            164.7160526
404         },{
405            { 130, 1 },{ -170, 1.1},
406            164.6811395,
407            164.6812764,
408            164.6812773,
409            164.7160526
410         },{//crossing meridian both hemispheres
411            { -10, -5 },{ 150, 1},
412            55.61285835,
413            55.62727853,
414            55.62725182,
415            55.19943725
416         },{
417             { 350, -5 },{ 150, 1},
418             55.6243632,
419             55.6272619,
420             55.627257,
421             55.1994373
422         },{//crossing anti-meridian both hemispheres
423            { 90, -5 },{ 210, 1},
424            109.4997596,
425            109.5011987,
426            109.5012031,
427            109.1354089
428         },{
429             { 90, -5 },{ -150, 1},
430             109.4997596,
431             109.5011987,
432             109.5012031,
433             109.1354089
434         },{
435             { -150, -5 },{ 90, 1},
436             -169.4997596,
437             -169.5011987,
438             -169.5012031,
439             -169.1354089
440         },{
441             { 90, 1 },{ 210, -5},
442             -169.5008004,
443             -169.5012037,
444             -169.501204,
445             -169.1354089
446         },{
447             { 0, 1 },{ 120, -5},
448             100.4991996,
449             100.4987963,
450             100.498796,
451             100.8645911
452         }
453 };
454 
455 size_t const expected_size = sizeof(expected) / sizeof(expected_results);
456 
457 #endif // BOOST_GEOMETRY_TEST_VERTEX_LONGITUDE_CASES_HPP
458