[GRASS-SVN] r44348 - grass/branches/develbranch_6/imagery/i.rectify

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Nov 16 06:16:22 EST 2010


Author: mmetz
Date: 2010-11-16 03:16:22 -0800 (Tue, 16 Nov 2010)
New Revision: 44348

Modified:
   grass/branches/develbranch_6/imagery/i.rectify/rectify.c
Log:
use standard for row/col loop (backport from trunk r43347)

Modified: grass/branches/develbranch_6/imagery/i.rectify/rectify.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.rectify/rectify.c	2010-11-16 11:12:46 UTC (rev 44347)
+++ grass/branches/develbranch_6/imagery/i.rectify/rectify.c	2010-11-16 11:16:22 UTC (rev 44348)
@@ -14,7 +14,7 @@
 {
     struct Cell_head cellhd;
     int ncols, nrows;
-    int row;
+    int row, col;
     double row_idx, col_idx;
     int infd, cell_size, outfd;
     void *trast, *tptr;
@@ -65,16 +65,15 @@
     outfd = G_open_raster_new(result, map_type);
     trast = G_allocate_raster_buf(map_type);
 
-    row = 0;
-    for (n1 = target_window.north - target_window.ns_res / 2.;
-         n1 > target_window.south; n1 -= target_window.ns_res) {
+    for (row = 0; row < nrows; row++) {
+	n1 = target_window.north - (row + 0.5) * target_window.ns_res;
 
-	G_percent(row++, nrows, 2);
-
+	G_percent(row, nrows, 2);
+	
 	G_set_null_value(trast, ncols, map_type);
 	tptr = trast;
-	for (e1 = target_window.west + target_window.ew_res / 2.;
-	     e1 < target_window.east; e1 += target_window.ew_res) {
+	for (col = 0; col < ncols; col++) {
+	    e1 = target_window.west + (col + 0.5) * target_window.ew_res;
 
 	    /* backwards transformation of target cell center */
 	    CRS_georef(e1, n1, &ex, &nx, E21, N21, order);



More information about the grass-commit mailing list