[GRASS-SVN] r38419 - grass-addons/raster/r.terracost

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jul 14 17:50:49 EDT 2009


Author: ltoma
Date: 2009-07-14 17:50:48 -0400 (Tue, 14 Jul 2009)
New Revision: 38419

Modified:
   grass-addons/raster/r.terracost/initialize.cc
Log:
Fixed a bug pointed by Markus Neteler. When numtiles=1, the cost of the source points were initialized with cost=0, which led to incorrect half weights for the immediate neighbors if the source points. 

Modified: grass-addons/raster/r.terracost/initialize.cc
===================================================================
--- grass-addons/raster/r.terracost/initialize.cc	2009-07-14 15:51:29 UTC (rev 38418)
+++ grass-addons/raster/r.terracost/initialize.cc	2009-07-14 21:50:48 UTC (rev 38419)
@@ -334,7 +334,12 @@
       if (s) {
 	costStruct = costStructure(0,i,j);
 	pq->insert(costStruct);
-	costGrid[i][j] = 0;
+
+	/* costGrid[i][j] = 0; setting the cost of the sources to be
+	   zero is causing the neighbors of the sources to get "half"
+	   weights.
+	*/
+	costGrid[i][j] = cost; 
 	distGrid[i][j] = 0;
       }
 



More information about the grass-commit mailing list