12static void utest_loncxlonc(
13 double lon_a,
double lat_a,
double lon_b,
double lat_b,
14 double lon_c,
double lat_c,
double lon_d,
double lat_d,
15 double lon_ref_p,
double lat_ref_p,
16 double lon_ref_q,
double lat_ref_q,
int ref_ret_val);
20 int const p_between_ab = 1 << 0;
21 int const q_between_ab = 1 << 1;
22 int const p_between_cd = 1 << 2;
23 int const q_between_cd = 1 << 3;
24 int const circles_are_identically = 1 << 4;
28 for (
int i = 0;
i < 2; ++
i) {
30 double lat_coords[2][2] = {{-10, 5}, {-5, 10}};
31 utest_loncxlonc(0, lat_coords[i][0],
33 0, lat_coords[i^1][0],
34 0, lat_coords[i^1][1],
37 p_between_ab + p_between_cd + q_between_ab + q_between_cd +
38 circles_are_identically);
41 for (
int i = 0;
i < 2; ++
i) {
43 double lat_coords[2][2] = {{20, 25}, {30, 10}};
44 utest_loncxlonc(10, lat_coords[i][0],
46 10, lat_coords[i^1][0],
47 10, lat_coords[i^1][1],
50 p_between_ab + p_between_cd + q_between_ab + q_between_cd +
51 circles_are_identically);
56 for (
int i = 0;
i < 2; ++
i) {
58 double lat_coords[2][2] = {{-80, -70}, {20, 30}};
59 utest_loncxlonc(30, lat_coords[i][0],
61 30, lat_coords[i^1][0],
62 30, lat_coords[i^1][1],
63 30, (lat_coords[i][0] +
64 lat_coords[i][1])*0.5,
65 30, (lat_coords[i^1][0] +
66 lat_coords[i^1][1])*0.5,
67 p_between_ab + q_between_cd +
68 circles_are_identically);
73 for (
int i = 0;
i < 2; ++
i) {
75 double lat_coords[2][2] = {{-80, -70}, {20, 30}};
76 utest_loncxlonc(-30, lat_coords[i][0],
77 -30, lat_coords[i][1],
78 30, lat_coords[i^1][0],
79 30, lat_coords[i^1][1],
88 for (
int i = 0;
i < 2; ++
i) {
90 double lat_coords[2][2] = {{80, 85}, {70, 75}};
91 utest_loncxlonc(-45 , lat_coords[i][0],
92 -45+180, lat_coords[i][1],
93 50 , lat_coords[i^1][0],
94 50 , lat_coords[i^1][1],
103 for (
int i = 0;
i < 2; ++
i) {
105 double lat_coords[2][2] = {{90, 80}, {-40, -30}};
106 int ret_val[2] = {p_between_ab, p_between_cd};
107 utest_loncxlonc(60, lat_coords[i][0],
108 60, lat_coords[i][1],
109 90, lat_coords[i^1][0],
110 90, lat_coords[i^1][1],
119 for (
int i = 0;
i < 2; ++
i) {
121 double lat_coords[2][2] = {{75, 80},{60, 85}};
122 utest_loncxlonc(60 , lat_coords[i][0],
123 60-180, lat_coords[i][1],
124 90 , lat_coords[i^1][0],
125 90-180, lat_coords[i^1][1],
128 p_between_ab + p_between_cd);
134 for (
int i = 0;
i < 2; ++
i) {
136 double lat_coords[2][2] = {{-75, -80},{-60, -85}};
137 utest_loncxlonc(60 , lat_coords[i][0],
138 60-180, lat_coords[i][1],
139 90 , lat_coords[i^1][0],
140 90-180, lat_coords[i^1][1],
143 q_between_ab + q_between_cd);
146 for (
int i = 0;
i < 2; ++
i) {
148 double lat_coords[2][2] = {{-75, -80},{-60, -90}};
149 utest_loncxlonc(60 , lat_coords[i][0],
150 60-180, lat_coords[i][1],
151 90 , lat_coords[i^1][0],
152 90-180, lat_coords[i^1][1],
155 q_between_ab + q_between_cd);
161 utest_loncxlonc( 0, -10,
169 utest_loncxlonc(10, -10,
177 utest_loncxlonc( 0, 10,
185 utest_loncxlonc( 0, 0,
196 utest_loncxlonc( 0, 10,
207 utest_loncxlonc( 0, 0,
213 p_between_ab + p_between_cd);
217 for (
int i = 0;
i < 8; ++
i) {
218 double lon_coords[2] = {0 , 90};
219 double lat_coords[2] = {-90, 90};
221 utest_loncxlonc(lon_coords[i>>2], lat_coords[i&1],
222 lon_coords[i>>2], lat_coords[i&1],
223 lon_coords[(i>>2)^1], lat_coords[(i>>1)&1],
224 lon_coords[(i>>2)^1], lat_coords[(i>>1)&1],
227 (((i&1)==((i>>1)&1))?
228 (p_between_ab+p_between_cd):
234 for (
int j = 0; j < 2; ++j) {
235 double lat_coords[2][2] = {{90, 90}, {-10, 10}};
236 int ref_ret_val[2] = {p_between_ab, p_between_cd};
237 for (
int i = 0;
i < 2; ++
i) {
238 double lon_coords[2] = {0, 10};
239 utest_loncxlonc(lon_coords[i], lat_coords[j][0],
240 lon_coords[i], lat_coords[j][1],
241 lon_coords[i^1], lat_coords[j^1][0],
242 lon_coords[i^1], lat_coords[j^1][1],
251 for (
int i = 0;
i < 4; ++
i) {
252 double lat_coords[2][2] = {{-89, 89},{-90, 90}};
253 int ret_val[2] = {p_between_ab+q_between_cd,
254 p_between_ab+p_between_cd};
255 utest_loncxlonc( 0, lat_coords[0][i&1],
256 180, lat_coords[0][i&1],
257 45, lat_coords[0][i>>1],
258 225, lat_coords[0][i>>1],
259 0, lat_coords[1][i&1],
260 0, -lat_coords[1][i&1],
261 ret_val[(i&1)==(i>>1)]);
264 for (
int i = 0;
i < 4; ++
i) {
265 double lat_coords[2][2] = {{-85, 85}, {-90, 90}};
266 int ret_val[2] = {p_between_ab + q_between_cd,
267 p_between_ab + p_between_cd};
268 utest_loncxlonc( 0, lat_coords[0][i&1],
269 180, lat_coords[0][i&1],
270 45, lat_coords[0][i>>1],
271 225, lat_coords[0][i>>1],
272 0, lat_coords[1][i&1],
273 0, lat_coords[1][(i&1)^1],
274 ret_val[(i&1)==(i>>1)]);
279 for (
int j = 0; j < 4; ++j) {
280 double lon_coords[2] = {0, 180};
281 for (
int i = 0;
i < 2; ++
i) {
282 double lat_coords[2][2] = {{-85, 85}, {-90, 90}};
283 utest_loncxlonc(lon_coords[j&1], lat_coords[0][i&1],
284 lon_coords[(j&1)^1], lat_coords[0][i&1],
285 lon_coords[j>>1], lat_coords[0][(i&1)^1],
286 lon_coords[(j>>1)^1], lat_coords[0][(i&1)^1],
287 0, lat_coords[1][i&1],
288 0, lat_coords[1][(i&1)^1],
289 p_between_ab + q_between_cd + circles_are_identically);
295 for (
int j = 0; j < 2; ++j) {
296 double lon_coords[2] = {0, 60};
297 for (
int i = 0;
i < 2; ++
i) {
298 double lat_coords[2][2] = {{-85, -90}, {85, 90}};
299 utest_loncxlonc(lon_coords[j], lat_coords[i][0],
300 lon_coords[j], lat_coords[i][1],
301 lon_coords[j^1], lat_coords[i][0],
302 lon_coords[j^1], lat_coords[i][1],
304 0, lat_coords[i^1][1],
305 p_between_ab + p_between_cd);
311 for (
int i = 0;
i < 2; ++
i) {
312 double lat_coords[2][2] = {{-85, -90}, {85, 90}};
313 utest_loncxlonc(60, lat_coords[i][0],
314 60, lat_coords[i][1],
315 60+180, lat_coords[i][0],
316 60+180, lat_coords[i][1],
319 p_between_ab + p_between_cd +
320 q_between_ab + q_between_cd +
321 circles_are_identically);
326 for (
int i = 0;
i < 2; ++
i) {
327 double lat_coords[2][2] = {{-85, -80}, {85, 80}};
328 utest_loncxlonc(60, lat_coords[i][0],
329 60+180, lat_coords[i][1],
330 60+180, lat_coords[i][0],
331 60, lat_coords[i][1],
332 60, lat_coords[i][0],
333 60+180, lat_coords[i][0],
334 p_between_ab + p_between_cd +
335 q_between_ab + q_between_cd + circles_are_identically);
338 for (
int i = 0;
i < 2; ++
i) {
339 for (
int j = 0; j < 2; ++j) {
340 double lat_coords[2][2] = {{-85, -80}, {85, 80}};
341 utest_loncxlonc(60, lat_coords[i][j],
342 60+180, lat_coords[i][j],
343 60+180, lat_coords[i][j^1],
344 60, lat_coords[i][j^1],
345 60, lat_coords[i][0],
346 60+180, lat_coords[i][0],
347 p_between_ab + p_between_cd +
348 q_between_ab + q_between_cd + circles_are_identically);
352 for (
int i = 0;
i < 2; ++
i) {
353 for (
int j = 0; j < 2; ++j) {
354 double lat_coords[2][3] = {{-80, -85, -90}, {80, 85, 90}};
355 utest_loncxlonc(60, lat_coords[i][j],
356 60, lat_coords[i][2],
357 60, lat_coords[i][j^1],
358 60, lat_coords[i][2],
359 60, lat_coords[i][1],
360 60, lat_coords[i][2],
361 p_between_ab + p_between_cd +
362 q_between_ab + q_between_cd + circles_are_identically);
366 for (
int i = 0;
i < 2; ++
i) {
367 double lat_coords[2][2] = {{-85, -90}, {85, 90}};
368 utest_loncxlonc(60, lat_coords[i][0],
369 60, lat_coords[i][1],
370 60, lat_coords[i][0],
371 60, lat_coords[i][1],
372 60, lat_coords[i][0],
373 60, lat_coords[i][1],
374 p_between_ab + p_between_cd +
375 q_between_ab + q_between_cd + circles_are_identically);
381static void utest_loncxlonc(
double lon_a,
double lat_a,
double lon_b,
double lat_b,
382 double lon_c,
double lat_c,
double lon_d,
double lat_d,
383 double lon_ref_p,
double lat_ref_p,
384 double lon_ref_q,
double lat_ref_q,
int ref_ret_val) {
386 test_cxc(lon_a, lat_a, lon_b, lat_b, lon_c, lat_c, lon_d, lat_d,
388 lon_ref_p, lat_ref_p, lon_ref_q, lat_ref_q, ref_ret_val);
@ YAC_LON_CIRCLE_EDGE
longitude circle
void test_cxc(double lon_a, double lat_a, double lon_b, double lat_b, double lon_c, double lat_c, double lon_d, double lat_d, enum yac_edge_type edge_type_a, enum yac_edge_type edge_type_b, double lon_ref_p, double lat_ref_p, double lon_ref_q, double lat_ref_q, int ref_ret_val)