lasfilter.cpp
Go to the documentation of this file.
1 /*
2 ===============================================================================
3 
4  FILE: lasfilter.cpp
5 
6  CONTENTS:
7 
8  see corresponding header file
9 
10  PROGRAMMERS:
11 
12  martin.isenburg@gmail.com
13 
14  COPYRIGHT:
15 
16  (c) 2007-2011, Martin Isenburg, LASSO - tools to catch reality
17 
18  This is free software; you can redistribute and/or modify it under the
19  terms of the GNU Lesser General Licence as published by the Free Software
20  Foundation. See the COPYING file for more information.
21 
22  This software is distributed WITHOUT ANY WARRANTY and without even the
23  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24 
25  CHANGE HISTORY:
26 
27  see corresponding header file
28 
29 ===============================================================================
30 */
31 #include "lasfilter.hpp"
32 
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <string.h>
36 
38 {
39 public:
40  inline const char* name() const { return "clip_tile"; };
41  inline int get_command(char* string) const { return sprintf(string, "-%s %g %g %g ", name(), ll_x, ll_y, tile_size); };
42  inline BOOL filter(const LASpoint* point) { return (!point->inside_tile(ll_x, ll_y, ur_x, ur_y)); };
43  LAScriterionClipTile(F32 ll_x, F32 ll_y, F32 tile_size) { this->ll_x = ll_x; this->ll_y = ll_y; this->ur_x = ll_x+tile_size; this->ur_y = ll_y+tile_size; this->tile_size = tile_size; };
44 private:
46 };
47 
49 {
50 public:
51  inline const char* name() const { return "clip_circle"; };
52  inline int get_command(char* string) const { return sprintf(string, "-%s %g %g %g ", name(), center_x, center_y, radius); };
53  inline BOOL filter(const LASpoint* point) { return (!point->inside_circle(center_x, center_y, radius_squared)); };
54  LAScriterionClipCircle(F64 x, F64 y, F64 radius) { this->center_x = x; this->center_y = y; this->radius = radius; this->radius_squared = radius*radius; };
55 private:
56  F64 center_x, center_y, radius, radius_squared;
57 };
58 
60 {
61 public:
62  inline const char* name() const { return "clip"; };
63  inline int get_command(char* string) const { return sprintf(string, "-%s %g %g %g %g ", name(), below_x, below_y, above_x, above_y); };
64  inline BOOL filter(const LASpoint* point) { return (!point->inside_rectangle(below_x, below_y, above_x, above_y)); };
65  LAScriterionClipXY(F64 below_x, F64 below_y, F64 above_x, F64 above_y) { this->below_x = below_x; this->below_y = below_y; this->above_x = above_x; this->above_y = above_y; };
66 private:
67  F64 below_x, below_y, above_x, above_y;
68 };
69 
71 {
72 public:
73  inline const char* name() const { return "clip_z"; };
74  inline int get_command(char* string) const { return sprintf(string, "-%s %g %g ", name(), below_z, above_z); };
75  inline BOOL filter(const LASpoint* point) { F64 z = point->get_z(); return (z < below_z) || (z > above_z); };
76  LAScriterionClipZ(F64 below_z, F64 above_z) { this->below_z = below_z; this->above_z = above_z; };
77 private:
78  F64 below_z, above_z;
79 };
80 
82 {
83 public:
84  inline const char* name() const { return "clip_x_below"; };
85  inline int get_command(char* string) const { return sprintf(string, "-%s %g ", name(), below_x); };
86  inline BOOL filter(const LASpoint* point) { return (point->get_x() < below_x); };
87  LAScriterionClipXBelow(F64 below_x) { this->below_x = below_x; };
88 private:
89  F64 below_x;
90 };
91 
93 {
94 public:
95  inline const char* name() const { return "clip_x_above"; };
96  inline int get_command(char* string) const { return sprintf(string, "-%s %g ", name(), above_x); };
97  inline BOOL filter(const LASpoint* point) { return (point->get_x() > above_x); };
98  LAScriterionClipXAbove(F64 above_x) { this->above_x = above_x; };
99 private:
100  F64 above_x;
101 };
102 
104 {
105 public:
106  inline const char* name() const { return "clip_y_below"; };
107  inline int get_command(char* string) const { return sprintf(string, "-%s %g ", name(), below_y); };
108  inline BOOL filter(const LASpoint* point) { return (point->get_y() < below_y); };
109  LAScriterionClipYBelow(F64 below_y) { this->below_y = below_y; };
110 private:
111  F64 below_y;
112 };
113 
115 {
116 public:
117  inline const char* name() const { return "clip_y_above"; };
118  inline int get_command(char* string) const { return sprintf(string, "-%s %g ", name(), above_y); };
119  inline BOOL filter(const LASpoint* point) { return (point->get_y() > above_y); };
120  LAScriterionClipYAbove(F64 above_y) { this->above_y = above_y; };
121 private:
122  F64 above_y;
123 };
124 
126 {
127 public:
128  inline const char* name() const { return "clip_z_below"; };
129  inline int get_command(char* string) const { return sprintf(string, "-%s %g ", name(), below_z); };
130  inline BOOL filter(const LASpoint* point) { return (point->get_z() < below_z); };
131  LAScriterionClipZBelow(F64 below_z) { this->below_z = below_z; };
132 private:
133  F64 below_z;
134 };
135 
137 {
138 public:
139  inline const char* name() const { return "clip_z_above"; };
140  inline int get_command(char* string) const { return sprintf(string, "-%s %g ", name(), above_z); };
141  inline BOOL filter(const LASpoint* point) { return (point->get_z() > above_z); };
142  LAScriterionClipZAbove(F64 above_z) { this->above_z = above_z; };
143 private:
144  F64 above_z;
145 };
146 
148 {
149 public:
150  inline const char* name() const { return "clip_raw_xy"; };
151  inline int get_command(char* string) const { return sprintf(string, "-%s %d %d %d %d ", name(), below_x, below_y, above_x, above_y); };
152  inline BOOL filter(const LASpoint* point) { return (point->x < below_x) || (point->y < below_y) || (point->x > above_x) || (point->y > above_y); };
153  LAScriterionClipRawXY(I32 below_x, I32 below_y, I32 above_x, I32 above_y) { this->below_x = below_x; this->below_y = below_y; this->above_x = above_x; this->above_y = above_y; };
154 private:
155  I32 below_x, below_y, above_x, above_y;
156 };
157 
159 {
160 public:
161  inline const char* name() const { return "clip_raw_z"; };
162  inline int get_command(char* string) const { return sprintf(string, "-%s %d %d ", name(), below_z, above_z); };
163  inline BOOL filter(const LASpoint* point) { return (point->z < below_z) || (point->z > above_z); };
164  LAScriterionClipRawZ(I32 below_z, I32 above_z) { this->below_z = below_z; this->above_z = above_z; };
165 private:
166  I32 below_z, above_z;
167 };
168 
170 {
171 public:
172  inline const char* name() const { return "clip_raw_x_below"; };
173  inline int get_command(char* string) const { return sprintf(string, "-%s %d ", name(), below_x); };
174  inline BOOL filter(const LASpoint* point) { return (point->x < below_x); };
175  LAScriterionClipRawXBelow(I32 below_x) { this->below_x = below_x; };
176 private:
177  I32 below_x;
178 };
179 
181 {
182 public:
183  inline const char* name() const { return "clip_raw_x_above"; };
184  inline int get_command(char* string) const { return sprintf(string, "-%s %d ", name(), above_x); };
185  inline BOOL filter(const LASpoint* point) { return (point->x > above_x); };
186  LAScriterionClipRawXAbove(I32 above_x) { this->above_x = above_x; };
187 private:
188  I32 above_x;
189 };
190 
192 {
193 public:
194  inline const char* name() const { return "clip_raw_y_below"; };
195  inline int get_command(char* string) const { return sprintf(string, "-%s %d ", name(), below_y); };
196  inline BOOL filter(const LASpoint* point) { return (point->y < below_y); };
197  LAScriterionClipRawYBelow(I32 below_y) { this->below_y = below_y; };
198 private:
199  I32 below_y;
200 };
201 
203 {
204 public:
205  inline const char* name() const { return "clip_raw_y_above"; };
206  inline int get_command(char* string) const { return sprintf(string, "-%s %d ", name(), above_y); };
207  inline BOOL filter(const LASpoint* point) { return (point->y > above_y); };
208  LAScriterionClipRawYAbove(I32 above_y) { this->above_y = above_y; };
209 private:
210  I32 above_y;
211 };
212 
214 {
215 public:
216  inline const char* name() const { return "clip_raw_z_below"; };
217  inline int get_command(char* string) const { return sprintf(string, "-%s %d ", name(), below_z); };
218  inline BOOL filter(const LASpoint* point) { return (point->z < below_z); };
219  LAScriterionClipRawZBelow(I32 below_z) { this->below_z = below_z; };
220 private:
221  I32 below_z;
222 };
223 
225 {
226 public:
227  inline const char* name() const { return "clip_raw_z_above"; };
228  inline int get_command(char* string) const { return sprintf(string, "-%s %d ", name(), above_z); };
229  inline BOOL filter(const LASpoint* point) { return (point->z > above_z); };
230  LAScriterionClipRawZAbove(I32 above_z) { this->above_z = above_z; };
231 private:
232  I32 above_z;
233 };
234 
236 {
237 public:
238  inline const char* name() const { return "keep_first"; };
239  inline int get_command(char* string) const { return sprintf(string, "-%s ", name()); };
240  inline BOOL filter(const LASpoint* point) { return (point->return_number > 1); };
241 };
242 
244 {
245 public:
246  inline const char* name() const { return "keep_middle"; };
247  inline int get_command(char* string) const { return sprintf(string, "-%s ", name()); };
248  inline BOOL filter(const LASpoint* point) { return ((point->return_number == 1) || (point->return_number >= point->number_of_returns_of_given_pulse)); };
249 };
250 
252 {
253 public:
254  inline const char* name() const { return "keep_last"; };
255  inline int get_command(char* string) const { return sprintf(string, "-%s ", name()); };
256  inline BOOL filter(const LASpoint* point) { return (point->return_number < point->number_of_returns_of_given_pulse); };
257 };
258 
260 {
261 public:
262  inline const char* name() const { return "drop_first"; };
263  inline int get_command(char* string) const { return sprintf(string, "-%s ", name()); };
264  inline BOOL filter(const LASpoint* point) { return (point->return_number == 1); };
265 };
266 
268 {
269 public:
270  inline const char* name() const { return "drop_middle"; };
271  inline int get_command(char* string) const { return sprintf(string, "-%s ", name()); };
272  inline BOOL filter(const LASpoint* point) { return ((point->return_number > 1) && (point->return_number < point->number_of_returns_of_given_pulse)); };
273 };
274 
276 {
277 public:
278  inline const char* name() const { return "drop_last"; };
279  inline int get_command(char* string) const { return sprintf(string, "-%s ", name()); };
280  inline BOOL filter(const LASpoint* point) { return (point->return_number >= point->number_of_returns_of_given_pulse); };
281 };
282 
284 {
285 public:
286  inline const char* name() const { return "keep_return_mask"; };
287  inline int get_command(char* string) const { return sprintf(string, "-%s %u ", name(), ~drop_return_mask); };
288  inline BOOL filter(const LASpoint* point) { return ((1 << point->return_number) & drop_return_mask); };
289  LAScriterionKeepReturns(U32 keep_return_mask) { drop_return_mask = ~keep_return_mask; };
290 private:
291  U32 drop_return_mask;
292 };
293 
295 {
296 public:
297  inline const char* name() const { return (numberOfReturns == 1 ? "keep_single" : (numberOfReturns == 2 ? "keep_double" : (numberOfReturns == 3 ? "keep_triple" : (numberOfReturns == 4 ? "keep_quadruple" : "keep_quintuple")))); };
298  inline int get_command(char* string) const { return sprintf(string, "-%s ", name()); };
299  inline BOOL filter(const LASpoint* point) { return (point->number_of_returns_of_given_pulse != numberOfReturns); };
300  LAScriterionKeepSpecificNumberOfReturns(U32 numberOfReturns) { this->numberOfReturns = numberOfReturns; };
301 private:
303 };
304 
306 {
307 public:
308  inline const char* name() const { return (numberOfReturns == 1 ? "drop_single" : (numberOfReturns == 2 ? "drop_double" : (numberOfReturns == 3 ? "drop_triple" : (numberOfReturns == 4 ? "drop_quadruple" : "drop_quintuple")))); };
309  inline int get_command(char* string) const { return sprintf(string, "-%s ", name()); };
310  inline BOOL filter(const LASpoint* point) { return (point->number_of_returns_of_given_pulse == numberOfReturns); };
311  LAScriterionDropSpecificNumberOfReturns(U32 numberOfReturns) { this->numberOfReturns = numberOfReturns; };
312 private:
314 };
315 
317 {
318 public:
319  inline const char* name() const { return "drop_scan_direction"; };
320  inline int get_command(char* string) const { return sprintf(string, "-%s %d ", name(), scan_direction); };
321  inline BOOL filter(const LASpoint* point) { return (scan_direction == point->scan_direction_flag); };
322  LAScriterionDropScanDirection(I32 scan_direction) { this->scan_direction = scan_direction; };
323 private:
325 };
326 
328 {
329 public:
330  inline const char* name() const { return "scan_direction_change_only"; };
331  inline int get_command(char* string) const { return sprintf(string, "-%s ", name()); };
332  inline BOOL filter(const LASpoint* point) { if (scan_direction_flag == point->scan_direction_flag) return TRUE; I32 s = scan_direction_flag; scan_direction_flag = point->scan_direction_flag; return s == -1; };
333  void reset() { scan_direction_flag = -1; };
335 private:
337 };
338 
340 {
341 public:
342  inline const char* name() const { return "edge_of_flight_line_only"; };
343  inline int get_command(char* string) const { return sprintf(string, "-%s ", name()); };
344  inline BOOL filter(const LASpoint* point) { return (point->edge_of_flight_line == 0); };
345 };
346 
348 {
349 public:
350  inline const char* name() const { return "keep_scan_angle"; };
351  inline int get_command(char* string) const { return sprintf(string, "-%s %d %d ", name(), below_scan, above_scan); };
352  inline BOOL filter(const LASpoint* point) { return (point->scan_angle_rank < below_scan) || (above_scan < point->scan_angle_rank); };
353  LAScriterionKeepScanAngle(I32 below_scan, I32 above_scan) { if (above_scan < below_scan) { this->below_scan = above_scan; this->above_scan = below_scan; } else { this->below_scan = below_scan; this->above_scan = above_scan; } };
354 private:
355  I32 below_scan, above_scan;
356 };
357 
359 {
360 public:
361  inline const char* name() const { return "drop_scan_angle_below"; };
362  inline int get_command(char* string) const { return sprintf(string, "-%s %d ", name(), below_scan); };
363  inline BOOL filter(const LASpoint* point) { return (point->scan_angle_rank < below_scan); };
364  LAScriterionDropScanAngleBelow(I32 below_scan) { this->below_scan = below_scan; };
365 private:
366  I32 below_scan;
367 };
368 
370 {
371 public:
372  inline const char* name() const { return "drop_scan_angle_above"; };
373  inline int get_command(char* string) const { return sprintf(string, "-%s %d ", name(), above_scan); };
374  inline BOOL filter(const LASpoint* point) { return (point->scan_angle_rank > above_scan); };
375  LAScriterionDropScanAngleAbove(I32 above_scan) { this->above_scan = above_scan; };
376 private:
377  I32 above_scan;
378 };
379 
381 {
382 public:
383  inline const char* name() const { return "drop_scan_angle_between"; };
384  inline int get_command(char* string) const { return sprintf(string, "-%s %d %d ", name(), below_scan, above_scan); };
385  inline BOOL filter(const LASpoint* point) { return (below_scan <= point->scan_angle_rank) && (point->scan_angle_rank <= above_scan); };
386  LAScriterionDropScanAngleBetween(I32 below_scan, I32 above_scan) { if (above_scan < below_scan) { this->below_scan = above_scan; this->above_scan = below_scan; } else { this->below_scan = below_scan; this->above_scan = above_scan; } };
387 private:
388  I32 below_scan, above_scan;
389 };
390 
392 {
393 public:
394  inline const char* name() const { return "keep_intensity"; };
395  inline int get_command(char* string) const { return sprintf(string, "-%s %d %d ", name(), below_intensity, above_intensity); };
396  inline BOOL filter(const LASpoint* point) { return (point->intensity < below_intensity) || (point->intensity > above_intensity); };
397  LAScriterionKeepIntensity(I32 below_intensity, I32 above_intensity) { this->below_intensity = below_intensity; this->above_intensity = above_intensity; };
398 private:
399  I32 below_intensity, above_intensity;
400 };
401 
403 {
404 public:
405  inline const char* name() const { return "drop_intensity_below"; };
406  inline int get_command(char* string) const { return sprintf(string, "-%s %d ", name(), below_intensity); };
407  inline BOOL filter(const LASpoint* point) { return (point->intensity < below_intensity); };
408  LAScriterionDropIntensityBelow(I32 below_intensity) { this->below_intensity = below_intensity; };
409 private:
410  I32 below_intensity;
411 };
412 
414 {
415 public:
416  inline const char* name() const { return "drop_intensity_above"; };
417  inline int get_command(char* string) const { return sprintf(string, "-%s %d ", name(), above_intensity); };
418  inline BOOL filter(const LASpoint* point) { return (point->intensity > above_intensity); };
419  LAScriterionDropIntensityAbove(I32 above_intensity) { this->above_intensity = above_intensity; };
420 private:
421  I32 above_intensity;
422 };
423 
425 {
426 public:
427  inline const char* name() const { return "drop_intensity_between"; };
428  inline int get_command(char* string) const { return sprintf(string, "-%s %d %d ", name(), below_intensity, above_intensity); };
429  inline BOOL filter(const LASpoint* point) { return (below_intensity <= point->intensity) && (point->intensity <= above_intensity); };
430  LAScriterionDropIntensityBetween(I32 below_intensity, I32 above_intensity) { this->below_intensity = below_intensity; this->above_intensity = above_intensity; };
431 private:
432  I32 below_intensity, above_intensity;
433 };
434 
436 {
437 public:
438  inline const char* name() const { return "keep_classification_mask"; };
439  inline int get_command(char* string) const { return sprintf(string, "-%s %u ", name(), ~drop_classification_mask); };
440  inline BOOL filter(const LASpoint* point) { return ((1 << point->classification) & drop_classification_mask); };
441  LAScriterionKeepClassifications(U32 keep_classification_mask) { drop_classification_mask = ~keep_classification_mask; };
442 private:
443  U32 drop_classification_mask;
444 };
445 
447 {
448 public:
449  inline const char* name() const { return "keep_point_source"; };
450  inline int get_command(char* string) const { return sprintf(string, "-%s %d ", name(), point_source_id); };
451  inline BOOL filter(const LASpoint* point) { return (point->point_source_ID != point_source_id); };
452  LAScriterionKeepPointSource(I32 point_source_id) { this->point_source_id = point_source_id; };
453 private:
455 };
456 
458 {
459 public:
460  inline const char* name() const { return "keep_point_source_between"; };
461  inline int get_command(char* string) const { return sprintf(string, "-%s %d %d ", name(), below_point_source_id, above_point_source_id); };
462  inline BOOL filter(const LASpoint* point) { return (point->point_source_ID < below_point_source_id) || (above_point_source_id < point->point_source_ID); };
463  LAScriterionKeepPointSourceBetween(I32 below_point_source_id, I32 above_point_source_id) { this->below_point_source_id = below_point_source_id; this->above_point_source_id = above_point_source_id; };
464 private:
465  I32 below_point_source_id, above_point_source_id;
466 };
467 
469 {
470 public:
471  inline const char* name() const { return "drop_point_source_below"; };
472  inline int get_command(char* string) const { return sprintf(string, "-%s %d ", name(), below_point_source_id); };
473  inline BOOL filter(const LASpoint* point) { return (point->point_source_ID < below_point_source_id) ; };
474  LAScriterionDropPointSourceBelow(I32 below_point_source_id) { this->below_point_source_id = below_point_source_id; };
475 private:
476  I32 below_point_source_id;
477 };
478 
480 {
481 public:
482  inline const char* name() const { return "drop_point_source_above"; };
483  inline int get_command(char* string) const { return sprintf(string, "-%s %d ", name(), above_point_source_id); };
484  inline BOOL filter(const LASpoint* point) { return (point->point_source_ID > above_point_source_id); };
485  LAScriterionDropPointSourceAbove(I32 above_point_source_id) { this->above_point_source_id = above_point_source_id; };
486 private:
487  I32 above_point_source_id;
488 };
489 
491 {
492 public:
493  inline const char* name() const { return "drop_point_source_between"; };
494  inline int get_command(char* string) const { return sprintf(string, "-%s %d %d ", name(), below_point_source_id, above_point_source_id); };
495  inline BOOL filter(const LASpoint* point) { return (below_point_source_id <= point->point_source_ID) && (point->point_source_ID <= above_point_source_id); };
496  LAScriterionDropPointSourceBetween(I32 below_point_source_id, I32 above_point_source_id) { this->below_point_source_id = below_point_source_id; this->above_point_source_id = above_point_source_id; };
497 private:
498  I32 below_point_source_id, above_point_source_id;
499 };
500 
502 {
503 public:
504  inline const char* name() const { return "keep_gps_time"; };
505  inline int get_command(char* string) const { return sprintf(string, "-%s %g %g ", name(), below_gpstime, above_gpstime); };
506  inline BOOL filter(const LASpoint* point) { return (point->have_gps_time && ((point->gps_time < below_gpstime) || (point->gps_time > above_gpstime))); };
507  LAScriterionKeepGpsTime(F64 below_gpstime, F64 above_gpstime) { this->below_gpstime = below_gpstime; this->above_gpstime = above_gpstime; };
508 private:
509  F64 below_gpstime, above_gpstime;
510 };
511 
513 {
514 public:
515  inline const char* name() const { return "drop_gps_time_below"; };
516  inline int get_command(char* string) const { return sprintf(string, "-%s %g ", name(), below_gpstime); };
517  inline BOOL filter(const LASpoint* point) { return (point->have_gps_time && (point->gps_time < below_gpstime)); };
518  LAScriterionDropGpsTimeBelow(F64 below_gpstime) { this->below_gpstime = below_gpstime; };
519 private:
520  F64 below_gpstime;
521 };
522 
524 {
525 public:
526  inline const char* name() const { return "drop_gps_time_above"; };
527  inline int get_command(char* string) const { return sprintf(string, "-%s %g ", name(), above_gpstime); };
528  inline BOOL filter(const LASpoint* point) { return (point->have_gps_time && (point->gps_time > above_gpstime)); };
529  LAScriterionDropGpsTimeAbove(F64 above_gpstime) { this->above_gpstime = above_gpstime; };
530 private:
531  F64 above_gpstime;
532 };
533 
535 {
536 public:
537  inline const char* name() const { return "drop_gps_time_between"; };
538  inline int get_command(char* string) const { return sprintf(string, "-%s %g %g ", name(), below_gpstime, above_gpstime); };
539  inline BOOL filter(const LASpoint* point) { return (point->have_gps_time && ((below_gpstime <= point->gps_time) && (point->gps_time <= above_gpstime))); };
540  LAScriterionDropGpsTimeBetween(F64 below_gpstime, F64 above_gpstime) { this->below_gpstime = below_gpstime; this->above_gpstime = above_gpstime; };
541 private:
542  F64 below_gpstime, above_gpstime;
543 };
544 
546 {
547 public:
548  inline const char* name() const { return "keep_wavepacket_mask"; };
549  inline int get_command(char* string) const { return sprintf(string, "-%s %u ", name(), ~drop_wavepacket_mask); };
550  inline BOOL filter(const LASpoint* point) { return ((1 << point->wavepacket.getIndex()) & drop_wavepacket_mask); };
551  LAScriterionKeepWavepackets(U32 keep_wavepacket_mask) { drop_wavepacket_mask = ~keep_wavepacket_mask; };
552 private:
553  U32 drop_wavepacket_mask;
554 };
555 
557 {
558 public:
559  inline const char* name() const { return "keep_every_nth"; };
560  inline int get_command(char* string) const { return sprintf(string, "-%s %d ", name(), every); };
561  inline BOOL filter(const LASpoint* point) { if (counter == every) { counter = 1; return FALSE; } else { counter++; return TRUE; } };
562  LAScriterionKeepEveryNth(I32 every) { this->every = every; counter = 1; };
563 private:
564  I32 counter;
566 };
567 
569 {
570 public:
571  inline const char* name() const { return "keep_random_fraction"; };
572  inline int get_command(char* string) const { return sprintf(string, "-%s %g ", name(), fraction); };
573  inline BOOL filter(const LASpoint* point) { F32 f = (F32)rand()/(F32)RAND_MAX; return f > fraction; };
574  LAScriterionKeepRandomFraction(F32 fraction) { this->fraction = fraction; };
575 private:
576  F32 fraction;
577 };
578 
580 {
581 public:
582  inline const char* name() const { return "thin_with_grid"; };
583  inline int get_command(char* string) const { return sprintf(string, "-%s %g ", name(), (grid_spacing > 0 ? grid_spacing : -grid_spacing)); };
584  inline BOOL filter(const LASpoint* point)
585  {
586  if (grid_spacing < 0)
587  {
588  grid_spacing = -grid_spacing;
589  anker = I32_FLOOR(point->get_y() / grid_spacing);
590  }
591  I32 pos_x = I32_FLOOR(point->get_x() / grid_spacing);
592  I32 pos_y = I32_FLOOR(point->get_y() / grid_spacing) - anker;
593  BOOL no_x_anker = FALSE;
594  U32* array_size;
595  I32** ankers;
596  U32*** array;
597  U16** array_sizes;
598  if (pos_y < 0)
599  {
600  pos_y = -pos_y - 1;
601  ankers = &minus_ankers;
602  if ((U32)pos_y < minus_plus_size && minus_plus_sizes[pos_y])
603  {
604  pos_x -= minus_ankers[pos_y];
605  if (pos_x < 0)
606  {
607  pos_x = -pos_x - 1;
608  array_size = &minus_minus_size;
609  array = &minus_minus;
610  array_sizes = &minus_minus_sizes;
611  }
612  else
613  {
614  array_size = &minus_plus_size;
615  array = &minus_plus;
616  array_sizes = &minus_plus_sizes;
617  }
618  }
619  else
620  {
621  no_x_anker = TRUE;
622  array_size = &minus_plus_size;
623  array = &minus_plus;
624  array_sizes = &minus_plus_sizes;
625  }
626  }
627  else
628  {
629  ankers = &plus_ankers;
630  if ((U32)pos_y < plus_plus_size && plus_plus_sizes[pos_y])
631  {
632  pos_x -= plus_ankers[pos_y];
633  if (pos_x < 0)
634  {
635  pos_x = -pos_x - 1;
636  array_size = &plus_minus_size;
637  array = &plus_minus;
638  array_sizes = &plus_minus_sizes;
639  }
640  else
641  {
642  array_size = &plus_plus_size;
643  array = &plus_plus;
644  array_sizes = &plus_plus_sizes;
645  }
646  }
647  else
648  {
649  no_x_anker = TRUE;
650  array_size = &plus_plus_size;
651  array = &plus_plus;
652  array_sizes = &plus_plus_sizes;
653  }
654  }
655  // maybe grow banded grid in y direction
656  if ((U32)pos_y >= *array_size)
657  {
658  U32 array_size_new = ((pos_y/1024)+1)*1024;
659  if (*array_size)
660  {
661  if (array == &minus_plus || array == &plus_plus) *ankers = (I32*)realloc(*ankers, array_size_new*sizeof(I32));
662  *array = (U32**)realloc(*array, array_size_new*sizeof(U32*));
663  *array_sizes = (U16*)realloc(*array_sizes, array_size_new*sizeof(U16));
664  }
665  else
666  {
667  if (array == &minus_plus || array == &plus_plus) *ankers = (I32*)malloc(array_size_new*sizeof(I32));
668  *array = (U32**)malloc(array_size_new*sizeof(U32*));
669  *array_sizes = (U16*)malloc(array_size_new*sizeof(U16));
670  }
671  for (U32 i = *array_size; i < array_size_new; i++)
672  {
673  (*array)[i] = 0;
674  (*array_sizes)[i] = 0;
675  }
676  *array_size = array_size_new;
677  }
678  // is this the first x anker for this y pos?
679  if (no_x_anker)
680  {
681  (*ankers)[pos_y] = pos_x;
682  pos_x = 0;
683  }
684  // maybe grow banded grid in x direction
685  U32 pos_x_pos = pos_x/32;
686  if (pos_x_pos >= (*array_sizes)[pos_y])
687  {
688  U32 array_sizes_new = ((pos_x_pos/256)+1)*256;
689  if ((*array_sizes)[pos_y])
690  {
691  (*array)[pos_y] = (U32*)realloc((*array)[pos_y], array_sizes_new*sizeof(U32));
692  }
693  else
694  {
695  (*array)[pos_y] = (U32*)malloc(array_sizes_new*sizeof(U32));
696  }
697  for (U16 i = (*array_sizes)[pos_y]; i < array_sizes_new; i++)
698  {
699  (*array)[pos_y][i] = 0;
700  }
701  (*array_sizes)[pos_y] = array_sizes_new;
702  }
703  U32 pos_x_bit = 1 << (pos_x%32);
704  if ((*array)[pos_y][pos_x_pos] & pos_x_bit) return TRUE;
705  (*array)[pos_y][pos_x_pos] |= pos_x_bit;
706  return FALSE;
707  }
708  void reset()
709  {
710  if (grid_spacing > 0) grid_spacing = -grid_spacing;
711  if (minus_minus_size)
712  {
713  for (U32 i = 0; i < minus_minus_size; i++) if (minus_minus[i]) free(minus_minus[i]);
714  free(minus_minus);
715  minus_minus = 0;
716  free(minus_minus_sizes);
717  minus_minus_sizes = 0;
718  minus_minus_size = 0;
719  }
720  if (minus_plus_size)
721  {
722  free(minus_ankers);
723  minus_ankers = 0;
724  for (U32 i = 0; i < minus_plus_size; i++) if (minus_plus[i]) free(minus_plus[i]);
725  free(minus_plus);
726  minus_plus = 0;
727  free(minus_plus_sizes);
728  minus_plus_sizes = 0;
729  minus_plus_size = 0;
730  }
731  if (plus_minus_size)
732  {
733  for (U32 i = 0; i < plus_minus_size; i++) if (plus_minus[i]) free(plus_minus[i]);
734  free(plus_minus);
735  plus_minus = 0;
736  free(plus_minus_sizes);
737  plus_minus_sizes = 0;
738  plus_minus_size = 0;
739  }
740  if (plus_plus_size)
741  {
742  free(plus_ankers);
743  plus_ankers = 0;
744  for (U32 i = 0; i < plus_plus_size; i++) if (plus_plus[i]) free(plus_plus[i]);
745  free(plus_plus);
746  plus_plus = 0;
747  free(plus_plus_sizes);
748  plus_plus_sizes = 0;
749  plus_plus_size = 0;
750  }
751  };
753  {
754  this->grid_spacing = -grid_spacing;
755  minus_ankers = 0;
756  minus_minus_size = 0;
757  minus_minus = 0;
758  minus_minus_sizes = 0;
759  minus_plus_size = 0;
760  minus_plus = 0;
761  minus_plus_sizes = 0;
762  plus_ankers = 0;
763  plus_minus_size = 0;
764  plus_minus = 0;
765  plus_minus_sizes = 0;
766  plus_plus_size = 0;
767  plus_plus = 0;
768  plus_plus_sizes = 0;
769  };
771 private:
772  F32 grid_spacing;
788 };
789 
791 {
792  U32 i;
793  for (i = 0; i < num_criteria; i++)
794  {
795  delete criteria[i];
796  }
797  if (criteria) delete [] criteria;
798  if (counters) delete [] counters;
799  alloc_criteria = 0;
800  num_criteria = 0;
801  criteria = 0;
802  counters = 0;
803 }
804 
805 void LASfilter::usage() const
806 {
807  fprintf(stderr,"Filter points based on their coordinates.\n");
808  fprintf(stderr," -clip_tile 631000 4834000 1000 (ll_x, ll_y, size)\n");
809  fprintf(stderr," -clip_circle 630250.00 4834750.00 100 (x, y, radius)\n");
810  fprintf(stderr," -clip 630000 4834000 631000 4836000 (min_x, min_y, max_x, max_y)\n");
811  fprintf(stderr," -clip_x_below 630000.50 (min_x)\n");
812  fprintf(stderr," -clip_y_below 4834500.25 (min_y)\n");
813  fprintf(stderr," -clip_x_above 630500.50 (max_x)\n");
814  fprintf(stderr," -clip_y_above 4836000.75 (max_y)\n");
815  fprintf(stderr," -clip_z 11.125 130.725 (min_z, max_z)\n");
816  fprintf(stderr," -clip_z_below 11.125 (min_z)\n");
817  fprintf(stderr," -clip_z_above 130.725 (max_z)\n");
818  fprintf(stderr,"Filter points based on their return number.\n");
819  fprintf(stderr," -first_only -keep_first -drop_first\n");
820  fprintf(stderr," -last_only -keep_last -drop_last\n");
821  fprintf(stderr," -keep_middle -drop_middle\n");
822  fprintf(stderr," -keep_return 1 2 3\n");
823  fprintf(stderr," -drop_return 3 4\n");
824  fprintf(stderr," -keep_single -drop_single\n");
825  fprintf(stderr," -keep_double -drop_double\n");
826  fprintf(stderr," -keep_triple -drop_triple\n");
827  fprintf(stderr," -keep_quadruple -drop_quadruple\n");
828  fprintf(stderr," -keep_quintuple -drop_quintuple\n");
829  fprintf(stderr,"Filter points based on the scanline flags.\n");
830  fprintf(stderr," -drop_scan_direction 0\n");
831  fprintf(stderr," -scan_direction_change_only\n");
832  fprintf(stderr," -edge_of_flight_line_only\n");
833  fprintf(stderr,"Filter points based on their intensity.\n");
834  fprintf(stderr," -keep_intensity 20 380\n");
835  fprintf(stderr," -drop_intensity_below 20\n");
836  fprintf(stderr," -drop_intensity_above 380\n");
837  fprintf(stderr," -drop_intensity_between 4000 5000\n");
838  fprintf(stderr,"Filter points based on their classification.\n");
839  fprintf(stderr," -keep_class 1 3 7\n");
840  fprintf(stderr," -drop_class 4 2\n");
841  fprintf(stderr,"Filter points based on their point source ID.\n");
842  fprintf(stderr," -keep_point_source 3\n");
843  fprintf(stderr," -keep_point_source_between 2 6\n");
844  fprintf(stderr," -drop_point_source_below 6\n");
845  fprintf(stderr," -drop_point_source_above 15\n");
846  fprintf(stderr," -drop_point_source_between 17 21\n");
847  fprintf(stderr,"Filter points based on their scan angle.\n");
848  fprintf(stderr," -keep_scan_angle -15 15\n");
849  fprintf(stderr," -drop_scan_angle_below -15\n");
850  fprintf(stderr," -drop_scan_angle_above 15\n");
851  fprintf(stderr," -drop_scan_angle_between -25 -23\n");
852  fprintf(stderr,"Filter points based on their gps time.\n");
853  fprintf(stderr," -keep_gps_time 11.125 130.725\n");
854  fprintf(stderr," -drop_gps_time_below 11.125\n");
855  fprintf(stderr," -drop_gps_time_above 130.725\n");
856  fprintf(stderr," -drop_gps_time_between 22.0 48.0\n");
857  fprintf(stderr,"Filter points based on their wavepacket.\n");
858  fprintf(stderr," -keep_wavepacket 1 2\n");
859  fprintf(stderr," -drop_wavepacket 0\n");
860  fprintf(stderr,"Filter points with simple thinning.\n");
861  fprintf(stderr," -keep_every_nth 2\n");
862  fprintf(stderr," -keep_random_fraction 0.1\n");
863  fprintf(stderr," -thin_with_grid 1.0\n");
864 }
865 
867 {
868  int i;
869 
870  U32 keep_return_mask = 0;
871  U32 drop_return_mask = 0;
872 
873  U32 keep_classification_mask = 0;
874  U32 drop_classification_mask = 0;
875 
876  U32 keep_wavepacket_mask = 0;
877  U32 drop_wavepacket_mask = 0;
878 
879  for (i = 1; i < argc; i++)
880  {
881  if (argv[i][0] == '\0')
882  {
883  continue;
884  }
885  else if (strcmp(argv[i],"-h") == 0 || strcmp(argv[i],"-help") == 0)
886  {
887  usage();
888  return TRUE;
889  }
890  else if (strcmp(argv[i],"-clip_tile") == 0)
891  {
892  if ((i+3) >= argc)
893  {
894  fprintf(stderr,"ERROR: '%s' needs 3 arguments: llx lly size\n", argv[i]);
895  return FALSE;
896  }
897  add_criterion(new LAScriterionClipTile((F32)atof(argv[i+1]), (F32)atof(argv[i+2]), (F32)atof(argv[i+3])));
898  *argv[i]='\0'; *argv[i+1]='\0'; *argv[i+2]='\0'; *argv[i+3]='\0'; i+=3;
899  }
900  else if (strcmp(argv[i],"-clip_circle") == 0)
901  {
902  if ((i+3) >= argc)
903  {
904  fprintf(stderr,"ERROR: '%s' needs 3 arguments: center_x center_y radius\n", argv[i]);
905  return FALSE;
906  }
907  add_criterion(new LAScriterionClipCircle(atof(argv[i+1]), atof(argv[i+2]), atof(argv[i+3])));
908  *argv[i]='\0'; *argv[i+1]='\0'; *argv[i+2]='\0'; *argv[i+3]='\0'; i+=3;
909  }
910  else if (strcmp(argv[i],"-clip") == 0 || strcmp(argv[i],"-clip_xy") == 0)
911  {
912  if ((i+4) >= argc)
913  {
914  fprintf(stderr,"ERROR: '%s' needs 4 arguments: min_x min_y max_x max_y\n", argv[i]);
915  return FALSE;
916  }
917  add_criterion(new LAScriterionClipXY(atof(argv[i+1]), atof(argv[i+2]), atof(argv[i+3]), atof(argv[i+4])));
918  *argv[i]='\0'; *argv[i+1]='\0'; *argv[i+2]='\0'; *argv[i+3]='\0'; *argv[i+4]='\0'; i+=4;
919  }
920  else if (strcmp(argv[i],"-clip_z") == 0)
921  {
922  if ((i+2) >= argc)
923  {
924  fprintf(stderr,"ERROR: '%s' needs 2 arguments: min_z max_z\n", argv[i]);
925  return FALSE;
926  }
927  add_criterion(new LAScriterionClipZ(atof(argv[i+1]), atof(argv[i+2])));
928  *argv[i]='\0'; *argv[i+1]='\0'; *argv[i+2]='\0'; i+=2;
929  }
930  else if (strcmp(argv[i],"-clip_x_below") == 0)
931  {
932  if ((i+1) >= argc)
933  {
934  fprintf(stderr,"ERROR: '%s' needs 1 argument: min_x\n", argv[i]);
935  return FALSE;
936  }
937  add_criterion(new LAScriterionClipXBelow(atof(argv[i+1])));
938  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
939  }
940  else if (strcmp(argv[i],"-clip_y_below") == 0)
941  {
942  if ((i+1) >= argc)
943  {
944  fprintf(stderr,"ERROR: '%s' needs 1 argument: min_y\n", argv[i]);
945  return FALSE;
946  }
947  add_criterion(new LAScriterionClipYBelow(atof(argv[i+1])));
948  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
949  }
950  else if (strcmp(argv[i],"-clip_z_below") == 0)
951  {
952  if ((i+1) >= argc)
953  {
954  fprintf(stderr,"ERROR: '%s' needs 1 argument: min_z\n", argv[i]);
955  return FALSE;
956  }
957  add_criterion(new LAScriterionClipZBelow(atof(argv[i+1])));
958  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
959  }
960  else if (strcmp(argv[i],"-clip_x_above") == 0)
961  {
962  if ((i+1) >= argc)
963  {
964  fprintf(stderr,"ERROR: '%s' needs 1 argument: max_x\n", argv[i]);
965  return FALSE;
966  }
967  add_criterion(new LAScriterionClipXAbove(atof(argv[i+1])));
968  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
969  }
970  else if (strcmp(argv[i],"-clip_y_above") == 0)
971  {
972  if ((i+1) >= argc)
973  {
974  fprintf(stderr,"ERROR: '%s' needs 1 argument: max_y\n", argv[i]);
975  return FALSE;
976  }
977  add_criterion(new LAScriterionClipYAbove(atof(argv[i+1])));
978  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
979  }
980  else if (strcmp(argv[i],"-clip_z_above") == 0)
981  {
982  if ((i+1) >= argc)
983  {
984  fprintf(stderr,"ERROR: '%s' needs 1 argument: max_z\n", argv[i]);
985  return FALSE;
986  }
987  add_criterion(new LAScriterionClipZAbove(atof(argv[i+1])));
988  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
989  }
990  else if (strcmp(argv[i],"-clip_raw") == 0 || strcmp(argv[i],"-clip_raw_xy") == 0)
991  {
992  if ((i+4) >= argc)
993  {
994  fprintf(stderr,"ERROR: '%s' needs 4 arguments: min_raw_x min_raw_y max_raw_x max_raw_y\n", argv[i]);
995  return FALSE;
996  }
997  add_criterion(new LAScriterionClipRawXY(atoi(argv[i+1]), atoi(argv[i+2]), atoi(argv[i+3]), atoi(argv[i+4])));
998  *argv[i]='\0'; *argv[i+1]='\0'; *argv[i+2]='\0'; *argv[i+3]='\0'; *argv[i+4]='\0'; i+=4;
999  }
1000  else if (strcmp(argv[i],"-clip_raw_z") == 0)
1001  {
1002  if ((i+2) >= argc)
1003  {
1004  fprintf(stderr,"ERROR: '%s' needs 2 arguments: min_raw_z max_raw_z\n", argv[i]);
1005  return FALSE;
1006  }
1007  add_criterion(new LAScriterionClipRawZ(atoi(argv[i+1]), atoi(argv[i+2])));
1008  *argv[i]='\0'; *argv[i+1]='\0'; *argv[i+2]='\0'; i+=2;
1009  }
1010  else if (strcmp(argv[i],"-clip_raw_x_below") == 0)
1011  {
1012  if ((i+1) >= argc)
1013  {
1014  fprintf(stderr,"ERROR: '%s' needs 1 argument: min_raw_x\n", argv[i]);
1015  return FALSE;
1016  }
1017  add_criterion(new LAScriterionClipRawXBelow(atoi(argv[i+1])));
1018  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1019  }
1020  else if (strcmp(argv[i],"-clip_raw_y_below") == 0)
1021  {
1022  if ((i+1) >= argc)
1023  {
1024  fprintf(stderr,"ERROR: '%s' needs 1 argument: min_raw_y\n", argv[i]);
1025  return FALSE;
1026  }
1027  add_criterion(new LAScriterionClipRawYBelow(atoi(argv[i+1])));
1028  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1029  }
1030  else if (strcmp(argv[i],"-clip_raw_z_below") == 0)
1031  {
1032  if ((i+1) >= argc)
1033  {
1034  fprintf(stderr,"ERROR: '%s' needs 1 argument: min_raw_z\n", argv[i]);
1035  return FALSE;
1036  }
1037  add_criterion(new LAScriterionClipRawZBelow(atoi(argv[i+1])));
1038  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1039  }
1040  else if (strcmp(argv[i],"-clip_raw_x_above") == 0)
1041  {
1042  if ((i+1) >= argc)
1043  {
1044  fprintf(stderr,"ERROR: '%s' needs 1 argument: max_raw_x\n", argv[i]);
1045  return FALSE;
1046  }
1047  add_criterion(new LAScriterionClipRawXAbove(atoi(argv[i+1])));
1048  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1049  }
1050  else if (strcmp(argv[i],"-clip_raw_y_above") == 0)
1051  {
1052  if ((i+1) >= argc)
1053  {
1054  fprintf(stderr,"ERROR: '%s' needs 1 argument: max_raw_y\n", argv[i]);
1055  return FALSE;
1056  }
1057  add_criterion(new LAScriterionClipRawYAbove(atoi(argv[i+1])));
1058  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1059  }
1060  else if (strcmp(argv[i],"-clip_raw_z_above") == 0)
1061  {
1062  if ((i+1) >= argc)
1063  {
1064  fprintf(stderr,"ERROR: '%s' needs 1 argument: max_raw_z\n", argv[i]);
1065  return FALSE;
1066  }
1067  add_criterion(new LAScriterionClipRawZAbove(atoi(argv[i+1])));
1068  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1069  }
1070  else if ((strcmp(argv[i],"-first_only") == 0) || (strcmp(argv[i],"-keep_first") == 0))
1071  {
1072  add_criterion(new LAScriterionKeepFirstReturn());
1073  *argv[i]='\0';
1074  }
1075  else if (strcmp(argv[i],"-keep_middle") == 0)
1076  {
1077  add_criterion(new LAScriterionKeepMiddleReturn());
1078  *argv[i]='\0';
1079  }
1080  else if ((strcmp(argv[i],"-last_only") == 0) || (strcmp(argv[i],"-keep_last") == 0))
1081  {
1082  add_criterion(new LAScriterionKeepLastReturn());
1083  *argv[i]='\0';
1084  }
1085  else if (strcmp(argv[i],"-drop_first") == 0)
1086  {
1087  add_criterion(new LAScriterionDropFirstReturn());
1088  *argv[i]='\0';
1089  }
1090  else if (strcmp(argv[i],"-drop_middle") == 0)
1091  {
1092  add_criterion(new LAScriterionDropMiddleReturn());
1093  *argv[i]='\0';
1094  }
1095  else if (strcmp(argv[i],"-drop_last") == 0)
1096  {
1097  add_criterion(new LAScriterionDropLastReturn());
1098  *argv[i]='\0';
1099  }
1100  else if (strcmp(argv[i],"-keep_return") == 0)
1101  {
1102  if ((i+1) >= argc)
1103  {
1104  fprintf(stderr,"ERROR: '%s' needs at least 1 argument: return_number\n", argv[i]);
1105  return FALSE;
1106  }
1107  *argv[i]='\0';
1108  i+=1;
1109  do
1110  {
1111  keep_return_mask |= (1 << atoi(argv[i]));
1112  *argv[i]='\0';
1113  i+=1;
1114  } while ((i < argc) && ('0' <= *argv[i]) && (*argv[i] <= '9'));
1115  i-=1;
1116  }
1117  else if (strcmp(argv[i],"-keep_return_mask") == 0)
1118  {
1119  if ((i+1) >= argc)
1120  {
1121  fprintf(stderr,"ERROR: '%s' needs 1 argument: return_mask\n", argv[i]);
1122  return FALSE;
1123  }
1124  keep_return_mask = atoi(argv[i+1]);
1125  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1126  }
1127  else if (strcmp(argv[i],"-drop_return") == 0)
1128  {
1129  if ((i+1) >= argc)
1130  {
1131  fprintf(stderr,"ERROR: '%s' needs at least 1 argument: return_number\n", argv[i]);
1132  return FALSE;
1133  }
1134  *argv[i]='\0';
1135  i+=1;
1136  do
1137  {
1138  drop_return_mask |= (1 << atoi(argv[i]));
1139  *argv[i]='\0';
1140  i+=1;
1141  } while ((i < argc) && ('0' <= *argv[i]) && (*argv[i] <= '9'));
1142  i-=1;
1143  }
1144  else if (strcmp(argv[i],"-keep_single") == 0 || strcmp(argv[i],"-single_only") == 0)
1145  {
1146  add_criterion(new LAScriterionKeepSpecificNumberOfReturns(1));
1147  *argv[i]='\0';
1148  }
1149  else if (strcmp(argv[i],"-keep_double") == 0 || strcmp(argv[i],"-double_only") == 0)
1150  {
1151  add_criterion(new LAScriterionKeepSpecificNumberOfReturns(2));
1152  *argv[i]='\0';
1153  }
1154  else if (strcmp(argv[i],"-keep_triple") == 0 || strcmp(argv[i],"-triple_only") == 0)
1155  {
1156  add_criterion(new LAScriterionKeepSpecificNumberOfReturns(3));
1157  *argv[i]='\0';
1158  }
1159  else if (strcmp(argv[i],"-keep_quadruple") == 0 || strcmp(argv[i],"-quadruple_only") == 0)
1160  {
1161  add_criterion(new LAScriterionKeepSpecificNumberOfReturns(4));
1162  *argv[i]='\0';
1163  }
1164  else if (strcmp(argv[i],"-keep_quintuple") == 0 || strcmp(argv[i],"-quintuple_only") == 0)
1165  {
1166  add_criterion(new LAScriterionKeepSpecificNumberOfReturns(5));
1167  *argv[i]='\0';
1168  }
1169  else if (strcmp(argv[i],"-drop_single") == 0)
1170  {
1171  add_criterion(new LAScriterionDropSpecificNumberOfReturns(1));
1172  *argv[i]='\0';
1173  }
1174  else if (strcmp(argv[i],"-drop_double") == 0)
1175  {
1176  add_criterion(new LAScriterionDropSpecificNumberOfReturns(2));
1177  *argv[i]='\0';
1178  }
1179  else if (strcmp(argv[i],"-drop_triple") == 0)
1180  {
1181  add_criterion(new LAScriterionDropSpecificNumberOfReturns(3));
1182  *argv[i]='\0';
1183  }
1184  else if (strcmp(argv[i],"-drop_quadruple") == 0)
1185  {
1186  add_criterion(new LAScriterionDropSpecificNumberOfReturns(4));
1187  *argv[i]='\0';
1188  }
1189  else if (strcmp(argv[i],"-drop_quintuple") == 0)
1190  {
1191  add_criterion(new LAScriterionDropSpecificNumberOfReturns(5));
1192  *argv[i]='\0';
1193  }
1194  else if (strcmp(argv[i],"-drop_scan_direction") == 0)
1195  {
1196  add_criterion(new LAScriterionDropScanDirection(atoi(argv[i+1])));
1197  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1198  }
1199  else if (strcmp(argv[i],"-scan_direction_change_only") == 0 || strcmp(argv[i],"-scan_direction_change") == 0)
1200  {
1201  add_criterion(new LAScriterionScanDirectionChangeOnly());
1202  *argv[i]='\0';
1203  }
1204  else if (strcmp(argv[i],"-edge_of_flight_line_only") == 0 || strcmp(argv[i],"-edge_of_flight_line") == 0)
1205  {
1206  add_criterion(new LAScriterionEdgeOfFlightLineOnly());
1207  *argv[i]='\0';
1208  }
1209  else if (strcmp(argv[i],"-keep_intensity") == 0)
1210  {
1211  if ((i+2) >= argc)
1212  {
1213  fprintf(stderr,"ERROR: '%s' needs 2 arguments: min max\n", argv[i]);
1214  return FALSE;
1215  }
1216  add_criterion(new LAScriterionKeepIntensity(atoi(argv[i+1]), atoi(argv[i+2])));
1217  *argv[i]='\0'; *argv[i+1]='\0'; *argv[i+2]='\0'; i+=2;
1218  }
1219  else if (strcmp(argv[i],"-drop_intensity_above") == 0)
1220  {
1221  if ((i+1) >= argc)
1222  {
1223  fprintf(stderr,"ERROR: '%s' needs 1 argument: max\n", argv[i]);
1224  return FALSE;
1225  }
1226  add_criterion(new LAScriterionDropIntensityAbove(atoi(argv[i+1])));
1227  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1228  }
1229  else if (strcmp(argv[i],"-drop_intensity_below") == 0)
1230  {
1231  if ((i+1) >= argc)
1232  {
1233  fprintf(stderr,"ERROR: '%s' needs 1 argument: min\n", argv[i]);
1234  return FALSE;
1235  }
1236  add_criterion(new LAScriterionDropIntensityBelow(atoi(argv[i+1])));
1237  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1238  }
1239  else if (strcmp(argv[i],"-drop_intensity_between") == 0)
1240  {
1241  if ((i+2) >= argc)
1242  {
1243  fprintf(stderr,"ERROR: '%s' needs 2 arguments: min max\n", argv[i]);
1244  return FALSE;
1245  }
1246  add_criterion(new LAScriterionDropIntensityBetween(atoi(argv[i+1]), atoi(argv[i+2])));
1247  *argv[i]='\0'; *argv[i+1]='\0'; *argv[i+2]='\0'; i+=2;
1248  }
1249  else if (strcmp(argv[i],"-keep_scan_angle") == 0 || strcmp(argv[i],"-keep_scan") == 0)
1250  {
1251  if ((i+2) >= argc)
1252  {
1253  fprintf(stderr,"ERROR: '%s' needs 2 arguments: min max\n", argv[i]);
1254  return FALSE;
1255  }
1256  add_criterion(new LAScriterionKeepScanAngle(atoi(argv[i+1]), atoi(argv[i+2])));
1257  *argv[i]='\0'; *argv[i+1]='\0'; *argv[i+2]='\0'; i+=2;
1258  }
1259  else if (strcmp(argv[i],"-drop_scan_angle_above") == 0 || strcmp(argv[i],"-drop_scan_above") == 0)
1260  {
1261  if ((i+1) >= argc)
1262  {
1263  fprintf(stderr,"ERROR: '%s' needs 1 argument: max\n", argv[i]);
1264  return FALSE;
1265  }
1266  add_criterion(new LAScriterionDropScanAngleAbove(atoi(argv[i+1])));
1267  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1268  }
1269  else if (strcmp(argv[i],"-drop_scan_angle_below") == 0 || strcmp(argv[i],"-drop_scan_below") == 0)
1270  {
1271  if ((i+1) >= argc)
1272  {
1273  fprintf(stderr,"ERROR: '%s' needs 1 argument: min\n", argv[i]);
1274  return FALSE;
1275  }
1276  add_criterion(new LAScriterionDropScanAngleBelow(atoi(argv[i+1])));
1277  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1278  }
1279  else if (strcmp(argv[i],"-drop_scan_angle_between") == 0 || strcmp(argv[i],"-drop_scan_between") == 0)
1280  {
1281  if ((i+2) >= argc)
1282  {
1283  fprintf(stderr,"ERROR: '%s' needs 2 arguments: min max\n", argv[i]);
1284  return FALSE;
1285  }
1286  add_criterion(new LAScriterionDropScanAngleBetween(atoi(argv[i+1]), atoi(argv[i+2])));
1287  *argv[i]='\0'; *argv[i+1]='\0'; *argv[i+2]='\0'; i+=2;
1288  }
1289  else if (strcmp(argv[i],"-keep_classification") == 0 || strcmp(argv[i],"-keep_class") == 0)
1290  {
1291  if ((i+1) >= argc)
1292  {
1293  fprintf(stderr,"ERROR: '%s' needs 1 at least argument: classification\n", argv[i]);
1294  return FALSE;
1295  }
1296  *argv[i]='\0';
1297  i+=1;
1298  do
1299  {
1300  keep_classification_mask |= (1 << atoi(argv[i]));
1301  *argv[i]='\0';
1302  i+=1;
1303  } while ((i < argc) && ('0' <= *argv[i]) && (*argv[i] <= '9'));
1304  i-=1;
1305  }
1306  else if (strcmp(argv[i],"-keep_classification_mask") == 0)
1307  {
1308  if ((i+1) >= argc)
1309  {
1310  fprintf(stderr,"ERROR: '%s' needs 1 argument: classifications_mask\n", argv[i]);
1311  return FALSE;
1312  }
1313  keep_classification_mask = atoi(argv[i+1]);
1314  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1315  }
1316  else if (strcmp(argv[i],"-drop_classification") == 0 || strcmp(argv[i],"-drop_class") == 0)
1317  {
1318  if ((i+1) >= argc)
1319  {
1320  fprintf(stderr,"ERROR: '%s' needs at least 1 argument: classification\n", argv[i]);
1321  return FALSE;
1322  }
1323  *argv[i]='\0';
1324  i+=1;
1325  do
1326  {
1327  drop_classification_mask |= (1 << atoi(argv[i]));
1328  *argv[i]='\0';
1329  i+=1;
1330  } while ((i < argc) && ('0' <= *argv[i]) && (*argv[i] <= '9'));
1331  i-=1;
1332  }
1333  else if (strcmp(argv[i],"-keep_wavepacket") == 0)
1334  {
1335  if ((i+1) >= argc)
1336  {
1337  fprintf(stderr,"ERROR: '%s' needs 1 at least argument: index\n", argv[i]);
1338  return FALSE;
1339  }
1340  *argv[i]='\0';
1341  i+=1;
1342  do
1343  {
1344  keep_wavepacket_mask |= (1 << atoi(argv[i]));
1345  *argv[i]='\0';
1346  i+=1;
1347  } while ((i < argc) && ('0' <= *argv[i]) && (*argv[i] <= '9'));
1348  i-=1;
1349  }
1350  else if (strcmp(argv[i],"-drop_wavepacket") == 0)
1351  {
1352  if ((i+1) >= argc)
1353  {
1354  fprintf(stderr,"ERROR: '%s' needs at least 1 argument: index\n", argv[i]);
1355  return FALSE;
1356  }
1357  *argv[i]='\0';
1358  i+=1;
1359  do
1360  {
1361  drop_wavepacket_mask |= (1 << atoi(argv[i]));
1362  *argv[i]='\0';
1363  i+=1;
1364  } while ((i < argc) && ('0' <= *argv[i]) && (*argv[i] <= '9'));
1365  i-=1;
1366  }
1367  else if (strcmp(argv[i],"-keep_point_source") == 0)
1368  {
1369  if ((i+1) >= argc)
1370  {
1371  fprintf(stderr,"ERROR: '%s' needs 1 argument: ID\n", argv[i]);
1372  return FALSE;
1373  }
1374  add_criterion(new LAScriterionKeepPointSource(atoi(argv[i+1])));
1375  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1376  }
1377  else if (strcmp(argv[i],"-keep_point_source_between") == 0)
1378  {
1379  if ((i+2) >= argc)
1380  {
1381  fprintf(stderr,"ERROR: '%s' needs 2 arguments: min_ID max_ID\n", argv[i]);
1382  return FALSE;
1383  }
1384  add_criterion(new LAScriterionKeepPointSourceBetween(atoi(argv[i+1]), atoi(argv[i+2])));
1385  *argv[i]='\0'; *argv[i+1]='\0'; *argv[i+2]='\0'; i+=2;
1386  }
1387  else if (strcmp(argv[i],"-drop_point_source_below") == 0)
1388  {
1389  if ((i+1) >= argc)
1390  {
1391  fprintf(stderr,"ERROR: '%s' needs 1 argument: min_ID\n", argv[i]);
1392  return FALSE;
1393  }
1394  add_criterion(new LAScriterionDropPointSourceBelow(atoi(argv[i+1])));
1395  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1396  }
1397  else if (strcmp(argv[i],"-drop_point_source_above") == 0)
1398  {
1399  if ((i+1) >= argc)
1400  {
1401  fprintf(stderr,"ERROR: '%s' needs 1 argument: max_ID\n", argv[i]);
1402  return FALSE;
1403  }
1404  add_criterion(new LAScriterionDropPointSourceAbove(atoi(argv[i+1])));
1405  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1406  }
1407  else if (strcmp(argv[i],"-drop_point_source_between") == 0)
1408  {
1409  if ((i+2) >= argc)
1410  {
1411  fprintf(stderr,"ERROR: '%s' needs 2 arguments: min_ID max_ID\n", argv[i]);
1412  return FALSE;
1413  }
1414  add_criterion(new LAScriterionDropPointSourceBetween(atoi(argv[i+1]), atoi(argv[i+2])));
1415  *argv[i]='\0'; *argv[i+1]='\0'; *argv[i+2]='\0'; i+=2;
1416  }
1417  else if (strcmp(argv[i],"-keep_gps_time") == 0 || strcmp(argv[i],"-keep_gpstime") == 0)
1418  {
1419  if ((i+2) >= argc)
1420  {
1421  fprintf(stderr,"ERROR: '%s' needs 2 arguments: min max\n", argv[i]);
1422  return FALSE;
1423  }
1424  add_criterion(new LAScriterionKeepGpsTime(atof(argv[i+1]), atof(argv[i+2])));
1425  *argv[i]='\0'; *argv[i+1]='\0'; *argv[i+2]='\0'; i+=2;
1426  }
1427  else if (strcmp(argv[i],"-drop_gps_time_above") == 0 || strcmp(argv[i],"-drop_gpstime_above") == 0)
1428  {
1429  if ((i+1) >= argc)
1430  {
1431  fprintf(stderr,"ERROR: '%s' needs 1 argument: max_gps_time\n", argv[i]);
1432  return FALSE;
1433  }
1434  add_criterion(new LAScriterionDropGpsTimeAbove(atof(argv[i+1])));
1435  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1436  }
1437  else if (strcmp(argv[i],"-drop_gps_time_below") == 0 || strcmp(argv[i],"-drop_gpstime_below") == 0)
1438  {
1439  if ((i+1) >= argc)
1440  {
1441  fprintf(stderr,"ERROR: '%s' needs 1 argument: min_gps_time\n", argv[i]);
1442  return FALSE;
1443  }
1444  add_criterion(new LAScriterionDropGpsTimeBelow(atof(argv[i+1])));
1445  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1446  }
1447  else if (strcmp(argv[i],"-drop_gps_time_between") == 0 || strcmp(argv[i],"-drop_gpstime_between") == 0)
1448  {
1449  if ((i+2) >= argc)
1450  {
1451  fprintf(stderr,"ERROR: '%s' needs 2 arguments: min max\n", argv[i]);
1452  return FALSE;
1453  }
1454  add_criterion(new LAScriterionDropGpsTimeBetween(atof(argv[i+1]), atof(argv[i+2])));
1455  *argv[i]='\0'; *argv[i+1]='\0'; *argv[i+2]='\0'; i+=2;
1456  }
1457  else if (strcmp(argv[i],"-keep_every_nth") == 0)
1458  {
1459  if ((i+1) >= argc)
1460  {
1461  fprintf(stderr,"ERROR: '%s' needs 1 argument: nth\n", argv[i]);
1462  return FALSE;
1463  }
1464  add_criterion(new LAScriterionKeepEveryNth((I32)atoi(argv[i+1])));
1465  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1466  }
1467  else if (strcmp(argv[i],"-keep_random_fraction") == 0)
1468  {
1469  if ((i+1) >= argc)
1470  {
1471  fprintf(stderr,"ERROR: '%s' needs 1 argument: fraction\n", argv[i]);
1472  return FALSE;
1473  }
1474  add_criterion(new LAScriterionKeepRandomFraction((F32)atof(argv[i+1])));
1475  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1476  }
1477  else if (strcmp(argv[i],"-thin_with_grid") == 0)
1478  {
1479  if ((i+1) >= argc)
1480  {
1481  fprintf(stderr,"ERROR: '%s' needs 1 argument: grid_spacing\n", argv[i]);
1482  return FALSE;
1483  }
1484  add_criterion(new LAScriterionThinWithGrid((F32)atof(argv[i+1])));
1485  *argv[i]='\0'; *argv[i+1]='\0'; i+=1;
1486  }
1487  }
1488 
1489  if (drop_return_mask)
1490  {
1491  if (keep_return_mask == 0) keep_return_mask = 255 & ~drop_return_mask;
1492  }
1493  if (keep_return_mask) add_criterion(new LAScriterionKeepReturns(keep_return_mask));
1494 
1495  if (drop_classification_mask)
1496  {
1497  if (keep_classification_mask == 0) keep_classification_mask = ~drop_classification_mask;
1498  }
1499  if (keep_classification_mask) add_criterion(new LAScriterionKeepClassifications(keep_classification_mask));
1500 
1501  if (drop_wavepacket_mask)
1502  {
1503  if (keep_wavepacket_mask == 0) keep_wavepacket_mask = ~drop_wavepacket_mask;
1504  }
1505  if (keep_wavepacket_mask) add_criterion(new LAScriterionKeepWavepackets(keep_wavepacket_mask));
1506 
1507  return TRUE;
1508 }
1509 
1510 I32 LASfilter::unparse(char* string) const
1511 {
1512  U32 i;
1513  I32 n = 0;
1514  for (i = 0; i < num_criteria; i++)
1515  {
1516  n += criteria[i]->get_command(&string[n]);
1517  }
1518  return n;
1519 }
1520 
1522 {
1523  add_criterion(new LAScriterionClipCircle(x, y, radius));
1524 }
1525 
1527 {
1528  add_criterion(new LAScriterionScanDirectionChangeOnly());
1529 }
1530 
1532 {
1533  U32 i;
1534 
1535  for (i = 0; i < num_criteria; i++)
1536  {
1537  if (criteria[i]->filter(point))
1538  {
1539  counters[i]++;
1540  return TRUE; // point was filtered
1541  }
1542  }
1543  return FALSE; // point survived
1544 }
1545 
1547 {
1548  U32 i;
1549  for (i = 0; i < num_criteria; i++)
1550  {
1551  criteria[i]->reset();
1552  }
1553 }
1554 
1556 {
1557  alloc_criteria = 0;
1558  num_criteria = 0;
1559  criteria = 0;
1560  counters = 0;
1561 }
1562 
1564 {
1565  if (criteria) clean();
1566 }
1567 
1569 {
1570  if (num_criteria == alloc_criteria)
1571  {
1572  U32 i;
1573  alloc_criteria += 16;
1574  LAScriterion** temp_criteria = new LAScriterion*[alloc_criteria];
1575  int* temp_counters = new int[alloc_criteria];
1576  if (criteria)
1577  {
1578  for (i = 0; i < num_criteria; i++)
1579  {
1580  temp_criteria[i] = criteria[i];
1581  temp_counters[i] = counters[i];
1582  }
1583  delete [] criteria;
1584  delete [] counters;
1585  }
1586  criteria = temp_criteria;
1587  counters = temp_counters;
1588  }
1589  criteria[num_criteria] = filter_criterion;
1590  counters[num_criteria] = 0;
1591  num_criteria++;
1592 }
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:396
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:352
LAScriterionClipRawXY(I32 below_x, I32 below_y, I32 above_x, I32 above_y)
Definition: lasfilter.cpp:153
LAScriterionKeepEveryNth(I32 every)
Definition: lasfilter.cpp:562
const char * name() const
Definition: lasfilter.cpp:161
int get_command(char *string) const
Definition: lasfilter.cpp:560
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:174
int get_command(char *string) const
Definition: lasfilter.cpp:96
LAScriterionKeepReturns(U32 keep_return_mask)
Definition: lasfilter.cpp:289
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:196
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:584
LAScriterionClipZAbove(F64 above_z)
Definition: lasfilter.cpp:142
void addScanDirectionChangeOnly()
Definition: lasfilter.cpp:1526
LAScriterionKeepIntensity(I32 below_intensity, I32 above_intensity)
Definition: lasfilter.cpp:397
U8 edge_of_flight_line
LAScriterionClipYAbove(F64 above_y)
Definition: lasfilter.cpp:120
int BOOL
Definition: mydefs.hpp:57
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:1531
int get_command(char *string) const
Definition: lasfilter.cpp:74
const char * name() const
Definition: lasfilter.cpp:205
const char * name() const
Definition: lasfilter.cpp:286
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:429
const char * name() const
Definition: lasfilter.cpp:95
LAScriterionDropPointSourceBetween(I32 below_point_source_id, I32 above_point_source_id)
Definition: lasfilter.cpp:496
const char * name() const
Definition: lasfilter.cpp:548
#define FALSE
Definition: mydefs.hpp:133
int get_command(char *string) const
Definition: lasfilter.cpp:151
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:528
const char * name() const
Definition: lasfilter.cpp:427
LAScriterionDropIntensityBelow(I32 below_intensity)
Definition: lasfilter.cpp:408
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:418
void addClipCircle(F64 x, F64 y, F64 radius)
Definition: lasfilter.cpp:1521
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:248
int get_command(char *string) const
Definition: lasfilter.cpp:538
const char * name() const
Definition: lasfilter.cpp:117
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:517
void clean()
Definition: lasfilter.cpp:790
const char * name() const
Definition: lasfilter.cpp:504
float F32
Definition: mydefs.hpp:51
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:462
LAScriterionClipRawZBelow(I32 below_z)
Definition: lasfilter.cpp:219
int get_command(char *string) const
Definition: lasfilter.cpp:140
int get_command(char *string) const
Definition: lasfilter.cpp:239
int get_command(char *string) const
Definition: lasfilter.cpp:184
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:451
int get_command(char *string) const
Definition: lasfilter.cpp:439
int get_command(char *string) const
Definition: lasfilter.cpp:428
LAScriterionDropIntensityBetween(I32 below_intensity, I32 above_intensity)
Definition: lasfilter.cpp:430
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:407
int get_command(char *string) const
Definition: lasfilter.cpp:483
const char * name() const
Definition: lasfilter.cpp:559
int get_command(char *string) const
Definition: lasfilter.cpp:494
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:141
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:229
int get_command(char *string) const
Definition: lasfilter.cpp:516
LAScriterionDropScanAngleBetween(I32 below_scan, I32 above_scan)
Definition: lasfilter.cpp:386
int get_command(char *string) const
Definition: lasfilter.cpp:572
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:97
int get_command(char *string) const
Definition: lasfilter.cpp:309
int get_command(char *string) const
Definition: lasfilter.cpp:351
int get_command(char *string) const
Definition: lasfilter.cpp:195
LAScriterionClipXBelow(F64 below_x)
Definition: lasfilter.cpp:87
LAScriterionDropGpsTimeBelow(F64 below_gpstime)
Definition: lasfilter.cpp:518
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:264
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:163
LAScriterionClipRawZAbove(I32 above_z)
Definition: lasfilter.cpp:230
LAScriterionClipZBelow(F64 below_z)
Definition: lasfilter.cpp:131
unsigned int U32
Definition: mydefs.hpp:39
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:272
int get_command(char *string) const
Definition: lasfilter.cpp:395
const char * name() const
Definition: lasfilter.cpp:342
U8 scan_direction_flag
LAScriterionDropScanAngleAbove(I32 above_scan)
Definition: lasfilter.cpp:375
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:185
F64 get_y() const
const char * name() const
Definition: lasfilter.cpp:416
LAScriterionKeepPointSourceBetween(I32 below_point_source_id, I32 above_point_source_id)
Definition: lasfilter.cpp:463
BOOL inside_rectangle(const F64 r_min_x, const F64 r_min_y, const F64 r_max_x, const F64 r_max_y) const
const char * name() const
Definition: lasfilter.cpp:128
LAScriterionThinWithGrid(F32 grid_spacing)
Definition: lasfilter.cpp:752
const char * name() const
Definition: lasfilter.cpp:73
LAScriterionClipTile(F32 ll_x, F32 ll_y, F32 tile_size)
Definition: lasfilter.cpp:43
int get_command(char *string) const
Definition: lasfilter.cpp:505
int get_command(char *string) const
Definition: lasfilter.cpp:384
BOOL have_gps_time
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:374
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:363
int get_command(char *string) const
Definition: lasfilter.cpp:461
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:506
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:550
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:484
int get_command(char *string) const
Definition: lasfilter.cpp:85
const char * name() const
Definition: lasfilter.cpp:582
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:299
unsigned short U16
Definition: mydefs.hpp:40
int get_command(char *string) const
Definition: lasfilter.cpp:162
LAScriterionClipRawXAbove(I32 above_x)
Definition: lasfilter.cpp:186
LAScriterionClipRawZ(I32 below_z, I32 above_z)
Definition: lasfilter.cpp:164
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:280
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:130
const char * name() const
Definition: lasfilter.cpp:62
int get_command(char *string) const
Definition: lasfilter.cpp:173
int get_command(char *string) const
Definition: lasfilter.cpp:527
LAScriterionDropScanAngleBelow(I32 below_scan)
Definition: lasfilter.cpp:364
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:573
LAScriterionClipXY(F64 below_x, F64 below_y, F64 above_x, F64 above_y)
Definition: lasfilter.cpp:65
LAScriterionDropIntensityAbove(I32 above_intensity)
Definition: lasfilter.cpp:419
int get_command(char *string) const
Definition: lasfilter.cpp:406
const char * name() const
Definition: lasfilter.cpp:194
const char * name() const
Definition: lasfilter.cpp:254
int get_command(char *string) const
Definition: lasfilter.cpp:63
const char * name() const
Definition: lasfilter.cpp:227
int get_command(char *string) const
Definition: lasfilter.cpp:118
LASwavepacket wavepacket
int get_command(char *string) const
Definition: lasfilter.cpp:549
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:119
const char * name() const
Definition: lasfilter.cpp:449
const char * name() const
Definition: lasfilter.cpp:394
F64 get_x() const
U8 getIndex() const
BOOL parse(int argc, char *argv[])
Definition: lasfilter.cpp:866
BOOL inside_circle(const F64 center_x, const F64 center_y, F64 squared_radius) const
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:86
int get_command(char *string) const
Definition: lasfilter.cpp:298
int get_command(char *string) const
Definition: lasfilter.cpp:320
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:218
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:321
int get_command(char *string) const
Definition: lasfilter.cpp:271
int get_command(char *string) const
Definition: lasfilter.cpp:247
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:385
int get_command(char *string) const
Definition: lasfilter.cpp:417
const char * name() const
Definition: lasfilter.cpp:350
const char * name() const
Definition: lasfilter.cpp:262
LAScriterionClipZ(F64 below_z, F64 above_z)
Definition: lasfilter.cpp:76
const char * name() const
Definition: lasfilter.cpp:84
const char * name() const
Definition: lasfilter.cpp:270
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:539
const char * name() const
Definition: lasfilter.cpp:238
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:152
const char * name() const
Definition: lasfilter.cpp:172
LAScriterionClipRawYAbove(I32 above_y)
Definition: lasfilter.cpp:208
int get_command(char *string) const
Definition: lasfilter.cpp:228
const char * name() const
Definition: lasfilter.cpp:383
int get_command(char *string) const
Definition: lasfilter.cpp:41
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:310
LAScriterionClipXAbove(F64 above_x)
Definition: lasfilter.cpp:98
const char * name() const
Definition: lasfilter.cpp:40
int get_command(char *string) const
Definition: lasfilter.cpp:362
LAScriterionKeepGpsTime(F64 below_gpstime, F64 above_gpstime)
Definition: lasfilter.cpp:507
int unparse(char *string) const
Definition: lasfilter.cpp:1510
const char * name() const
Definition: lasfilter.cpp:537
LAScriterionClipRawXBelow(I32 below_x)
Definition: lasfilter.cpp:175
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:332
int I32
Definition: mydefs.hpp:35
LAScriterionKeepRandomFraction(F32 fraction)
Definition: lasfilter.cpp:574
const char * name() const
Definition: lasfilter.cpp:515
int get_command(char *string) const
Definition: lasfilter.cpp:343
int get_command(char *string) const
Definition: lasfilter.cpp:331
int get_command(char *string) const
Definition: lasfilter.cpp:279
void usage() const
Definition: lasfilter.cpp:805
LAScriterionDropPointSourceAbove(I32 above_point_source_id)
Definition: lasfilter.cpp:485
LAScriterionKeepClassifications(U32 keep_classification_mask)
Definition: lasfilter.cpp:441
const char * name() const
Definition: lasfilter.cpp:216
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:440
LAScriterionDropPointSourceBelow(I32 below_point_source_id)
Definition: lasfilter.cpp:474
int get_command(char *string) const
Definition: lasfilter.cpp:52
LAScriterionClipRawYBelow(I32 below_y)
Definition: lasfilter.cpp:197
void reset()
Definition: lasfilter.cpp:1546
BOOL inside_tile(const F32 ll_x, const F32 ll_y, const F32 ur_x, const F32 ur_y) const
int get_command(char *string) const
Definition: lasfilter.cpp:472
LAScriterionDropGpsTimeBetween(F64 below_gpstime, F64 above_gpstime)
Definition: lasfilter.cpp:540
const char * name() const
Definition: lasfilter.cpp:482
const char * name() const
Definition: lasfilter.cpp:405
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:344
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:108
const char * name() const
Definition: lasfilter.cpp:183
void add_criterion(LAScriterion *criterion)
Definition: lasfilter.cpp:1568
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:207
int get_command(char *string) const
Definition: lasfilter.cpp:255
F64 get_z() const
const char * name() const
Definition: lasfilter.cpp:106
#define I32_FLOOR(n)
Definition: mydefs.hpp:118
LAScriterionKeepScanAngle(I32 below_scan, I32 above_scan)
Definition: lasfilter.cpp:353
int get_command(char *string) const
Definition: lasfilter.cpp:287
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:53
int get_command(char *string) const
Definition: lasfilter.cpp:107
const char * name() const
Definition: lasfilter.cpp:571
int get_command(char *string) const
Definition: lasfilter.cpp:217
const char * name() const
Definition: lasfilter.cpp:51
int get_command(char *string) const
Definition: lasfilter.cpp:129
int get_command(char *string) const
Definition: lasfilter.cpp:263
const char * name() const
Definition: lasfilter.cpp:526
#define TRUE
Definition: mydefs.hpp:137
const char * name() const
Definition: lasfilter.cpp:372
LAScriterionKeepWavepackets(U32 keep_wavepacket_mask)
Definition: lasfilter.cpp:551
int get_command(char *string) const
Definition: lasfilter.cpp:373
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:75
const char * name() const
Definition: lasfilter.cpp:150
int get_command(char *string) const
Definition: lasfilter.cpp:450
const char * name() const
Definition: lasfilter.cpp:471
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:42
LAScriterionDropGpsTimeAbove(F64 above_gpstime)
Definition: lasfilter.cpp:529
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:561
const char * name() const
Definition: lasfilter.cpp:246
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:64
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:288
const char * name() const
Definition: lasfilter.cpp:438
int get_command(char *string) const
Definition: lasfilter.cpp:206
virtual void reset()
Definition: lasfilter.hpp:42
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:495
const char * name() const
Definition: lasfilter.cpp:139
const char * name() const
Definition: lasfilter.cpp:361
int get_command(char *string) const
Definition: lasfilter.cpp:583
const char * name() const
Definition: lasfilter.cpp:319
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:473
double F64
Definition: mydefs.hpp:52
U8 number_of_returns_of_given_pulse
const char * name() const
Definition: lasfilter.cpp:278
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:256
BOOL filter(const LASpoint *point)
Definition: lasfilter.cpp:240
char ** argv
LAScriterionClipYBelow(F64 below_y)
Definition: lasfilter.cpp:109


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:07