[GRASS-SVN] r67236 - grass/branches/releasebranch_7_0/raster/r.stream.extract

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Dec 18 13:09:49 PST 2015


Author: mmetz
Date: 2015-12-18 13:09:49 -0800 (Fri, 18 Dec 2015)
New Revision: 67236

Modified:
   grass/branches/releasebranch_7_0/raster/r.stream.extract/do_astar.c
Log:
r.stream.extract: fix correction for diagonal flow direction bias

Modified: grass/branches/releasebranch_7_0/raster/r.stream.extract/do_astar.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.stream.extract/do_astar.c	2015-12-18 21:07:41 UTC (rev 67235)
+++ grass/branches/releasebranch_7_0/raster/r.stream.extract/do_astar.c	2015-12-18 21:09:49 UTC (rev 67236)
@@ -78,7 +78,8 @@
 	    /* get r, c (r_nbr, c_nbr) for neighbours */
 	    r_nbr = r + nextdr[ct_dir];
 	    c_nbr = c + nextdc[ct_dir];
-	    slope[ct_dir] = ele_nbr[ct_dir] = 0;
+	    slope[ct_dir] = -1;
+	    ele_nbr[ct_dir] = 0;
 	    skip_diag = 0;
 
 	    /* check that neighbour is within region */
@@ -95,16 +96,16 @@
 			                  dist_to_nbr[ct_dir]);
 	    }
 	    /* avoid diagonal flow direction bias */
-	    if (!is_in_list) {
-		if (ct_dir > 3 && slope[ct_dir] > 0) {
-		    if (slope[nbr_ew[ct_dir]] > 0) {
+	    if (!is_worked) {
+		if (ct_dir > 3 && slope[ct_dir] >= 0) {
+		    if (slope[nbr_ew[ct_dir]] >= 0) {
 			/* slope to ew nbr > slope to center */
 			if (slope[ct_dir] <
 			    get_slope(ele_nbr[nbr_ew[ct_dir]],
 				       ele_nbr[ct_dir], ew_res))
 			    skip_diag = 1;
 		    }
-		    if (!skip_diag && slope[nbr_ns[ct_dir]] > 0) {
+		    if (!skip_diag && slope[nbr_ns[ct_dir]] >= 0) {
 			/* slope to ns nbr > slope to center */
 			if (slope[ct_dir] <
 			    get_slope(ele_nbr[nbr_ns[ct_dir]],



More information about the grass-commit mailing list