YetAnotherCoupler 3.2.0_a
Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions | Variables
geometry.h File Reference
#include "config.h"
#include <math.h>
#include <float.h>
#include "basic_grid.h"
#include "grid_cell.h"
#include "utils_core.h"
Include dependency graph for geometry.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sin_cos_angle
 
struct  bounding_circle
 
struct  yac_circle
 

Macros

#define YAC_RAD   (0.01745329251994329576923690768489)
 
#define yac_angle_tol   (1e-9)
 
#define yac_sq_angle_tol   (1e-9 * 1e-9)
 
#define yac_cos_angle_tol   (0.9999999999999999995)
 
#define yac_angle_low_tol   (1e-11)
 
#define yac_cos_angle_low_tol   (1.0)
 

Enumerations

enum  yac_circle_type { GREAT_CIRCLE = YAC_GREAT_CIRCLE_EDGE , LAT_CIRCLE = YAC_LAT_CIRCLE_EDGE , LON_CIRCLE = YAC_LON_CIRCLE_EDGE , POINT }
 

Functions

int yac_point_in_cell (double point_coords[3], struct yac_grid_cell cell)
 
int yac_point_in_cell2 (double point_coords[3], struct yac_grid_cell cell, struct bounding_circle bnd_circle)
 
static double get_angle (double a_lon, double b_lon)
 
static double get_angle_deg (double a_lon, double b_lon)
 
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])
 
void yac_get_cell_bounding_circle (struct yac_grid_cell cell, struct bounding_circle *bnd_circle)
 
void yac_get_cell_circumscribe_circle_unstruct_triangle (double a[3], double b[3], double c[3], struct bounding_circle *bnd_circle)
 
void yac_get_cell_bounding_circle_unstruct_triangle (double a[3], double b[3], double c[3], struct bounding_circle *bnd_circle)
 
void yac_get_cell_circumscribe_circle_reg_quad (double a[3], double b[3], double c[3], struct bounding_circle *bnd_circle)
 
void yac_get_cell_bounding_circle_reg_quad (double a[3], double b[3], double c[3], struct bounding_circle *bnd_circle)
 
int yac_extents_overlap (struct bounding_circle *extent_a, struct bounding_circle *extent_b)
 
static double sq_len_diff_vec (double const a[3], double const b[3])
 computes square of the lenght of the vector ab
 
static double compute_sq_crd (struct sin_cos_angle angle)
 
static int yac_point_in_bounding_circle_vec (double point_vector[3], struct bounding_circle *bnd_circle)
 
static void LLtoXYZ (double lon, double lat, double p_out[])
 
static void LLtoXYZ_deg (double lon, double lat, double p_out[])
 
static void XYZtoLL (double const p_in[], double *lon, double *lat)
 
static double det2_kahan (double a, double b, double c, double d)
 
static void crossproduct_kahan (double const a[], double const b[], double cross[])
 
static void crossproduct_d (const double a[], const double b[], double cross[])
 
static double get_vector_angle (double const a[3], double const b[3])
 
static double clamp_abs_one (double val)
 
static struct sin_cos_angle sin_cos_angle_new (double sin, double cos)
 
static struct sin_cos_angle get_vector_angle_2 (double const a[3], double const b[3])
 
static int compare_angles (struct sin_cos_angle a, struct sin_cos_angle b)
 
static double sin_cos_angle_to_dble (struct sin_cos_angle angle)
 
static struct sin_cos_angle sum_angles_no_check (struct sin_cos_angle a, struct sin_cos_angle b)
 
static int sum_angles (struct sin_cos_angle a, struct sin_cos_angle b, struct sin_cos_angle *restrict sum)
 
static struct sin_cos_angle sub_angles_no_check (struct sin_cos_angle a, struct sin_cos_angle b)
 
static int sub_angles (struct sin_cos_angle a, struct sin_cos_angle b, struct sin_cos_angle *restrict sub)
 
