PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwpoly_contains_point()

int lwpoly_contains_point ( const LWPOLY poly,
const POINT2D pt 
)

Definition at line 509 of file lwpoly.c.

References LW_FALSE, LW_INSIDE, LW_OUTSIDE, LW_TRUE, lwpoly_is_empty(), LWPOLY::nrings, ptarray_contains_point(), and LWPOLY::rings.

510 {
511  int i;
512 
513  if ( lwpoly_is_empty(poly) )
514  return LW_FALSE;
515 
516  if ( ptarray_contains_point(poly->rings[0], pt) == LW_OUTSIDE )
517  return LW_FALSE;
518 
519  for ( i = 1; i < poly->nrings; i++ )
520  {
521  if ( ptarray_contains_point(poly->rings[i], pt) == LW_INSIDE )
522  return LW_FALSE;
523  }
524  return LW_TRUE;
525 }
#define LW_FALSE
Definition: liblwgeom.h:62
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:61
POINTARRAY ** rings
Definition: liblwgeom.h:441
#define LW_INSIDE
Constants for point-in-polygon return values.
int nrings
Definition: liblwgeom.h:439
int ptarray_contains_point(const POINTARRAY *pa, const POINT2D *pt)
Return 1 if the point is inside the POINTARRAY, -1 if it is outside, and 0 if it is on the boundary...
Definition: ptarray.c:733
#define LW_OUTSIDE
int lwpoly_is_empty(const LWPOLY *poly)
Definition: lwpoly.c:332
Here is the call graph for this function: