38 #ifndef PCL_FILTERS_IMPL_RANDOM_SAMPLE_H_
39 #define PCL_FILTERS_IMPL_RANDOM_SAMPLE_H_
41 #include <pcl/filters/random_sample.h>
45 template<
typename Po
intT>
49 std::size_t N = indices_->size ();
50 std::size_t sample_size = negative_ ? N - sample_ : sample_;
56 removed_indices_->clear ();
61 indices.resize (sample_size);
62 if (extract_removed_indices_)
63 removed_indices_->resize (N - sample_size);
70 std::size_t index = 0;
71 std::vector<bool> added;
72 if (extract_removed_indices_)
73 added.resize (indices_->size (),
false);
74 std::size_t n = sample_size;
78 const float U = unifRand ();
83 if (extract_removed_indices_)
85 indices[i++] = (*indices_)[index];
96 if (extract_removed_indices_)
99 for (std::size_t i = 0; i < added.size (); i++)
103 (*removed_indices_)[ri++] = (*indices_)[i];
110 #define PCL_INSTANTIATE_RandomSample(T) template class PCL_EXPORTS pcl::RandomSample<T>;
void applyFilter(Indices &indices) override
Sample of point indices.
IndicesAllocator<> Indices
Type used for indices in PCL.