[GRASS-SVN] r61002 - sandbox/annakrat/r3.flow

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jun 26 17:44:19 PDT 2014


Author: annakrat
Date: 2014-06-26 17:44:19 -0700 (Thu, 26 Jun 2014)
New Revision: 61002

Modified:
   sandbox/annakrat/r3.flow/voxel_traversal.py
Log:
r3.flow: avoid infinite loop

Modified: sandbox/annakrat/r3.flow/voxel_traversal.py
===================================================================
--- sandbox/annakrat/r3.flow/voxel_traversal.py	2014-06-26 22:25:51 UTC (rev 61001)
+++ sandbox/annakrat/r3.flow/voxel_traversal.py	2014-06-27 00:44:19 UTC (rev 61002)
@@ -78,7 +78,10 @@
                 tMaxZ = tMaxZ + tDeltaZ
                 Z = Z + stepZ
 
-        if (X, Y, Z) == (X_end, Y_end, Z_end):
+        if (X, Y, Z) == (X_end, Y_end, Z_end) or \
+           (stepX * (X - X_end) > 0 or
+            stepY * (Y - Y_end) > 0 or
+            stepZ * (Z - Z_end) > 0):  # just to make sure it breaks
             break
         coordinates.append((X, region_info['rows'] - Y - 1, Z))
     return coordinates



More information about the grass-commit mailing list