vertex_longitude_cases.hpp 9.6 KB

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