Skip to content

Commit 1f627af

Browse files
committed
Add nan point check to applyFilter
1 parent e55da98 commit 1f627af

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

filters/include/pcl/filters/experimental/transform_filter.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#pragma once
1111

12+
#include <pcl/common/point_tests.h>
1213
#include <pcl/filters/experimental/grid_filter_base.h>
1314

1415
namespace pcl {
@@ -28,8 +29,8 @@ namespace experimental {
2829
* Requirements of the grid structure:
2930
* 1. Three member functions (setUp, addPointToGrid, filterGrid) the grid structure are
3031
* called in applyFilter and thus required to declare.
31-
* 2. A Grid member attribute is required, it can be any type with built-in iterator,
32-
* e.g. STL container or custom grid with iterator
32+
* 2. A Grid member attribute is required, it can be any type with built-in iterator
33+
* and size() function, e.g. STL container or custom grid with iterator
3334
* \ingroup filters
3435
*/
3536
template <typename GridStruct, typename PointT = GET_POINT_TYPE(GridStruct)>
@@ -79,9 +80,12 @@ class TransformFilter : public GridFilterBase<PointT>, public GridStruct {
7980
}
8081

8182
for (const auto& pt : *input_) {
82-
GridStruct::addPointToGrid(pt);
83+
if (input_->is_dense || isXYZFinite(pt)) {
84+
GridStruct::addPointToGrid(pt);
85+
}
8386
}
8487

88+
output.reserve(GridStruct::grid_.size());
8589
for (auto it = GridStruct::grid_.begin(); it != GridStruct::grid_.end(); ++it) {
8690
const auto& res = GridStruct::filterGrid(it);
8791
if (res) {

0 commit comments

Comments
 (0)