PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ lwpoly_contains_point()

int lwpoly_contains_point ( const LWPOLY poly,
const POINT2D pt 
)

Definition at line 531 of file lwpoly.c.

532 {
533  uint32_t i;
534  int t;
535 
536  if ( lwpoly_is_empty(poly) )
537  return LW_OUTSIDE;
538 
539  t = ptarray_contains_point(poly->rings[0], pt);
540 
541  if (t == LW_INSIDE)
542  {
543  for (i = 1; i < poly->nrings; i++)
544  {
545  t = ptarray_contains_point(poly->rings[i], pt);
546  if (t == LW_INSIDE)
547  return LW_OUTSIDE;
548  if (t == LW_BOUNDARY)
549  {
550  return LW_BOUNDARY;
551  }
552  }
553  return LW_INSIDE;
554  }
555  else
556  return t;
557 }
#define LW_INSIDE
Constants for point-in-polygon return values.
#define LW_BOUNDARY
int ptarray_contains_point(const POINTARRAY *pa, const POINT2D *pt)
The following is based on the "Fast Winding Number Inclusion of a Point in a Polygon" algorithm by Da...
Definition: ptarray.c:755
int lwpoly_is_empty(const LWPOLY *poly)
#define LW_OUTSIDE
POINTARRAY ** rings
Definition: liblwgeom.h:519
uint32_t nrings
Definition: liblwgeom.h:524

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: