[GRASS-SVN] r36517 - grass/trunk/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Mar 29 15:47:29 EDT 2009


Author: mmetz
Date: 2009-03-29 15:47:29 -0400 (Sun, 29 Mar 2009)
New Revision: 36517

Modified:
   grass/trunk/lib/vector/Vlib/break_polygons.c
Log:
polished Red Black Tree used

Modified: grass/trunk/lib/vector/Vlib/break_polygons.c
===================================================================
--- grass/trunk/lib/vector/Vlib/break_polygons.c	2009-03-29 19:46:31 UTC (rev 36516)
+++ grass/trunk/lib/vector/Vlib/break_polygons.c	2009-03-29 19:47:29 UTC (rev 36517)
@@ -68,16 +68,16 @@
     b = (XPNT *)Xpntb;
 
     if (a->x > b->x)
-	return 0;
+	return 1;
     else if (a->x < b->x)
-	return 1;
+	return -1;
     else {
 	if (a->y > b->y)
-	    return 0;
+	    return 1;
 	else if (a->y < b->y)
-	    return 1;
+	    return -1;
 	else
-	    return 2;
+	    return 0;
     }
 
     G_warning("Break polygons: Bug in binary tree!");
@@ -130,7 +130,7 @@
 
     apoints = 0;
     nmarks = 0;
-    npoints = 1;		/* index starts from 1 ! */
+    npoints = 0;
     nallpoints = 0;
 
     G_verbose_message(_("Break polygons Pass 1: select break points"));
@@ -231,9 +231,9 @@
 		    XPnt_search.a2 = a2;
 		    XPnt_search.cross = 0;
 		}
+
 		/* Add to tree */
 		rbtree_insert(RBTree, &XPnt_search);
-
 		npoints++;
 	    }
 	}



More information about the grass-commit mailing list