[GRASS-SVN] r68287 - grass/trunk/raster3d/r3.in.lidar

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Apr 19 13:48:48 PDT 2016


Author: wenzeslaus
Date: 2016-04-19 13:48:48 -0700 (Tue, 19 Apr 2016)
New Revision: 68287

Modified:
   grass/trunk/raster3d/r3.in.lidar/main.c
Log:
r3.in.lidar: check limits of the actual r,c,d values instead of using Rast3d_is_valid_location

This avoids floating point issues at the edge of the
3D raster and a subsequent segmentation fault.


Modified: grass/trunk/raster3d/r3.in.lidar/main.c
===================================================================
--- grass/trunk/raster3d/r3.in.lidar/main.c	2016-04-19 16:56:52 UTC (rev 68286)
+++ grass/trunk/raster3d/r3.in.lidar/main.c	2016-04-19 20:48:48 UTC (rev 68287)
@@ -225,11 +225,12 @@
         north = LASPoint_GetY(LAS_point);
         top = LASPoint_GetZ(LAS_point);
 
-        if (!Rast3d_is_valid_location(&region, north, east, top)) {
+        Rast3d_location2coord(&region, north, east, top, &col, &row, &depth);
+        if (col >= region.cols || row >= region.rows || depth >= region.depths
+            || col < 0 || row < 0 || depth < 0) {
             outside += 1;
             continue;
         }
-        Rast3d_location2coord(&region, north, east, top, &col, &row, &depth);
         value = LASPoint_GetIntensity(LAS_point);
 
         tmp = Rast3d_get_double(count_raster, col, row, depth);



More information about the grass-commit mailing list