[Liblas-commits] r1162 - trunk/apps

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Apr 3 10:16:43 EDT 2009


Author: mloskot
Date: Fri Apr  3 10:16:43 2009
New Revision: 1162
URL: http://liblas.org/changeset/1162

Log:
Fixed bug with random and incorrect behavior of classification filtering in las2las (Ticket #122). Simply, classification index for lookup table was calculated incorrectly - only 0:4 bits of classification value store index value.

Modified:
   trunk/apps/las2las.c
   trunk/apps/lascommon.c

Modified: trunk/apps/las2las.c
==============================================================================
--- trunk/apps/las2las.c	(original)
+++ trunk/apps/las2las.c	Fri Apr  3 10:16:43 2009
@@ -11,7 +11,7 @@
  * See LICENSE.txt in this source distribution for more information.
  **************************************************************************/
 
-
+#include <assert.h>
 #include <time.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -97,6 +97,7 @@
     int elim_scan_angle_above = 0;
     int elim_intensity_below = 0;
     int elim_class = 0;
+    int clsidx = 0;
     int first_only = FALSE;
     int last_only = FALSE;
     int skip_invalid = FALSE;
@@ -370,12 +371,17 @@
             p = LASReader_GetNextPoint(reader);
             continue;
         }
-        if (elim_class && ( elim_class == LASPoint_GetClassification(p)))
+
+        clsidx = LASPoint_GetClassification(p);
+        clsidx = (clsidx & 31); // 31 is max index in classification lookup table
+        assert(clsidx <= 31);
+        if (elim_class && (elim_class == clsidx))
         {
             eliminated_class++;
             p = LASReader_GetNextPoint(reader);
             continue;
-        }        
+        }
+
         if (elim_intensity_below && LASPoint_GetIntensity(p) < elim_intensity_below)
         {
             eliminated_intensity++;

Modified: trunk/apps/lascommon.c
==============================================================================
--- trunk/apps/lascommon.c	(original)
+++ trunk/apps/lascommon.c	Fri Apr  3 10:16:43 2009
@@ -57,6 +57,7 @@
     uint16_t blue = 0;
     
     int i = 0;
+    unsigned long idx = 0;
 
     summary = (LASPointSummary*) malloc(sizeof(LASPointSummary));
 


More information about the Liblas-commits mailing list