24 double base_vector[3], vector_a[3], vector_b[3];
26 LLtoXYZ(base_point[0], base_point[1], base_vector);
27 LLtoXYZ(point_a[0], point_a[1], vector_a);
28 LLtoXYZ(point_b[0], point_b[1], vector_b);
30 double distance_a, distance_b;
35 if (distance_a >= distance_b)
36 PUT_ERR(
"error in distance calculation\n");
40 double const tol = 1e-10;
41 double angles[] = {-M_PI_2 +
tol, -M_PI_4, -
tol, 0,
42 tol, M_PI_4, M_PI_2 -
tol};
43 double offsets[] = {-6.0*M_PI, -4.0*M_PI, -2.0*M_PI, 0,
44 2.0*M_PI, 4.0*M_PI, 6.0*M_PI};
45 double start[] = {-M_PI, -M_PI_2, -M_PI_4, -M_1_PI, -
tol, 0,
46 tol, M_1_PI, M_PI_4, M_PI_2, M_PI};
48 for (
size_t i = 0;
i <
sizeof(angles) /
sizeof(angles[0]); ++
i) {
49 for (
size_t j = 0; j <
sizeof(offsets) /
sizeof(offsets[0]); ++j) {
50 for (
size_t k = 0; k <
sizeof(offsets) /
sizeof(offsets[0]); ++k) {
51 for (
size_t l = 0; l <
sizeof(start) /
sizeof(start[0]); ++l) {
53 double a_lon = start[l] + offsets[j] + angles[
i];
54 double b_lon = start[l] + offsets[k];
57 PUT_ERR(
"error in get_angle\n");
75 PUT_ERR(
"error in yac_extents_overlap\n");
90 PUT_ERR(
"error in yac_extents_overlap\n");
int yac_extents_overlap(struct bounding_circle *extent_a, struct bounding_circle *extent_b)
static const struct sin_cos_angle SIN_COS_LOW_TOL
static const struct sin_cos_angle SIN_COS_M_PI
static int sub_angles(struct sin_cos_angle a, struct sin_cos_angle b, struct sin_cos_angle *restrict sub)
static double get_angle(double a_lon, double b_lon)
static double get_vector_angle(double const a[3], double const b[3])
struct sin_cos_angle inc_angle
angle between the middle point and the boundary of the spherical cap
static void LLtoXYZ(double lon, double lat, double p_out[])