[GRASS-SVN] r72879 - grass-addons/grass7/raster/r.accumulate
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jun 22 12:01:20 PDT 2018
Author: hcho
Date: 2018-06-22 12:01:19 -0700 (Fri, 22 Jun 2018)
New Revision: 72879
Modified:
grass-addons/grass7/raster/r.accumulate/accumulate.c
grass-addons/grass7/raster/r.accumulate/global.h
Log:
r.accumulate: Use defines for directions
Modified: grass-addons/grass7/raster/r.accumulate/accumulate.c
===================================================================
--- grass-addons/grass7/raster/r.accumulate/accumulate.c 2018-06-22 05:59:14 UTC (rev 72878)
+++ grass-addons/grass7/raster/r.accumulate/accumulate.c 2018-06-22 19:01:19 UTC (rev 72879)
@@ -29,16 +29,16 @@
case -1:
switch (j) {
case -1:
- if (neighbor_dir == 315)
- loop_dir = 135;
+ if (neighbor_dir == SE)
+ loop_dir = NW;
break;
case 0:
- if (neighbor_dir == 270)
- loop_dir = 90;
+ if (neighbor_dir == S)
+ loop_dir = N;
break;
case 1:
- if (neighbor_dir == 225)
- loop_dir = 45;
+ if (neighbor_dir == SW)
+ loop_dir = NE;
break;
}
break;
@@ -45,12 +45,12 @@
case 0:
switch (j) {
case -1:
- if (neighbor_dir == 360)
- loop_dir = 180;
+ if (neighbor_dir == E)
+ loop_dir = W;
break;
case 1:
- if (neighbor_dir == 180)
- loop_dir = 360;
+ if (neighbor_dir == W)
+ loop_dir = E;
break;
}
break;
@@ -57,16 +57,16 @@
case 1:
switch (j) {
case -1:
- if (neighbor_dir == 45)
- loop_dir = 225;
+ if (neighbor_dir == NE)
+ loop_dir = SW;
break;
case 0:
- if (neighbor_dir == 90)
- loop_dir = 270;
+ if (neighbor_dir == N)
+ loop_dir = S;
break;
case 1:
- if (neighbor_dir == 135)
- loop_dir = 315;
+ if (neighbor_dir == NW)
+ loop_dir = SE;
break;
}
break;
Modified: grass-addons/grass7/raster/r.accumulate/global.h
===================================================================
--- grass-addons/grass7/raster/r.accumulate/global.h 2018-06-22 05:59:14 UTC (rev 72878)
+++ grass-addons/grass7/raster/r.accumulate/global.h 2018-06-22 19:01:19 UTC (rev 72879)
@@ -4,6 +4,15 @@
#define DIR_DEG 1
#define DIR_DEG45 2
+#define NW 135
+#define N 90
+#define NE 45
+#define E 360
+#define SE 315
+#define S 270
+#define SW 225
+#define W 180
+
typedef struct
{
RASTER_MAP_TYPE type;
More information about the grass-commit
mailing list