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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon May 28 04:49:14 PDT 2012


Author: mmetz
Date: 2012-05-28 04:49:14 -0700 (Mon, 28 May 2012)
New Revision: 51850

Modified:
   grass/trunk/lib/vector/Vlib/intersect.c
Log:
Vlib: alloc rect boundaries

Modified: grass/trunk/lib/vector/Vlib/intersect.c
===================================================================
--- grass/trunk/lib/vector/Vlib/intersect.c	2012-05-28 10:51:34 UTC (rev 51849)
+++ grass/trunk/lib/vector/Vlib/intersect.c	2012-05-28 11:49:14 UTC (rev 51850)
@@ -244,7 +244,7 @@
 	    return 1;		/* endpoints only */
 	}
 
-	/* heneral overlap */
+	/* general overlap */
 	G_debug(3, "   -> vertical overlap");
 	/* a contains b */
 	if (ay1 <= by1 && ay2 >= by2) {
@@ -608,10 +608,16 @@
     double x, y, rethresh;
     struct line_pnts **XLines, *Points;
     struct RTree *MyRTree;
-    struct RTree_Rect rect;
     struct line_pnts *Points1, *Points2;	/* first, second points */
     int seg1, seg2, vert1, vert2;
+    static struct RTree_Rect rect;
+    static int rect_init = 0;
 
+    if (!rect_init) {
+	rect.boundary = G_malloc(6 * sizeof(RectReal));
+	rect_init = 6;
+    }
+
     n_cross = 0;
     rethresh = 0.000001;	/* TODO */
     APnts = APoints;
@@ -1132,9 +1138,15 @@
 {
     int i;
     double dist, rethresh;
-    struct RTree_Rect rect;
     struct RTree *MyRTree;
+    static struct RTree_Rect rect;
+    static int rect_init = 0;
 
+    if (!rect_init) {
+	rect.boundary = G_malloc(6 * sizeof(RectReal));
+	rect_init = 6;
+    }
+
     rethresh = 0.000001;	/* TODO */
     APnts = APoints;
     BPnts = BPoints;



More information about the grass-commit mailing list