[GRASS-SVN] r36406 - in grass/trunk/lib/vector: Vlib diglib

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Mar 18 15:16:21 EDT 2009


Author: mmetz
Date: 2009-03-18 15:16:20 -0400 (Wed, 18 Mar 2009)
New Revision: 36406

Modified:
   grass/trunk/lib/vector/Vlib/build_nat.c
   grass/trunk/lib/vector/diglib/poly.c
Log:
potential bug avoided, cosmetics

Modified: grass/trunk/lib/vector/Vlib/build_nat.c
===================================================================
--- grass/trunk/lib/vector/Vlib/build_nat.c	2009-03-18 13:06:31 UTC (rev 36405)
+++ grass/trunk/lib/vector/Vlib/build_nat.c	2009-03-18 19:16:20 UTC (rev 36406)
@@ -82,7 +82,9 @@
 	else
 	    direction = GV_BACKWARD;
 	Vect_append_points(APoints, Points, direction);
+	APoints->n_points--; /* skip last point, avoids duplicates */
     }
+    APoints->n_points++; /* close polygon */
 
     /* dig_find_area_poly(APoints, &area_size); */
 

Modified: grass/trunk/lib/vector/diglib/poly.c
===================================================================
--- grass/trunk/lib/vector/diglib/poly.c	2009-03-18 13:06:31 UTC (rev 36405)
+++ grass/trunk/lib/vector/diglib/poly.c	2009-03-18 19:16:20 UTC (rev 36406)
@@ -154,11 +154,11 @@
     /* find next distinct point */
     pnext = pcur + 1;
     while (pnext != pcur) {
-	if (pnext == npoints)
-	    pnext = 0;
 	if (x[pcur] != x[pnext] || y[pcur] != y[pnext])
 	    break;
 	pnext++;
+	if (pnext == npoints)
+	    pnext = 0;
     }
 
     /* find previous distinct point */



More information about the grass-commit mailing list