[GRASS-SVN] r57656 - grass/trunk/vector/v.distance

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Sep 13 15:01:47 PDT 2013


Author: mmetz
Date: 2013-09-13 15:01:47 -0700 (Fri, 13 Sep 2013)
New Revision: 57656

Modified:
   grass/trunk/vector/v.distance/main.c
Log:
v.distance bugfix for min > 0

Modified: grass/trunk/vector/v.distance/main.c
===================================================================
--- grass/trunk/vector/v.distance/main.c	2013-09-13 21:52:37 UTC (rev 57655)
+++ grass/trunk/vector/v.distance/main.c	2013-09-13 22:01:47 UTC (rev 57656)
@@ -384,7 +384,7 @@
 	/* set up steps to increase search box */
 	max_step = G_malloc(n_max_steps * sizeof(double));
 	/* first step always 0 */
-	max_step[0] = 0;
+	max_step[0] = (min < 0 ? 0 : min);
 
 	for (curr_step = 1; curr_step < n_max_steps - 1; curr_step++) {
 	    /* for 9 steps, this would be max / [128, 64, 32, 16, 8, 4, 2] */
@@ -627,6 +627,7 @@
 		     * to keep the number of hits low */
 		    while (curr_step < n_max_steps) {
 			box_edge = max_step[curr_step];
+			curr_step++;
 
 			if (box_edge < tmp_min)
 			    continue;
@@ -643,7 +644,6 @@
 			if (ntoareas)
 			    Vect_select_areas_by_box(&To, &box, aList);
 
-			curr_step++;
 			if (lList->n_values > 0 || aList->n_values > 0)
 			    break;
 		    }
@@ -662,8 +662,6 @@
 			Vect_select_areas_by_box(&To, &box, aList);
 		}
 
-		G_debug(3, "  %d lines in box", lList->n_values);
-
 		for (i = 0; i < lList->n_values; i++) {
 		    ttype = Vect_read_line(&To, TPoints, TCats, lList->id[i]);
 
@@ -899,6 +897,7 @@
 		     * to keep the number of hits low */
 		    while (curr_step < n_max_steps) {
 			box_edge = max_step[curr_step];
+			curr_step++;
 
 			if (box_edge < tmp_min)
 			    continue;
@@ -915,7 +914,6 @@
 			if (ntoareas)
 			    Vect_select_areas_by_box(&To, &box, aList);
 
-			curr_step++;
 			if (lList->n_values > 0 || aList->n_values > 0)
 			    break;
 		    }



More information about the grass-commit mailing list