#include "test_cxc.h"
static void test_loncxlatc(double lon_a, double lat_a, double lon_b, double lat_b,
double lon_c, double lat_c, double lon_d, double lat_d,
double lon_ref_p, double lat_ref_p,
double lon_ref_q, double lat_ref_q, int ref_ret_val);
unsigned const p_between_ab = 1 << 0;
unsigned const q_between_ab = 1 << 1;
unsigned const p_between_cd = 1 << 2;
test_loncxlatc( 0, 10,
0, -10,
10, 0,
-10, 0,
0, 0,
180, 0,
p_between_ab + p_between_cd);
test_loncxlatc(65, 35,
65, 45,
60, 40,
70, 40,
65, 40,
65+180, 40,
p_between_ab + p_between_cd);
test_loncxlatc(-30, -60,
-30, -70,
-31, -65,
-40, -65,
-30, -65,
-30+180, -65,
p_between_ab);
test_loncxlatc(-30, -60,
-30, -70,
-30, -65,
-40, -65,
-30, -65,
-30+180, -65,
p_between_ab + p_between_cd);
test_loncxlatc(-45, 80,
-45, 90,
-40, 70,
-50, 70,
-45, 70,
-45+180, 70,
p_between_cd);
test_loncxlatc(-45, 70,
-45, 90,
-40, 70,
-50, 70,
-45, 70,
-45+180, 70,
p_between_ab + p_between_cd);
test_loncxlatc(-45, 80,
-45+180, 80,
20, 90,
30, 90,
0, 90,
0, -90,
p_between_ab + p_between_cd);
test_loncxlatc(-45, -80,
-45+180, -80,
20, -90,
30, -90,
0, -90,
0, 90,
p_between_ab + p_between_cd);
test_loncxlatc(-45, 80,
-45, 85,
20, 90,
30, 90,
0, 90,
0, -90,
p_between_cd);
test_loncxlatc(-45, -80,
-45, -85,
20, -90,
30, -90,
0, -90,
0, 90,
p_between_cd);
test_loncxlatc(-45, -80,
-45, -90,
20, -90,
30, -90,
0, -90,
0, 90,
p_between_ab + p_between_cd);
test_loncxlatc( 0, -80,
180, -80,
50, -89,
60, -89,
0, -89,
180, -89,
p_between_ab + q_between_ab);
test_loncxlatc( 0, -80,
180, -80,
-10, -89,
10, -89,
0, -89,
180, -89,
p_between_ab + p_between_cd + q_between_ab);
test_loncxlatc( 0, 0,
0, 0,
5, 10,
5, 10,
-1, -1,
-1, -1,
-1);
test_loncxlatc( 0, 0,
0, 0,
5, 10,
10, 10,
-1, -1,
-1, -1,
-1);
test_loncxlatc( 0, 0,
0, 0,
5, 0,
-5, 0,
0, 0,
180, 0,
p_between_ab + p_between_cd);
test_loncxlatc( 0, -5,
0, 5,
5, 0,
5, 0,
-1, -1,
-1, -1,
-1);
test_loncxlatc( 0, -5,
0, 5,
5, 10,
5, 10,
-1, -1,
-1, -1,
-1);
test_loncxlatc( 0, -5,
0, 5,
0, 0,
0, 0,
0, 0,
180, 0,
p_between_ab + p_between_cd);
test_loncxlatc( 0, 90,
140, 60,
90, -45,
39, -45,
140, -45,
-40, -45,
0);
for (int i = 0; i < 4; ++i) {
double lat_coords[2] = {90, -90};
int ret_val[2] = {-1, p_between_ab + p_between_cd};
test_loncxlatc( 20, lat_coords[i&1],
200, lat_coords[i&1],
10, lat_coords[i>>1],
20, lat_coords[i>>1],
0, lat_coords[i>>1],
0, -lat_coords[i>>1],
ret_val[(i&1)==(i>>1)]);
}
{
double a[3] = {-0.01728256081754178,
-0.0024289055230921597,
0.99984769515639127};
double b[3] = {-0.034559857199638548,
-0.0048570711780326408,
0.99939082701909576};
double c[3] = {-0.017298289573378096,
-0.0023142316840916847,
0.99984769515639127};
double d[3] = { 0.01732231884620395,
0.0021269133133512588,
0.99984769515639127};
double a_lon, a_lat, b_lon, b_lat, c_lon, c_lat, d_lon, d_lat;
p_between_ab + p_between_cd);
}
return TEST_EXIT_CODE;
}
static void test_loncxlatc(double lon_a, double lat_a, double lon_b, double lat_b,
double lon_c, double lat_c, double lon_d, double lat_d,
double lon_ref_p, double lat_ref_p,
double lon_ref_q, double lat_ref_q, int ref_ret_val) {
test_cxc(lon_a, lat_a, lon_b, lat_b, lon_c, lat_c, lon_d, lat_d,
lon_ref_p, lat_ref_p, lon_ref_q, lat_ref_q, ref_ret_val);
}
int main(int argc, char **argv)
static void XYZtoLL(double const p_in[], double *lon, double *lat)
@ YAC_LAT_CIRCLE_EDGE
latitude circle
@ YAC_LON_CIRCLE_EDGE
longitude circle