PostGIS  3.2.2dev-r@@SVN_REVISION@@

◆ ptarrayarc_contains_point()

int ptarrayarc_contains_point ( const POINTARRAY pa,
const POINT2D pt 
)

For POINTARRAYs representing CIRCULARSTRINGS.

That is, linked triples with each triple being control points of a circular arc. Such POINTARRAYs have an odd number of vertices.

Return 1 if the point is inside the POINTARRAY, -1 if it is outside, and 0 if it is on the boundary.

Definition at line 1110 of file ptarray.c.

1111 {
1112  int on_boundary = LW_FALSE;
1113  int intersections;
1114  if (!ptarray_is_closed_2d(pa))
1115  lwerror("%s called on unclosed ring", __func__);
1116 
1117  intersections = ptarrayarc_raycast_intersections(pa, pt, &on_boundary);
1118  if (on_boundary)
1119  return LW_BOUNDARY;
1120  else
1121  return (intersections % 2) ? LW_INSIDE : LW_OUTSIDE;
1122 }
#define LW_FALSE
Definition: liblwgeom.h:108
#define LW_INSIDE
Constants for point-in-polygon return values.
#define LW_BOUNDARY
#define LW_OUTSIDE
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
int ptarray_is_closed_2d(const POINTARRAY *in)
Definition: ptarray.c:701
int ptarrayarc_raycast_intersections(const POINTARRAY *pa, const POINT2D *p, int *on_boundary)
Definition: ptarray.c:935

References LW_BOUNDARY, LW_FALSE, LW_INSIDE, LW_OUTSIDE, lwerror(), ptarray_is_closed_2d(), and ptarrayarc_raycast_intersections().

Referenced by lwgeom_contains_point(), and test_ptarrayarc_contains_point().

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