PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ 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 1123 of file ptarray.c.

1124{
1125 int on_boundary = LW_FALSE;
1126 int intersections;
1127 if (!ptarray_is_closed_2d(pa))
1128 lwerror("%s called on unclosed ring", __func__);
1129
1130 intersections = ptarrayarc_raycast_intersections(pa, pt, &on_boundary);
1131 if (on_boundary)
1132 return LW_BOUNDARY;
1133 else
1134 return (intersections % 2) ? LW_INSIDE : LW_OUTSIDE;
1135}
#define LW_FALSE
Definition liblwgeom.h:94
#define LW_INSIDE
Constants for point-in-polygon return values.
#define LW_BOUNDARY
#define LW_OUTSIDE
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
int ptarray_is_closed_2d(const POINTARRAY *in)
Definition ptarray.c:710
int ptarrayarc_raycast_intersections(const POINTARRAY *pa, const POINT2D *p, int *on_boundary)
Definition ptarray.c:944

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: