38 #ifndef PCL_FILTERS_IMPL_RANDOM_SAMPLE_H_
39 #define PCL_FILTERS_IMPL_RANDOM_SAMPLE_H_
45 template<
typename Po
intT>
void
48 unsigned N =
static_cast<unsigned> (input_->size ());
49 float one_over_N = 1.0f / float (N);
60 output.
points.resize (sample_);
61 output.
width = sample_;
67 unsigned top = N - sample_;
72 for (
size_t n = sample_; n >= 2; n--)
74 unsigned int V = unifRand ();
76 float quot = float (top) * one_over_N;
82 quot = quot * float (top) * one_over_N;
85 output.
points[i++] = input_->points[index++];
89 index += N *
static_cast<unsigned> (unifRand ());
90 output.
points[i++] = input_->points[index++];
95 template<
typename Po
intT>
99 unsigned N =
static_cast<unsigned> (input_->size ());
100 float one_over_N = 1.0f / float (N);
111 indices.resize (sample_);
117 unsigned top = N - sample_;
121 for (
size_t n = sample_; n >= 2; n--)
123 unsigned int V = unifRand ();
125 float quot = float (top) * one_over_N;
131 quot = quot * float (top) * one_over_N;
134 indices[i++] = (*indices_)[index++];
138 index += N *
static_cast<unsigned> (unifRand ());
139 indices[i++] = (*indices_)[index++];
143 #define PCL_INSTANTIATE_RandomSample(T) template class PCL_EXPORTS pcl::RandomSample<T>;
145 #endif // PCL_FILTERS_IMPL_RANDOM_SAMPLE_H_