[GRASS-SVN] r55666 - in grass/trunk/raster/r.watershed: ram seg

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Apr 8 08:02:33 PDT 2013


Author: mmetz
Date: 2013-04-08 08:02:32 -0700 (Mon, 08 Apr 2013)
New Revision: 55666

Modified:
   grass/trunk/raster/r.watershed/ram/slope_len.c
   grass/trunk/raster/r.watershed/seg/slope_len.c
Log:
r.watershed: fix resolution for slope length

Modified: grass/trunk/raster/r.watershed/ram/slope_len.c
===================================================================
--- grass/trunk/raster/r.watershed/ram/slope_len.c	2013-04-08 14:45:12 UTC (rev 55665)
+++ grass/trunk/raster/r.watershed/ram/slope_len.c	2013-04-08 15:02:32 UTC (rev 55666)
@@ -2,34 +2,16 @@
 
 int slope_length(int r, int c, int dr, int dc)
 {
-    CELL top_alt, bot_alt, asp_value;
+    CELL top_alt, bot_alt;
     double res, top_ls, bot_ls;
 
-    if (sides == 8) {
-	if (r == dr)
-	    res = window.ns_res;
-	else if (c == dc)
-	    res = window.ew_res;
-	else
-	    res = diag;
-    }
-    else {			/* sides == 4 */
+    if (r == dr)
+	res = window.ew_res;
+    else if (c == dc)
+	res = window.ns_res;
+    else
+	res = diag;
 
-	asp_value = asp[SEG_INDEX(asp_seg, dr, dc)];
-	if (r == dr) {
-	    if (asp_value == 2 || asp_value == 6)
-		res = window.ns_res;
-	    else		/* asp_value == 4, 8, -2, -4, -6, or -8 */
-		res = diag;     /* how can res be diag with sides == 4??? */
-	}
-	else {			/* c == dc */
-
-	    if (asp_value == 4 || asp_value == 8)
-		res = window.ew_res;
-	    else		/* asp_value == 2, 6, -2, -4, -6, or -8 */
-		res = diag;
-	}
-    }
     top_ls = s_l[SEG_INDEX(s_l_seg, r, c)];
     if (top_ls == half_res)
 	top_ls = res;

Modified: grass/trunk/raster/r.watershed/seg/slope_len.c
===================================================================
--- grass/trunk/raster/r.watershed/seg/slope_len.c	2013-04-08 14:45:12 UTC (rev 55665)
+++ grass/trunk/raster/r.watershed/seg/slope_len.c	2013-04-08 15:02:32 UTC (rev 55666)
@@ -6,34 +6,14 @@
     char asp_value;
     double res, top_ls, bot_ls;
     WAT_ALT wa;
-    ASP_FLAG af;
 
-    if (sides == 8) {
-	if (r == dr)
-	    res = window.ns_res;
-	else if (c == dc)
-	    res = window.ew_res;
-	else
-	    res = diag;
-    }
-    else {			/* sides == 4 */
+    if (r == dr)
+	res = window.ns_res;
+    else if (c == dc)
+	res = window.ew_res;
+    else
+	res = diag;
 
-	seg_get(&aspflag, (char *)&af, dr, dc);
-	asp_value = af.asp;
-	if (r == dr) {
-	    if (asp_value == 2 || asp_value == 6)
-		res = window.ns_res;
-	    else		/* asp_value == 4, 8, -2, -4, -6, or -8 */
-		res = diag;     /* how can res be diag with sides == 4??? */
-	}
-	else {			/* c == dc */
-
-	    if (asp_value == 4 || asp_value == 8)
-		res = window.ew_res;
-	    else		/* asp_value == 2, 6, -2, -4, -6, or -8 */
-		res = diag;
-	}
-    }
     dseg_get(&s_l, &top_ls, r, c);
     if (top_ls == half_res)
 	top_ls = res;



More information about the grass-commit mailing list