[GRASS-SVN] r46266 - grass/trunk/lib/lidar

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 14 09:09:50 EDT 2011


Author: mmetz
Date: 2011-05-14 06:09:50 -0700 (Sat, 14 May 2011)
New Revision: 46266

Modified:
   grass/trunk/lib/lidar/lidar.h
   grass/trunk/lib/lidar/raster.c
   grass/trunk/lib/lidar/zones.c
Log:
lidarlib: use segmentlib

Modified: grass/trunk/lib/lidar/lidar.h
===================================================================
--- grass/trunk/lib/lidar/lidar.h	2011-05-14 08:01:55 UTC (rev 46265)
+++ grass/trunk/lib/lidar/lidar.h	2011-05-14 13:09:50 UTC (rev 46266)
@@ -25,6 +25,7 @@
 #include <grass/vector.h>
 #include <grass/dbmi.h>
 #include <grass/raster.h>
+#include <grass/segment.h>
 #include <grass/glocale.h>
 
 /*----------------------------------------------------------------------------------------------------------*/
@@ -112,7 +113,7 @@
 				       struct Cell_head *, /**/
 				       int *, /**/ int, /**/ int /**/);
 
-struct Point *P_Read_Raster_Region_Map(double **, /**/
+struct Point *P_Read_Raster_Region_Map(SEGMENT *, /**/
 				       struct Cell_head *, /**/
 				       struct Cell_head *, /**/
 				       int *, /**/ int /**/);
@@ -138,12 +139,11 @@
 		struct line_cats *, /**/
 		dbDriver *, /**/ double, /**/ char * /**/);
 
-double **P_Regular_Points(struct Cell_head *, /**/
+int P_Regular_Points(struct Cell_head *, /**/
                           struct Cell_head *, /**/
 			  struct bound_box, /**/
 			  struct bound_box, /**/
-			  double **, /**/
-			  char **, /**/
+			  SEGMENT *, /**/
 			  double *, /**/
 			  double, /**/
 			  double, /**/

Modified: grass/trunk/lib/lidar/raster.c
===================================================================
--- grass/trunk/lib/lidar/raster.c	2011-05-14 08:01:55 UTC (rev 46265)
+++ grass/trunk/lib/lidar/raster.c	2011-05-14 13:09:50 UTC (rev 46266)
@@ -187,16 +187,16 @@
 
 
 /*------------------------------------------------------------------------------------------------*/
-double **P_Regular_Points(struct Cell_head *Elaboration, struct Cell_head *Original,
+int P_Regular_Points(struct Cell_head *Elaboration, struct Cell_head *Original,
                           struct bound_box General, struct bound_box Overlap,
-			  double **matrix, char **mask_matrix, double *param,
+			  SEGMENT *out_seg, double *param,
 			  double passoN, double passoE, double overlap,
 			  double mean, int nsplx, int nsply,
 			  int nrows, int ncols, int bilin)
 {
 
     int col, row, startcol, endcol, startrow, endrow;
-    double X, Y, interpolation, weight, csi, eta;
+    double X, Y, interpolation, weight, csi, eta, dval;
 
     /* G_get_window(&Original); */
     if (Original->north > General.N)
@@ -225,11 +225,6 @@
     for (row = startrow; row < endrow; row++) {
 	for (col = startcol; col < endcol; col++) {
 
-	    if (mask_matrix) {
-		if (!mask_matrix[row][col])
-		    continue;
-	    }
-
 	    X = Rast_col_to_easting((double)(col) + 0.5, Original);
 	    Y = Rast_row_to_northing((double)(row) + 0.5, Original);
 
@@ -249,28 +244,29 @@
 		interpolation += mean;
 
 		if (Vect_point_in_box(X, Y, interpolation, &Overlap)) {	/* (5) */
-		    matrix[row][col] = interpolation;
+		    dval = interpolation;
 		}
 		else {
+		    segment_get(out_seg, &dval, row, col);
 		    if ((X > Overlap.E) && (X < General.E)) {
 			if ((Y > Overlap.N) && (Y < General.N)) {	/* (3) */
 			    csi = (General.E - X) / overlap;
 			    eta = (General.N - Y) / overlap;
 			    weight = csi * eta;
 			    interpolation *= weight;
-			    matrix[row][col] += interpolation;
+			    dval += interpolation;
 			}
 			else if ((Y < Overlap.S) && (Y > General.S)) {	/* (1) */
 			    csi = (General.E - X) / overlap;
 			    eta = (Y - General.S) / overlap;
 			    weight = csi * eta;
 			    interpolation *= weight;
-			    matrix[row][col] = interpolation;
+			    dval = interpolation;
 			}
 			else if ((Y >= Overlap.S) && (Y <= Overlap.N)) {	/* (1) */
 			    weight = (General.E - X ) / overlap;
 			    interpolation *= weight;
-			    matrix[row][col] = interpolation;
+			    dval = interpolation;
 			}
 		    }
 		    else if ((X < Overlap.W) && (X > General.W)) {
@@ -279,36 +275,37 @@
 			    eta = (General.N - Y) / overlap;
 			    weight = eta * csi;
 			    interpolation *= weight;
-			    matrix[row][col] += interpolation;
+			    dval += interpolation;
 			}
 			else if ((Y < Overlap.S) && (Y > General.S)) {	/* (2) */
 			    csi = (X - General.W) / overlap;
 			    eta = (Y - General.S) / overlap;
 			    weight = csi * eta;
 			    interpolation *= weight;
-			    matrix[row][col] += interpolation;
+			    dval += interpolation;
 			}
 			else if ((Y >= Overlap.S) && (Y <= Overlap.N)) {	/* (2) */
 			    weight = (X - General.W) / overlap;
 			    interpolation *= weight;
-			    matrix[row][col] += interpolation;
+			    dval += interpolation;
 			}
 		    }
 		    else if ((X >= Overlap.W) && (X <= Overlap.E)) {
 			if ((Y > Overlap.N) && (Y < General.N)) {	/* (3) */
 			    weight = (General.N - Y) / overlap;
 			    interpolation *= weight;
-			    matrix[row][col] += interpolation;
+			    dval += interpolation;
 			}
 			else if ((Y < Overlap.S) && (Y > General.S)) {	/* (1) */
 			    weight = (Y - General.S) / overlap;
 			    interpolation *= weight;
-			    matrix[row][col] = interpolation;
+			    dval = interpolation;
 			}
 		    }
 		}
+		segment_put(out_seg, &dval, row, col);
 	    }
 	}			/* END COL */
     }				/* END ROW */
-    return matrix;
+    return 1;
 }

Modified: grass/trunk/lib/lidar/zones.c
===================================================================
--- grass/trunk/lib/lidar/zones.c	2011-05-14 08:01:55 UTC (rev 46265)
+++ grass/trunk/lib/lidar/zones.c	2011-05-14 13:09:50 UTC (rev 46266)
@@ -373,7 +373,7 @@
     return obs;
 }
 
-struct Point *P_Read_Raster_Region_Map(double **matrix,
+struct Point *P_Read_Raster_Region_Map(SEGMENT *in_seg,
 				       struct Cell_head *Elaboration,
 				       struct Cell_head *Original,
 				       int *num_points, int dim_vect)
@@ -420,7 +420,7 @@
     for (row = startrow; row < endrow; row++) {
 	for (col = startcol; col < endcol; col++) {
 
-	    z = matrix[row][col];
+	    segment_get(in_seg, &z, row, col);
 
 	    if (!Rast_is_d_null_value(&z)) {
 



More information about the grass-commit mailing list