PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ lwpoly_contains_point()

int lwpoly_contains_point ( const LWPOLY poly,
const POINT2D pt 
)

Definition at line 532 of file lwpoly.c.

533 {
534  uint32_t i;
535  int t;
536 
537  if ( lwpoly_is_empty(poly) )
538  return LW_OUTSIDE;
539 
540  t = ptarray_contains_point(poly->rings[0], pt);
541 
542  if (t == LW_INSIDE)
543  {
544  for (i = 1; i < poly->nrings; i++)
545  {
546  t = ptarray_contains_point(poly->rings[i], pt);
547  if (t == LW_INSIDE)
548  return LW_OUTSIDE;
549  if (t == LW_BOUNDARY)
550  {
551  return LW_BOUNDARY;
552  }
553  }
554  return LW_INSIDE;
555  }
556  else
557  return t;
558 }
#define LW_INSIDE
Constants for point-in-polygon return values.
#define LW_BOUNDARY
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:732
int lwpoly_is_empty(const LWPOLY *poly)
#define LW_OUTSIDE
POINTARRAY ** rings
Definition: liblwgeom.h:505
uint32_t nrings
Definition: liblwgeom.h:510

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

Referenced by lwgeom_solid_contains_lwgeom().

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