PostGIS  2.3.7dev-r@@SVN_REVISION@@
int lwpoly_contains_point ( const LWPOLY poly,
const POINT2D pt 
)

Definition at line 580 of file lwpoly.c.

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

581 {
582  int i;
583 
584  if ( lwpoly_is_empty(poly) )
585  return LW_FALSE;
586 
587  if ( ptarray_contains_point(poly->rings[0], pt) == LW_OUTSIDE )
588  return LW_FALSE;
589 
590  for ( i = 1; i < poly->nrings; i++ )
591  {
592  if ( ptarray_contains_point(poly->rings[i], pt) == LW_INSIDE )
593  return LW_FALSE;
594  }
595  return LW_TRUE;
596 }
#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:456
#define LW_INSIDE
Constants for point-in-polygon return values.
int nrings
Definition: liblwgeom.h:454
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:403

Here is the call graph for this function: