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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Dec 21 05:55:36 PST 2015


Author: mmetz
Date: 2015-12-21 05:55:36 -0800 (Mon, 21 Dec 2015)
New Revision: 67302

Modified:
   grass/branches/releasebranch_7_0/raster/r.stream.extract/do_astar.c
Log:
r.stream.extract: fix correction for diagonal flow 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-21 13:55:00 UTC (rev 67301)
+++ grass/branches/releasebranch_7_0/raster/r.stream.extract/do_astar.c	2015-12-21 13:55:36 UTC (rev 67302)
@@ -96,8 +96,8 @@
 			                  dist_to_nbr[ct_dir]);
 	    }
 	    /* avoid diagonal flow direction bias */
-	    if (!is_worked) {
-		if (ct_dir > 3 && slope[ct_dir] >= 0) {
+	    if (!is_in_list || (!is_worked && af.asp < 0)) {
+		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] <
@@ -116,17 +116,17 @@
 	    }
 
 	    if (!skip_diag) {
-		if (is_in_list == 0) {
+		if (!is_in_list) {
 		    ele_up = ele_nbr[ct_dir];
 		    af.asp = drain[r_nbr - r + 1][c_nbr - c + 1];
 		    heap_add(r_nbr, c_nbr, ele_up);
 		    FLAG_SET(af.flag, INLISTFLAG);
 		    seg_put(&aspflag, (char *)&af, r_nbr, c_nbr);
 		}
-		else if (is_in_list && is_worked == 0) {
+		else if (!is_worked) {
 		    if (FLAG_GET(af.flag, EDGEFLAG)) {
 			/* neighbour is edge in list, not yet worked */
-			if (af.asp < 0) {
+			if (af.asp < 0  && slope[ct_dir] > 0) {
 			    /* adjust flow direction for edge cell */
 			    af.asp = drain[r_nbr - r + 1][c_nbr - c + 1];
 			    seg_put(&aspflag, (char *)&af, r_nbr, c_nbr);



More information about the grass-commit mailing list