18double const tol = 1.0e-10;
27static unsigned utest_point_in_circle(
double point[3],
struct bounding_circle circle);
178 double coordinates_x[] = {-1.0, -0.75, 0.75, 1.0, 0.75, -0.75};
186 double coordinates_x[] = {0.0, 60.0, 120.0, 180.0, 240.0, 300.0};
187 double coordinates_y[] = {88.0, 88.0, 88.0, 88.0, 88.0, 88.0};
194 double coordinates_x[] = {0.0, 52.0, 104.0, 156.0, 208.0, 260.0, 312.0};
195 double coordinates_y[] = {88.0, 88.0, 88.0, 88.0, 88.0, 88.0};
207 for (
int order = -1; order <= 1; order += 2) {
209 for (
int start = 0; start < 3; ++start) {
211 double temp_coordinates_x[3];
212 double temp_coordinates_y[3];
215 for (
int i = 0;
i < 3; ++
i) {
219 temp_coordinates_y[i]*
YAC_RAD, coords[i]);
229 utest_test_circle(cell, bnd_circle);
241 for (
unsigned i = 0;
i < 4; ++
i) {
246 for (
int order = -1; order <= 1; order += 2) {
248 for (
int start = 0; start < 4; ++start) {
250 double temp_coordinates_x[4];
251 double temp_coordinates_y[4];
253 for (
int i = 0;
i < 4; ++
i) {
265 utest_test_circle(cell, bnd_circle);
272static void utest_check_gc(
277 for (
size_t i = 0;
i < num_corners; ++
i) {
283 for (
int order = -1; order <= 1; order += 2) {
285 for (
size_t start = 0; start < num_corners; ++start) {
287 double temp_coordinates_x[num_corners];
288 double temp_coordinates_y[num_corners];
290 for (
size_t i = 0;
i < num_corners; ++
i) {
291 temp_coordinates_x[
i] =
293 temp_coordinates_y[
i] =
299 temp_coordinates_x, temp_coordinates_y, edges,
num_corners);
305 utest_test_circle(cell, bnd_circle);
314 for (
int order = -1; order <= 1; order += 2) {
316 for (
int start = 0; start < 4; ++start) {
318 double temp_coordinates_x[4];
319 double temp_coordinates_y[4];
323 for (
int i = 0;
i < 4; ++
i) {
327 temp_coordinates_y[i]*
YAC_RAD, coords[i]);
331 for (
int i = 0;
i < 4; ++
i) {
333 fabs(temp_coordinates_y[i] - temp_coordinates_y[(i+3)%4]) > 0.0;
344 utest_test_circle(cell, bnd_circle);
354 double temp = v[0] * v[0] + v[1] * v[1];
356 if (fabs(temp) < 1e-9) {
360 v[2] = copysign(1.0, v[2]);
366 if (fabs(v[2]) < 1e-9) {
370 norm = 1.0 - v[2] * v[2];
373 norm = sqrt(norm/temp);
385 PUT_ERR(
"point is not in bounding circle\n");
387 PUT_ERR(
"point is not in bounding circle\n");
389 double edge_middle_point[3];
391 edge_middle_point[0] =
393 edge_middle_point[1] =
395 edge_middle_point[2] =
401 edge_middle_point[2] =
414 if (!utest_point_in_circle(edge_middle_point, circle))
415 PUT_ERR(
"point is not in bounding circle\n");
417 PUT_ERR(
"point is not in bounding circle\n");
421static unsigned utest_point_in_circle(
double point[3],
struct bounding_circle circle) {
void yac_get_cell_bounding_circle(struct yac_grid_cell cell, struct bounding_circle *bnd_circle)
static struct sin_cos_angle get_vector_angle_2(double const a[3], double const b[3])
static const struct sin_cos_angle SIN_COS_M_PI
static int yac_point_in_bounding_circle_vec(double point_vector[3], struct bounding_circle *bnd_circle)
static struct sin_cos_angle sum_angles_no_check(struct sin_cos_angle a, struct sin_cos_angle b)
static const struct sin_cos_angle SIN_COS_TOL
static int compare_angles(struct sin_cos_angle a, struct sin_cos_angle b)
static void normalise_vector(double v[])
void yac_free_grid_cell(struct yac_grid_cell *cell)
@ YAC_GREAT_CIRCLE_EDGE
great circle
@ YAC_LAT_CIRCLE_EDGE
latitude circle
@ YAC_LON_CIRCLE_EDGE
longitude circle
struct sin_cos_angle inc_angle
angle between the middle point and the boundary of the spherical cap
enum yac_edge_type * edge_type
double(* coordinates_xyz)[3]
static void normalise_vector_lat(double v[])
struct yac_grid_cell generate_cell_deg(double *lon, double *lat, enum yac_edge_type *edge_type, size_t num_corners)
static void LLtoXYZ(double lon, double lat, double p_out[])