Definition at line 1031 of file ptarray.c.
1032{
1033 int wn = 0;
1034 uint32_t i;
1035 double side;
1037 double ymin, ymax;
1038
1041 if ( check_closed && !
p2d_same(seg1, seg2) )
1042 lwerror(
"ptarray_contains_point called on unclosed ring");
1043
1044 for ( i=1; i < pa->
npoints; i++ )
1045 {
1047
1048
1049 if ( seg1->
x == seg2->
x && seg1->
y == seg2->
y )
1050 {
1051 seg1 = seg2;
1052 continue;
1053 }
1054
1057
1058
1059 if ( pt->
y > ymax || pt->
y < ymin )
1060 {
1061 seg1 = seg2;
1062 continue;
1063 }
1064
1066
1067
1068
1069
1070
1072 {
1074 }
1075
1076
1077
1078
1079
1080
1081 if ( (side < 0) && (seg1->
y <= pt->
y) && (pt->
y < seg2->
y) )
1082 {
1083 wn++;
1084 }
1085
1086
1087
1088
1089
1090
1091 else if ( (side > 0) && (seg2->
y <= pt->
y) && (pt->
y < seg1->
y) )
1092 {
1093 wn--;
1094 }
1095
1096 seg1 = seg2;
1097 }
1098
1099
1100 if ( winding_number )
1101 *winding_number = wn;
1102
1103
1104 if (wn == 0)
1105 {
1107 }
1108
1109
1111}
#define LW_INSIDE
Constants for point-in-polygon return values.
int lw_pt_in_seg(const POINT2D *P, const POINT2D *A1, const POINT2D *A2)
Returns true if P is between A1/A2.
int lw_segment_side(const POINT2D *p1, const POINT2D *p2, const POINT2D *q)
lw_segment_side()
int p2d_same(const POINT2D *p1, const POINT2D *p2)
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
References FP_MAX, FP_MIN, getPoint2d_cp(), LW_BOUNDARY, LW_INSIDE, LW_OUTSIDE, lw_pt_in_seg(), lw_segment_side(), lwerror(), POINTARRAY::npoints, p2d_same(), POINT2D::x, and POINT2D::y.
Referenced by _lwt_CheckEdgeCrossing(), _lwt_SplitAllEdgesToNewNode(), and lwt_ChangeEdgeGeom().