PostGIS  2.5.0beta1dev-r@@SVN_REVISION@@

◆ lwpoly_contains_point()

int lwpoly_contains_point ( const LWPOLY poly,
const POINT2D pt 
)

Definition at line 539 of file lwpoly.c.

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

540 {
541  uint32_t i;
542 
543  if ( lwpoly_is_empty(poly) )
544  return LW_FALSE;
545 
546  if ( ptarray_contains_point(poly->rings[0], pt) == LW_OUTSIDE )
547  return LW_FALSE;
548 
549  for ( i = 1; i < poly->nrings; i++ )
550  {
551  if ( ptarray_contains_point(poly->rings[i], pt) == LW_INSIDE )
552  return LW_FALSE;
553  }
554  return LW_TRUE;
555 }
uint32_t nrings
Definition: liblwgeom.h:457
unsigned int uint32_t
Definition: uthash.h:78
#define LW_FALSE
Definition: liblwgeom.h:76
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
POINTARRAY ** rings
Definition: liblwgeom.h:459
#define LW_INSIDE
Constants for point-in-polygon return values.
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:727
#define LW_OUTSIDE
int lwpoly_is_empty(const LWPOLY *poly)
Definition: lwpoly.c:418
Here is the call graph for this function: