This contains examples on gcxlatc_vec.
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "test_cxc.h"
static void test_gcxlatc(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
};
test_gcxlatc(-10, 10,
10, 10,
-10, 0,
10, 0,
90, 0,
-90, 0,
test_gcxlatc(-10, 10,
10, -10,
-10, 0,
10, 0,
180, 0,
0, 0,
q_between_ab + q_between_cd);
test_gcxlatc( 0, 90,
140, 60,
90, -45,
39, -45,
140, -45,
-40, -45,
test_gcxlatc(-10, 10,
10, 9,
-10, 70,
10, 70,
-10, 70,
10, 70,
-1);
test_gcxlatc(-10, 9,
10, 10,
-10, 70,
10, 70,
-10, 70,
10, 70,
-1);
test_gcxlatc(-90, 0,
0, 45,
-10, 45,
10, 45,
0, 45,
0, 45,
p_between_ab + p_between_cd +
q_between_ab + q_between_cd);
test_gcxlatc(-90, 0,
0, 45,
10, 90,
20, 90,
10, 90,
20, 90,
-1);
test_gcxlatc(15 , 85,
180 + 15, 85,
10 , 90,
20 , 90,
0, 90,
0, -90,
p_between_ab + p_between_cd);
test_gcxlatc(30, 90,
30, 70,
10, 90,
20, 90,
0, 90,
0, -90,
p_between_ab + p_between_cd);
test_gcxlatc(30, 70,
30, 70,
10, 60,
20, 60,
-1, -1,
-1, -1,
-1);
test_gcxlatc( 15, 10,
15, 10,
10, 10,
20, 10,
15, 10,
195, 10,
p_between_ab + p_between_cd);
test_gcxlatc(-5, -5,
5, 5,
10, 89,
10, 89,
-1, -1,
-1, -1,
-1);
test_gcxlatc(-5, -5,
5, 5,
10, 0,
10, 0,
-1, -1,
-1, -1,
-1);
test_gcxlatc( -5, -5,
5, 5,
0, 0,
0, 0,
0, 0,
0+180, 0,
p_between_ab + p_between_cd);
{
double a[3] = {-0.18125814883147034, -0.5578552203226167, -0.80990310324198245};
double b[3] = {-0.18125814875183416, -0.557855220392383, -0.80990310321175063};
double c[3] = {-0.18673822182292288, -0.54232717509597339, -0.8191520442889918};
double d[3] = {-0.1772448664054937, -0.5455036073850148, -0.8191520442889918};
double p[3], q[3];
}
{
double a[3] = {0.049067638730680319, 0.0012045429209767452, -0.99879473161693588};
double b[3] = {0.049067674327417689, 0, -0.99879545620517241};
double c[3] = {0.049067674327418126, 0, -0.99879545620517241};
double d[3] = {0.049052896061289972, 0.0012041810087570048, -0.99879545620517241};
double p[3], q[3];
}
test_gcxlatc(-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_gcxlatc( 0, 0,
10, 0,
-10, 0,
10, 0,
0, 0,
10, 0,
p_between_ab + p_between_cd +
q_between_ab + q_between_cd +
circles_are_identically);
test_gcxlatc( -5, 0,
5, 0,
-10, 0,
10, 0,
-5, 0,
5, 0,
p_between_ab + p_between_cd +
q_between_ab + q_between_cd +
circles_are_identically);
test_gcxlatc(-10, 0,
10, 0,
-5, 0,
5, 0,
-5, 0,
5, 0,
p_between_ab + p_between_cd +
q_between_ab + q_between_cd +
circles_are_identically);
test_gcxlatc(170, 0,
190, 0,
-10, 0,
10, 0,
180, 0,
0, 0,
p_between_ab + q_between_cd +
circles_are_identically);
return TEST_EXIT_CODE;
}
static void test_gcxlatc(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)
int yac_intersect_vec(enum yac_edge_type edge_type_a, double const a[3], double const b[3], enum yac_edge_type edge_type_b, double const c[3], double const d[3], double p[3], double q[3])
@ YAC_GREAT_CIRCLE_EDGE
great circle
@ YAC_LAT_CIRCLE_EDGE
latitude circle