TECA
The Toolkit for Extreme Climate Analysis
teca_geometry Namespace Reference

Codes dealing with computational geometry. More...

Classes

struct  polygon
 

Functions

template<typename n_t >
TECA_EXPORT bool left (n_t e0x, n_t e0y, n_t e1x, n_t e1y, n_t px, n_t py)
 tests if a point is Left|On|Right of an infinite line. More...
 
template<typename n_t >
TECA_EXPORT bool point_in_poly (n_t px, n_t py, const n_t *vx, const n_t *vy, unsigned long nppts)
 

Detailed Description

Codes dealing with computational geometry.

Function Documentation

◆ left()

template<typename n_t >
TECA_EXPORT bool teca_geometry::left ( n_t  e0x,
n_t  e0y,
n_t  e1x,
n_t  e1y,
n_t  px,
n_t  py 
)

tests if a point is Left|On|Right of an infinite line.

◆ point_in_poly()

template<typename n_t >
TECA_EXPORT bool teca_geometry::point_in_poly ( n_t  px,
n_t  py,
const n_t *  vx,
const n_t *  vy,
unsigned long  nppts 
)

Winding number test for a point in a polygon. The winding number is 0 when the point is outside. The polygon is defined a series of x, y points in counter clockwise order. Defining in clock wise order changes the sign of the winding number. the first and last point of the polygon are required to be the same.

Parameters
[in]pxthe x coordinate of the point.
[in]pythe y coordinate of the point.
[in]vxthe x coordinates of the polygon.
[in]vythe y coordinates of the polygon.
[in]npptsthe number of points in the polygon.