[GRASS-SVN] r48378 - grass/trunk/vector/v.voronoi

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Sep 20 03:06:44 EDT 2011


Author: mmetz
Date: 2011-09-20 00:06:44 -0700 (Tue, 20 Sep 2011)
New Revision: 48378

Modified:
   grass/trunk/vector/v.voronoi/sw_main.c
   grass/trunk/vector/v.voronoi/vo_extend.c
Log:
v.voronoi: fix for #957

Modified: grass/trunk/vector/v.voronoi/sw_main.c
===================================================================
--- grass/trunk/vector/v.voronoi/sw_main.c	2011-09-20 05:26:45 UTC (rev 48377)
+++ grass/trunk/vector/v.voronoi/sw_main.c	2011-09-20 07:06:44 UTC (rev 48378)
@@ -161,6 +161,16 @@
 	    (struct Site *)G_realloc(sites,
 				     (nsites) * sizeof(struct Site));
 
+    if (xmin == Box.W)
+	Box.W -= GRASS_EPSILON;
+    if (xmax == Box.E)
+	Box.E += GRASS_EPSILON;
+    if (ymin == Box.S)
+	Box.S -= GRASS_EPSILON;
+    if (ymax == Box.N)
+	Box.N += GRASS_EPSILON;
+
+
     qsort(sites, nsites, sizeof(struct Site), scomp);
     removeDuplicates();
     return 0;

Modified: grass/trunk/vector/v.voronoi/vo_extend.c
===================================================================
--- grass/trunk/vector/v.voronoi/vo_extend.c	2011-09-20 05:26:45 UTC (rev 48377)
+++ grass/trunk/vector/v.voronoi/vo_extend.c	2011-09-20 07:06:44 UTC (rev 48378)
@@ -31,19 +31,21 @@
 		double a, double b, double c, double x, double y,
 		double *c_x, double *c_y, int knownPointAtLeft)
 {
-    double nx, ny;		/* intesection coordinates */
+    double nx, ny;		/* intersection coordinates */
 
     if (x > w && x < e && y > s && y < n) {
 	/* vertical line? */
 	if (a == 0) {
-	    *c_y = c / b;
-	    *c_x = knownPointAtLeft ? s : n;
+	    *c_x = knownPointAtLeft ? e : w;
+	    *c_y =  y;
+	    return 1;
 	}
 
 	/* horizontal line? */
 	if (b == 0) {
-	    *c_x = c / a;
-	    *c_y = knownPointAtLeft ? e : w;
+	    *c_x = x;
+	    *c_y = knownPointAtLeft ? s : n;
+	    return 1;
 	}
 
 	/* south */



More information about the grass-commit mailing list