#include "test_cxc.h"
static void test_gcxgc(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);
enum {
p_between_ab = 1,
q_between_ab = 2,
p_between_cd = 4,
q_between_cd = 8,
circles_are_identically = 16
};
double lon_middle_ab, lat_middle_ab, lon_middle_cd, lat_middle_cd;
test_gcxgc(-10, 0,
10, 0,
0, 10,
0, -10,
0, 0,
180, 0,
p_between_ab + p_between_cd);
test_gcxgc(-10, 0,
10, 0,
0, -20,
0, 90,
0, 0,
180, 0,
p_between_ab + p_between_cd);
test_gcxgc(-10, 0,
10, 0,
-10, 0,
10, 0,
-10, 0,
10, 0,
p_between_ab + p_between_cd + q_between_ab + q_between_cd +
circles_are_identically);
test_gcxgc(-45, 45,
0, 0,
225, 45,
135, -45,
lon_middle_ab, lat_middle_ab,
lon_middle_cd, lat_middle_cd,
p_between_ab + q_between_cd +
circles_are_identically);
test_gcxgc( 45, 3,
45, -10,
-45, 0,
-135, -45,
45, 45,
-135, -45,
q_between_cd);
test_gcxgc( 67.5, 40,
67.5, -13,
405, 0,
450, 0,
-112.5, 0,
67.5, 0,
q_between_ab + q_between_cd);
test_gcxgc( 67.5, 40,
67.5, -13,
45, 0,
450, 0,
-112.5, 0,
67.5, 0,
q_between_ab + q_between_cd);
test_gcxgc( 10, 10,
10, 10,
-10, -10,
10, 11,
-1, -1,
-1, -1,
-1);
test_gcxgc(-10, -10,
10, 11,
10, 10,
10, 10,
-1, -1,
-1, -1,
-1);
test_gcxgc( 10, 10,
10, 10,
-10, -10,
0, 0,
10, 10,
190, -10,
p_between_ab);
test_gcxgc(-10, -10,
0, 0,
10, 10,
10, 10,
10, 10,
190, -10,
p_between_cd);
test_gcxgc( 10, 10,
10, 10,
190, -10,
170, 10,
10, 10,
190, -10,
p_between_ab + q_between_cd);
test_gcxgc(190, -10,
170, 10,
10, 10,
10, 10,
10, 10,
190, -10,
p_between_cd + q_between_ab);
test_gcxgc( 10, 10,
10, 10,
-10, -10,
10, 10,
10, 10,
190, -10,
p_between_ab + p_between_cd);
test_gcxgc( 10, 10,
10, 10,
-10, -10,
10, 10,
10, 10,
190, -10,
p_between_ab + p_between_cd);
test_gcxgc( 0, 0,
0, 0,
-10, -10,
10, 10,
0, 0,
180, 0,
p_between_ab + p_between_cd);
test_gcxgc(-10, -10,
10, 10,
0, 0,
0, 0,
0, 0,
180, 0,
p_between_ab + p_between_cd);
test_gcxgc(-10, -10,
-10, -10,
10, 10,
10, 10,
-1, -1,
-1, -1,
-1);
test_gcxgc( 10, 10,
10, 10,
-10, -10,
-10, -10,
-1, -1,
-1, -1,
-1);
test_gcxgc(-10, -10,
-10, -10,
170, 10,
170, 10,
-1, -1,
-1, -1,
-1);
test_gcxgc(170, 10,
170, 10,
-10, -10,
-10, -10,
-1, -1,
-1, -1,
-1);
test_gcxgc(-10, -10,
-10, -10,
-10, -10,
-10, -10,
-10, -10,
170, 10,
p_between_ab + p_between_cd);
return TEST_EXIT_CODE;
}
static void test_gcxgc(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)
@ YAC_GREAT_CIRCLE_EDGE
great circle
static void get_edge_middle_point(struct yac_basic_grid_data *grid, size_t edge_index, double *point)