Browse Source

v.voronoi: fix for https://trac.osgeo.org/grass/ticket/957

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48378 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 13 years ago
parent
commit
0de1156403
2 changed files with 17 additions and 5 deletions
  1. 10 0
      vector/v.voronoi/sw_main.c
  2. 7 5
      vector/v.voronoi/vo_extend.c

+ 10 - 0
vector/v.voronoi/sw_main.c

@@ -161,6 +161,16 @@ int readsites(void)
 	    (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;

+ 7 - 5
vector/v.voronoi/vo_extend.c

@@ -31,19 +31,21 @@ int extend_line(double s, double n, double w, double e,
 		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 */