[GRASS-SVN] r69752 - grass-addons/grass7/vector/v.surf.tps

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Oct 28 14:25:12 PDT 2016


Author: mmetz
Date: 2016-10-28 14:25:12 -0700 (Fri, 28 Oct 2016)
New Revision: 69752

Modified:
   grass-addons/grass7/vector/v.surf.tps/main.c
   grass-addons/grass7/vector/v.surf.tps/tps.c
   grass-addons/grass7/vector/v.surf.tps/v.surf.tps.html
Log:
v.surf.tps: reduce tiling artefacts

Modified: grass-addons/grass7/vector/v.surf.tps/main.c
===================================================================
--- grass-addons/grass7/vector/v.surf.tps/main.c	2016-10-28 20:55:24 UTC (rev 69751)
+++ grass-addons/grass7/vector/v.surf.tps/main.c	2016-10-28 21:25:12 UTC (rev 69752)
@@ -113,7 +113,7 @@
     ov_opt->key = "overlap";
     ov_opt->type = TYPE_DOUBLE;
     ov_opt->required = NO;
-    ov_opt->answer = "0.8";
+    ov_opt->answer = "0.1";
     ov_opt->label =
 	_("Overlap factor <= 1");
     ov_opt->description =

Modified: grass-addons/grass7/vector/v.surf.tps/tps.c
===================================================================
--- grass-addons/grass7/vector/v.surf.tps/tps.c	2016-10-28 20:55:24 UTC (rev 69751)
+++ grass-addons/grass7/vector/v.surf.tps/tps.c	2016-10-28 21:25:12 UTC (rev 69752)
@@ -214,8 +214,10 @@
 			break;
 		    }
 		}
-		if (isnull)
+		if (isnull) {
+		    Rast_set_d_null_value(&outbuf[col], 1);
 		    continue;
+		}
 	    }
 
 	    result = B[0];
@@ -544,6 +546,13 @@
     wmin = 10;
     wmax = 0;
 
+    if (overlap > 1.0)
+	overlap = 1.0;
+    if (overlap < 0.0)
+	overlap = 0.0;
+    /* keep in sync with weight calculation below */
+    overlap = exp((overlap - 1.0) * 8.0);
+
     for (ridx = 0; ridx < nrows; ridx++) {
 
 	G_percent(ridx, nrows, 1);
@@ -851,15 +860,12 @@
 			}
 		    }
 
-		    dx = abs(icol - col) / dxi;
-		    dy = abs(irow - row) / dyi;
+		    dx = fabs(2.0 * icol - (icol2 + icol1)) / dxi;
+		    dy = fabs(2.0 * irow - (irow2 + irow1)) / dyi;
 
-		    dx = fabs(icol - (icol2 + icol1) / 2.0) / dxi;
-		    dy = fabs(irow - (irow2 + irow1) / 2.0) / dyi;
-
 		    dist2 = (dx * dx + dy * dy);
 
-		    weight = exp(-dist2 * 2);
+		    weight = exp(-dist2 * 4.0);
 
 		    if (wmin > weight)
 			wmin = weight;

Modified: grass-addons/grass7/vector/v.surf.tps/v.surf.tps.html
===================================================================
--- grass-addons/grass7/vector/v.surf.tps/v.surf.tps.html	2016-10-28 20:55:24 UTC (rev 69751)
+++ grass-addons/grass7/vector/v.surf.tps/v.surf.tps.html	2016-10-28 21:25:12 UTC (rev 69752)
@@ -30,7 +30,8 @@
 the <b>min</b> option is smaller than the numer of input points. 
 Tiling artefacts occur with low values for the <b>min</b> option and the 
 <b>overlap</b> option. Increasing both options will reduce tiling 
-artefacts but processing will take more time.
+artefacts but processing will take more time. Values for the 
+<b>overlap</b> option must be between 0 and 1.
 
 <p>
 The module works best with evenly spaced sparse points. In case of 



More information about the grass-commit mailing list