MCPcopy Index your code
hub / github.com/MapServer/MapServer / msPointInPolygon

Function msPointInPolygon

mapsearch.c:160–169  ·  view source on GitHub ↗

** Copyright (c) 1970-2003, Wm. Randolph Franklin ** ** Permission is hereby granted, free of charge, to any person obtaining a copy of this software and ** associated documentation

Source from the content-addressed store, hash-verified

158** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
159*/
160int msPointInPolygon(pointObj *p, lineObj *c)
161{
162 int i, j, status = MS_FALSE;
163
164 for (i = 0, j = c->numpoints-1; i < c->numpoints; j = i++) {
165 if ((((c->point[i].y<=p->y) && (p->y<c->point[j].y)) || ((c->point[j].y<=p->y) && (p->y<c->point[i].y))) && (p->x < (c->point[j].x - c->point[i].x) * (p->y - c->point[i].y) / (c->point[j].y - c->point[i].y) + c->point[i].x))
166 status = !status;
167 }
168 return status;
169}
170
171/*
172** Note: the following functions are brute force implementations. Some fancy

Callers 4

intersectLabelPolygonsFunction · 0.85
msIntersectPointPolygonFunction · 0.85
msIsOuterRingFunction · 0.85
msGetInnerListFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected