38 #ifndef PCL_FILTERS_IMPL_RANDOM_SAMPLE_H_
39 #define PCL_FILTERS_IMPL_RANDOM_SAMPLE_H_
41 #include <pcl/filters/random_sample.h>
42 #include <pcl/common/io.h>
43 #include <pcl/type_traits.h>
47 template<
typename Po
intT>
51 std::size_t N = indices_->size ();
52 std::size_t sample_size = negative_ ? N - sample_ : sample_;
58 removed_indices_->clear ();
63 indices.resize (sample_size);
64 if (extract_removed_indices_)
65 removed_indices_->resize (N - sample_size);
72 std::size_t index = 0;
73 std::vector<bool> added;
74 if (extract_removed_indices_)
75 added.resize (indices_->size (),
false);
76 std::size_t n = sample_size;
80 const float U = unifRand ();
85 if (extract_removed_indices_)
87 indices[i++] = (*indices_)[index];
98 if (extract_removed_indices_)
101 for (std::size_t i = 0; i < added.size (); i++)
105 (*removed_indices_)[ri++] = (*indices_)[i];
112 #define PCL_INSTANTIATE_RandomSample(T) template class PCL_EXPORTS pcl::RandomSample<T>;
114 #endif // PCL_FILTERS_IMPL_RANDOM_SAMPLE_H_