[GRASS-SVN] r67242 - grass/branches/releasebranch_7_0/vector/v.surf.idw

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Dec 18 21:12:44 PST 2015


Author: mlennert
Date: 2015-12-18 21:12:44 -0800 (Fri, 18 Dec 2015)
New Revision: 67242

Modified:
   grass/branches/releasebranch_7_0/vector/v.surf.idw/main.c
Log:
backporting fix for severe bug in distance calculations (#2820)


Modified: grass/branches/releasebranch_7_0/vector/v.surf.idw/main.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.surf.idw/main.c	2015-12-19 05:06:08 UTC (rev 67241)
+++ grass/branches/releasebranch_7_0/vector/v.surf.idw/main.c	2015-12-19 05:12:44 UTC (rev 67242)
@@ -386,7 +386,7 @@
 		sum1 = 0.0;
 		sum2 = 0.0;
 		for (n = 0; n < nsearch; n++) {
-		    if ((dist = list[n].dist)) {
+		    if ((dist = sqrt(list[n].dist))) {
 			sum1 += list[n].z / pow(dist, p);
 			sum2 += 1.0 / pow(dist, p);
 		    }
@@ -458,7 +458,8 @@
 void calculate_distances(int row, int column, double north,
 			 double east, int *pointsfound)
 {
-    int j, n, max = 0;
+    int j, n;
+    static int max;
     double dx, dy, dist;
     static double maxdist;
 



More information about the grass-commit mailing list