YAC 3.14.0
Yet Another Coupler
Loading...
Searching...
No Matches
area.h File Reference

Structs and interfaces for area calculations. More...

#include "yac_types.h"
#include "clipping.h"
Include dependency graph for area.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define YAC_AREA_TOL   ((0.02 * 0.02) / (6371.2290 * 6371.2290))
 

Functions

double yac_grid_cell_area (struct yac_grid_cell cell)
 Area calculation of a spherical cell.
 
double yac_grid_cell_area_info (struct yac_grid_cell cell, double *barycenter, double sign)
 

Detailed Description

Structs and interfaces for area calculations.

Definition in file area.h.

Macro Definition Documentation

◆ YAC_AREA_TOL

#define YAC_AREA_TOL   ((0.02 * 0.02) / (6371.2290 * 6371.2290))

an area of 20m x 20m on the Earth Surface is equivalent to an area on the unit sphere:

Definition at line 18 of file area.h.

Function Documentation

◆ yac_grid_cell_area()

double yac_grid_cell_area ( struct yac_grid_cell cell)

Area calculation of a spherical cell.

The cell in split up into triangles that all have one corner in common, then the area for each of the triangles is computed and summed up to build the area of the cell.

Compute the area of a grid cell on the unit sphere

This function computes the area of a spherical polygon that may contain both great circle edges and latitude circle edges. The polygon is triangulated using a fan triangulation from the first vertex. By summation of the signed areas of the triangles this routine is able to handle convex and concave cells. For latitude circle edges, a signed correction term is added to account for the difference between the great circle path and the latitude circle path.

Parameters
[in]cellGrid cell structure
Returns
The unsigned area of the grid cell on the unit sphere
Remarks
For triangles with only great circle edges, uses tri_area directly
For polygons or cells with latitude edges, uses triangulation with corrections
Returns 0.0 for degenerate cells with fewer than 2 corners
The result is always non-negative (absolute value of signed area)

Definition at line 271 of file area.c.

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

◆ yac_grid_cell_area_info()

double yac_grid_cell_area_info ( struct yac_grid_cell cell,
double * barycenter,
double sign )

Compute the signed area of a grid cell and update barycenter

This function computes the signed area of a spherical polygon that may contain both great circle edges and latitude circle edges. It simultaneously updates a barycenter accumulator that can be used to compute the cell's center of mass. The polygon is triangulated using a fan triangulation from the first vertex, and the signed areas of the triangles are summed to correctly handle concave cells. For latitude circle edges, correction terms are added to account for the difference between the great circle path and the latitude circle path.

Parameters
[in]cellGrid cell structure
[in,out]barycenterBarycenter accumulator to be updated (3D vector)
[in]signSign multiplier for both area and barycenter contributions
Returns
The signed area of the grid cell on the unit sphere multiplied by sign parameter
Remarks
For triangles with only great circle edges, uses tri_area_info directly
For polygons or cells with latitude edges, uses triangulation with corrections
Returns 0.0 for degenerate cells with fewer than 2 corners
The barycenter is accumulated but not normalized by this function
The sign parameter allows for proper handling of overlapping regions in conservative remapping algorithms

Definition at line 403 of file area.c.

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