]> granicus.if.org Git - postgis/commitdiff
changed the PIP function to loop from i=0 to 1<n-1
authorJeff Lounsbury <jeffloun@refractions.net>
Fri, 14 Feb 2003 20:07:26 +0000 (20:07 +0000)
committerJeff Lounsbury <jeffloun@refractions.net>
Fri, 14 Feb 2003 20:07:26 +0000 (20:07 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@242 b70326c6-7e19-0410-871a-916f4a2858ee

loader/shp2pgsql.c

index de2d3db4021c84ce758258068bf3f857556cffb6..f44399fa9bd4a66fff4fa3b249242f5f8d8cbc76 100644 (file)
@@ -4,6 +4,9 @@
  * Author: Jeff Lounsbury, jeffloun@refractions.net
  *
  * $Log$
+ * Revision 1.30  2003/02/14 20:07:26  jeffloun
+ * changed the PIP function to loop from i=0 to  1<n-1
+ *
  * Revision 1.29  2003/02/04 22:57:44  pramsey
  * Fix memory management error, array of pointers allocated insufficient space.
  *
@@ -157,7 +160,7 @@ int PIP( Point P, Point* V, int n ){
     int cn = 0;    // the crossing number counter
        int i;
     // loop through all edges of the polygon
-    for (i=0; i<n; i++) {    // edge from V[i] to V[i+1]
+    for (i=0; i<n-1; i++) {    // edge from V[i] to V[i+1]
        if (((V[i].y <= P.y) && (V[i+1].y > P.y))    // an upward crossing
         || ((V[i].y > P.y) && (V[i+1].y <= P.y))) { // a downward crossing
             double vt = (float)(P.y - V[i].y) / (V[i+1].y - V[i].y);