static double compute_angle (struct sin_cos_angle angle)
 return angles in the range of [0;2PI[
 
static struct sin_cos_angle half_angle (struct sin_cos_angle angle)
 
static struct sin_cos_angle quarter_angle (struct sin_cos_angle angle)
 
static int points_are_identically (double const *a, double const *b)
 
static int compare_coords (double const *a, double const *b)
 
static void normalise_vector (double v[])
 
static void rotate_vector2 (double axis[], struct sin_cos_angle angle, double v_in[], double v_out[])
 
static void rotate_vector (double axis[], double angle, double v_in[], double v_out[])
 
void yac_triangulate_cell (struct yac_grid_cell cell, size_t start_corner, struct yac_grid_cell *triangles)
 
void yac_triangulate_cell_indices (size_t const *corner_indices, size_t num_corners, size_t start_corner, size_t(*triangle_indices)[3])
 
void yac_compute_bnd_triangle (double *vertices, size_t num_vertices, double triangle[][3], size_t num_tests)
 
int yac_circle_intersect (struct yac_circle a, struct yac_circle b, double p[3], double q[3])
 
int yac_point_on_edge (double p[3], double const a[3], double const b[3], enum yac_circle_type circle_type)
 

Variables

static const struct sin_cos_angle SIN_COS_ZERO = {0.0, 1.0}
 
static const struct sin_cos_angle SIN_COS_TOL = {yac_angle_tol, yac_cos_angle_tol}
 
static const struct sin_cos_angle SIN_COS_LOW_TOL = {yac_angle_low_tol, yac_cos_angle_low_tol}
 
static const struct sin_cos_angle SIN_COS_M_PI_2 = {1.0, 0.0}
 
static const struct sin_cos_angle SIN_COS_M_PI = {0.0, -1.0}
 
static const struct sin_cos_angle SIN_COS_7_M_PI_4 = {-0.707106781186547524401, +0.707106781186547524401}
 

Macro Definition Documentation

◆ yac_angle_low_tol

#define yac_angle_low_tol   (1e-11)
Examples
test_lat_clipping.c.

Definition at line 37 of file geometry.h.

◆ yac_angle_tol

#define yac_angle_tol   (1e-9)

◆ yac_cos_angle_low_tol

#define yac_cos_angle_low_tol   (1.0)

Definition at line 38 of file geometry.h.

◆ yac_cos_angle_tol

#define yac_cos_angle_tol   (0.9999999999999999995)

Definition at line 36 of file geometry.h.

◆ YAC_RAD

#define YAC_RAD   (0.01745329251994329576923690768489)

◆ yac_sq_angle_tol

#define yac_sq_angle_tol   (1e-9 * 1e-9)

Definition at line 35 of file geometry.h.

Enumeration Type Documentation

◆ yac_circle_type

Enumerator
GREAT_CIRCLE 
LAT_CIRCLE 
LON_CIRCLE 
POINT 

Definition at line 72 of file geometry.h.

Function Documentation

◆ clamp_abs_one()

static double clamp_abs_one ( double  val)
inlinestatic

Definition at line 401 of file geometry.h.

Here is the caller graph for this function:

◆ compare_angles()

static int compare_angles ( struct sin_cos_angle  a,
struct sin_cos_angle  b 
)
inlinestatic
Examples
test_angle.c, and test_cell_bnd_circle.c.

Definition at line 428 of file geometry.h.

Here is the caller graph for this function:

◆ compare_coords()

static int compare_coords ( double const *  a,
double const *  b 
)
inlinestatic

compares two 3d coordinates (vectors need to have a length of 1.0)

Parameters
[in]acoordinates of point a
[in]bcoordinates of point b
Returns
0 if points are identical, otherwise -1 or 1 depending on their relation

Definition at line 662 of file geometry.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compute_angle()

static double compute_angle ( struct sin_cos_angle  angle)
inlinestatic

return angles in the range of [0;2PI[

Examples
test_angle.c.

Definition at line 572 of file geometry.h.

Here is the caller graph for this function:

◆ compute_sq_crd()

static double compute_sq_crd ( struct sin_cos_angle  angle)
inlinestatic

Definition at line 254 of file geometry.h.

Here is the caller graph for this function:

◆ crossproduct_d()

static void crossproduct_d ( const double  a[],
const double  b[],
double  cross[] 
)
inlinestatic

for small angles <= 1e-?8? the crossproduct is inaccurate
use crossproduct_kahan for these cases

Definition at line 347 of file geometry.h.

Here is the caller graph for this function:

◆ crossproduct_kahan()

static void crossproduct_kahan ( double const  a[],
double const  b[],
double  cross[] 
)
inlinestatic

Definition at line 332 of file geometry.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ det2_kahan()

static double det2_kahan ( double  a,
double  b,
double  c,
double  d 
)
inlinestatic

Definition at line 325 of file geometry.h.

Here is the caller graph for this function:

◆ get_angle()

static double get_angle ( double  a_lon,
double  b_lon 
)
inlinestatic

computes the angle between two longitude coordinates (in rad)
takes into account that longitude have a period of 2 pi

Parameters
[in]a_lon
[in]b_lon
Returns
angle between both coordinates (in rad)
Examples
test_geometry.c.

Definition at line 127 of file geometry.h.

Here is the caller graph for this function:

◆ get_angle_deg()

static double get_angle_deg ( double  a_lon,
double  b_lon 
)
inlinestatic

computes the angle between two longitude coordinates (in deg)
takes into account that longitude have a period of 360

Parameters
[in]a_lon
[in]b_lon
Returns
angle between both coordinates (in rad)

Definition at line 143 of file geometry.h.

Here is the caller graph for this function:

◆ get_vector_angle()

static double get_vector_angle ( double const  a[3],
double const  b[3] 
)
inlinestatic

computes the great circle distance in rad for two points given in xyz coordinates taken from http://johnblackburne.blogspot.de/2012/05/angle-between-two-3d-vectors.html

Parameters
[in]apoint coordinates of point a
[in]bpoint coordinates of point b
Returns
great circle distance in rad between both points
Examples
test_basic_grid.c, test_circle.c, test_clipping.c, test_compute_overlap_area.c, test_geometry.c, test_interp_grid_parallel.c, test_interp_method_nnn_parallel.c, test_interp_method_spmap_parallel.c, test_lat_clipping.c, test_partial_areas.c, and test_point_sphere_part.c.

Definition at line 364 of file geometry.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_vector_angle_2()

static struct sin_cos_angle get_vector_angle_2 ( double const  a[3],
double const  b[3] 
)
inlinestatic
Examples
test_cell_bnd_circle.c, and test_interp_grid_parallel.c.

Definition at line 415 of file geometry.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ half_angle()

static struct sin_cos_angle half_angle ( struct sin_cos_angle  angle)
inlinestatic

computes angle / 2 The basic idea is to imagin angle being a vector v with (cos(x); sin(x)) and w being a vector with (1.0; 0.0). The normalised sum of v and w gives us v_h with (cos(x/2); sin(x/2)). For quadrants 2, 3, and 4 we have to apply some little tricks for higher accuracy.

Examples
test_angle.c.

Definition at line 600 of file geometry.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LLtoXYZ()

static void LLtoXYZ ( double  lon,
double  lat,
double  p_out[] 
)
inlinestatic

converts lon-lat coordinates into xyz ones

Further information: http://en.wikipedia.org/wiki/List_of_common_coordinate_transformations

Parameters
[in]lonlongitude coordinates in radian
[in]latlatitude coordinates in radian
[out]p_outxyz coordinates
Examples
test_bnd_sphere_part.c, test_cell_bnd_circle.c, test_geometry.c, test_interp_grid_parallel.c, test_interpolation_parallel4.c, test_partial_areas.c, test_point_in_cell.c, and test_point_sphere_part.c.

Definition at line 287 of file geometry.h.

Here is the caller graph for this function:

◆ LLtoXYZ_deg()

static void LLtoXYZ_deg ( double  lon,
double  lat,
double  p_out[] 
)
inlinestatic

◆ normalise_vector()

static void normalise_vector ( double  v[])
inlinestatic

◆ points_are_identically()

static int points_are_identically ( double const *  a,
double const *  b 
)
inlinestatic

determines whether two given points are (nearly) identically

Parameters
[in]apoint coordinates of point a
[in]bpoint coordinates of point b
Returns
true if both points are (nearly) identically
Examples
test_point_sphere_part.c.

Definition at line 648 of file geometry.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ quarter_angle()

static struct sin_cos_angle quarter_angle ( struct sin_cos_angle  angle)
inlinestatic

computes angle / 4 I derived it based on half_angle

Examples
test_angle.c.

Definition at line 617 of file geometry.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rotate_vector()

static void rotate_vector ( double  axis[],
double  angle,
double  v_in[],
double  v_out[] 
)
inlinestatic

rotate vector v_in around the given axis by a given angle

Parameters
[in]axisaxis around which v_in is to rotated
[in]anglerotation angle
[in]v_invector to be rotated
[out]v_outrotated vector

Definition at line 732 of file geometry.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rotate_vector2()

static void rotate_vector2 ( double  axis[],
struct sin_cos_angle  angle,
double  v_in[],
double  v_out[] 
)
inlinestatic

rotate vector v_in around the given axis by a given angle

Parameters
[in]axisaxis around which v_in is to rotated
[in]anglerotation angle
[in]v_invector to be rotated
[out]v_outrotated vector

Definition at line 704 of file geometry.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sin_cos_angle_new()

static struct sin_cos_angle sin_cos_angle_new ( double  sin,
double  cos 
)
inlinestatic
Examples
test_angle.c, test_bnd_sphere_part.c, test_point_in_cell.c, and test_point_sphere_part.c.

Definition at line 405 of file geometry.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sin_cos_angle_to_dble()

static double sin_cos_angle_to_dble ( struct sin_cos_angle  angle)
inlinestatic

this routine converts a struct sin_cos_angle into a double, which allows to easily compare angles 0: 0 <= angle < PI/4 => ret = 0 * M_SQRT1_2 + sin(angle) 1: PI/4 <= angle < 3*PI/4 => ret = 2 * M_SQRT1_2 - cos(angle) 2: 3*PI/4 <= angle < 5*PI/4 => ret = 4 * M_SQRT1_2 - sin(angle) 3: 5*PI/4 <= angle < 7*PI/4 => ret = 6 * M_SQRT1_2 + cos(angle) 4: 7*PI/4 <= angle < 2*PI => ret = 8 * M_SQRT1_2 + sin(angle)

Examples
test_angle.c.

Definition at line 505 of file geometry.h.

◆ sq_len_diff_vec()

static double sq_len_diff_vec ( double const  a[3],
double const  b[3] 
)
inlinestatic

computes square of the lenght of the vector ab

Definition at line 249 of file geometry.h.

Here is the caller graph for this function:

◆ sub_angles()

static int sub_angles ( struct sin_cos_angle  a,
struct sin_cos_angle  b,
struct sin_cos_angle *restrict  sub 
)
inlinestatic

computes (a-b), if (a-b) <= 0, the result is (a-b+2*PI) a and be have to be in the range [0;2*PI[

Returns
1 if (a-b) < 0
Examples
test_angle.c, test_cell_bnd_circle.c, and test_geometry.c.

Definition at line 558 of file geometry.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sub_angles_no_check()

static struct sin_cos_angle sub_angles_no_check ( struct sin_cos_angle  a,
struct sin_cos_angle  b 
)
inlinestatic

computes (a-b), if (a-b) < 0, the result is (a-b+2*PI) a and be have to be in the range [0;2*PI[

Definition at line 548 of file geometry.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sum_angles()

static int sum_angles ( struct sin_cos_angle  a,
struct sin_cos_angle  b,
struct sin_cos_angle *restrict  sum 
)
inlinestatic

computes (a+b), if (a+b) >= 2*PI, the result is (a+b-2*PI) a and be have to be in the range [0;2*PI[

Returns
1 if (a+b) is >= 2*PI
Examples
test_angle.c.

Definition at line 534 of file geometry.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sum_angles_no_check()

static struct sin_cos_angle sum_angles_no_check ( struct sin_cos_angle  a,
struct sin_cos_angle  b 
)
inlinestatic

computes (a+b), if (a+b) >= 2*PI, the result is (a+b-2*PI) a and be have to be in the range [0;2*PI[

Examples
test_cell_bnd_circle.c.

Definition at line 524 of file geometry.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ XYZtoLL()

static void XYZtoLL ( double const  p_in[],
double *  lon,
double *  lat 
)
inlinestatic

converts lon-lat coordinates into xyz ones

Further information: http://en.wikipedia.org/wiki/List_of_common_coordinate_transformations

Parameters
[in]p_inxyz coordinates
[out]lonlongitude coordinate in radian
[out]latlatitude coordinate in radian
Examples
test_area.c, test_clipping.c, test_compute_overlap_area.c, test_lat_clipping.c, test_loncxlatc.c, test_partial_areas.c, and test_vtk_output.c.

Definition at line 318 of file geometry.h.

Here is the caller graph for this function:

◆ yac_circle_intersect()

int yac_circle_intersect ( struct yac_circle  a,
struct yac_circle  b,
double  p[3],
double  q[3] 
)
Examples
test_circle.c.

Definition at line 270 of file intersection.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_compute_bnd_triangle()

void yac_compute_bnd_triangle ( double *  vertices,
size_t  num_vertices,
double  triangle[][3],
size_t  num_tests 
)

computes a spherical triangle that contains all given vertices, the algorithm tries to minimise the size of the triangle

Parameters
[in]verticesvertices that are supposed to be within the triangle
[in]num_verticesnumber of vertices in vertices
[out]trianglebounding triangle
[in]num_testswith increasing number of tests computation time and chance of smaller bounding triangle increases
Remarks
num_tests has to be > 0

Definition at line 99 of file bnd_triangle.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_extents_overlap()

int yac_extents_overlap ( struct bounding_circle extent_a,
struct bounding_circle extent_b 
)

checks whether two extents overlap

Parameters
[in]extent_abounding circle
[in]extent_bbounding circle
Returns
0 if the bounding circles do not overlap

Definition at line 204 of file bnd_circle.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_get_cell_bounding_circle()

void yac_get_cell_bounding_circle ( struct yac_grid_cell  cell,
struct bounding_circle bnd_circle 
)

gets the bounding circle for a grid cell

Parameters
[in]cellgrid cell (coordinates have to be in radian)
[out]bnd_circlebounding circle of the grid cell

Definition at line 160 of file bnd_circle.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_get_cell_bounding_circle_reg_quad()

void yac_get_cell_bounding_circle_reg_quad ( double  a[3],
double  b[3],
double  c[3],
struct bounding_circle bnd_circle 
)

computes the smallest bounding circle for a triangle on the sphere

Parameters
[in]acoordinates of first point (xyz)
[in]bcoordinates of second point (xyz)
[in]ccoordinates of thrid point (xyz)
[out]bnd_circlebounding circle
Remarks
it is assumed that all edges of the quad are either circles of longitude or latitude

Definition at line 36 of file bnd_circle.c.

Here is the call graph for this function:

◆ yac_get_cell_bounding_circle_unstruct_triangle()

void yac_get_cell_bounding_circle_unstruct_triangle ( double  a[3],
double  b[3],
double  c[3],
struct bounding_circle bnd_circle 
)

computes the smallest bounding circle for a triangle on the sphere

Parameters
[in]acoordinates of first point (xyz)
[in]bcoordinates of second point (xyz)
[in]ccoordinates of thrid point (xyz)
[out]bnd_circlebounding circle
Remarks
it is assumed that all three edges of the triangle are great circles

Definition at line 93 of file bnd_circle.c.

Here is the call graph for this function:

◆ yac_get_cell_circumscribe_circle_reg_quad()

void yac_get_cell_circumscribe_circle_reg_quad ( double  a[3],
double  b[3],
double  c[3],
struct bounding_circle bnd_circle 
)

computes the circumscribe circle for a quad on the sphere

Parameters
[in]acoordinates of first point (xyz)
[in]bcoordinates of second point (xyz)
[in]ccoordinates of thrid point (xyz)
[out]bnd_circlecircumscribe circle
Remarks
it is assumed that all edges of the quad are either circles of longitude or latitude

Definition at line 27 of file bnd_circle.c.

Here is the call graph for this function:

◆ yac_get_cell_circumscribe_circle_unstruct_triangle()

void yac_get_cell_circumscribe_circle_unstruct_triangle ( double  a[3],
double  b[3],
double  c[3],
struct bounding_circle bnd_circle 
)

computes the circumscribe circle for a triangle on the sphere

Parameters
[in]acoordinates of first point (xyz)
[in]bcoordinates of second point (xyz)
[in]ccoordinates of thrid point (xyz)
[out]bnd_circlecircumscribe circle
Remarks
it is assumed that all three edges of the triangle are great circles

Definition at line 45 of file bnd_circle.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_intersect_vec()

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] 
)

computes the intersection points of two edges

Parameters
[in]edge_type_atype of edge a
[in]afirst point of edge a
[in]bsecond point of edge a
[in]edge_type_btype of edge b
[in]cfirst point of edge b
[in]dsecond point of edge b
[out]pfirst intersection point
[out]qsecond intersection point
Returns
0 if the intersection points are neither on edge a or b
-1 if the two circles do not intersect
1st bit will be set if p is on edge a
2nd bit will be set if q is on edge a
3rd bit will be set if p is on edge b
4th bit will be set if q is on edge b
5th bit will be set if both circles are identically
Remarks
if -1 is returned neither p or q is set
if the two circles only have one intersection point, p and q will be identically, but only the p bits will be set
Examples
test_gcxlatc.c.

Definition at line 786 of file intersection.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_point_in_bounding_circle_vec()

static int yac_point_in_bounding_circle_vec ( double  point_vector[3],
struct bounding_circle bnd_circle 
)
inlinestatic

checks whether a point is within a bounding circle

Parameters
[in]point_vectorpoint to be checked
[in]bnd_circlebounding circle
Returns
0 if point is not within the bounding circle
Examples
test_bnd_sphere_part.c, and test_point_sphere_part.c.

Definition at line 266 of file geometry.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_point_in_cell()

int yac_point_in_cell ( double  point_coords[3],
struct yac_grid_cell  cell 
)

checks whether a given point is within a given cell

Parameters
[in]point_coords
[in]cell
Returns
0 if the point is not in the cell

Definition at line 465 of file check_overlap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_point_in_cell2()

int yac_point_in_cell2 ( double  point_coords[3],
struct yac_grid_cell  cell,
struct bounding_circle  bnd_circle 
)

checks whether a given point is within a given cell

Parameters
[in]point_coords
[in]cell
[in]bnd_circle
Returns
0 if the point is not in the cell

Definition at line 474 of file check_overlap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_point_on_edge()

int yac_point_on_edge ( double  p[3],
double const  a[3],
double const  b[3],
enum yac_circle_type  circle_type 
)

Definition at line 883 of file intersection.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_triangulate_cell()

void yac_triangulate_cell ( struct yac_grid_cell  cell,
size_t  start_corner,
struct yac_grid_cell triangles 
)

splits given cell into triangles

Parameters
[in]cellcell to be triangulated
[in]start_cornerstart algorithm at corner with this index (0 <= start_corner < n; with n being number of cell corners)
[out]trianglestriangles that are the result of the triangulation
Remarks
the user needs to provide (n-2) initialised grid_cells for the argument triangles (n being the number of cell corners of the cell)
this routine currently only works for convex grid cells
the algorithm ignores that actual edge types for cells with more than 3 corners and assumes them to be great circle edges
Examples
test_basic_grid_data.c.

Definition at line 66 of file grid_cell.c.

Here is the call graph for this function:

◆ yac_triangulate_cell_indices()

void yac_triangulate_cell_indices ( size_t const *  corner_indices,
size_t  num_corners,
size_t  start_corner,
size_t(*)  triangle_indices[3] 
)

splits given indices of a cell into triangles

Parameters
[in]corner_indicescell corner indices to be triangulated
[in]num_cornersnumber of corners of the cell
[in]start_cornerstart algorithm at corner with this index (0 <= start_corner < n; with n being number of cell corners)
[out]triangle_indicestriangle indices that are the result of the triangulation
Remarks
the user needs to provide provide an array of size 3*(num_corners-2) for the argument triangle_indices
Examples
test_basic_grid_data.c.

Definition at line 144 of file grid_cell.c.

Here is the caller graph for this function:

Variable Documentation

◆ SIN_COS_7_M_PI_4

const struct sin_cos_angle SIN_COS_7_M_PI_4 = {-0.707106781186547524401, +0.707106781186547524401}
static

Definition at line 50 of file geometry.h.

◆ SIN_COS_LOW_TOL

const struct sin_cos_angle SIN_COS_LOW_TOL = {yac_angle_low_tol, yac_cos_angle_low_tol}
static
Examples
test_geometry.c.

Definition at line 46 of file geometry.h.

◆ SIN_COS_M_PI

const struct sin_cos_angle SIN_COS_M_PI = {0.0, -1.0}
static
Examples
test_angle.c, test_cell_bnd_circle.c, and test_geometry.c.

Definition at line 49 of file geometry.h.

◆ SIN_COS_M_PI_2

const struct sin_cos_angle SIN_COS_M_PI_2 = {1.0, 0.0}
static
Examples
test_bnd_sphere_part.c.

Definition at line 48 of file geometry.h.

◆ SIN_COS_TOL

const struct sin_cos_angle SIN_COS_TOL = {yac_angle_tol, yac_cos_angle_tol}
static
Examples
test_cell_bnd_circle.c.

Definition at line 45 of file geometry.h.

◆ SIN_COS_ZERO

const struct sin_cos_angle SIN_COS_ZERO = {0.0, 1.0}
static
Examples
test_bnd_sphere_part.c.

Definition at line 44 of file geometry.h.