147 typedef typename Range::value_type pointIterator;
148 typedef typename Range::iterator iterator;
159 if (
m_size <= CuttingAccuracy){
163 boost::array<pointIterator,CuttingAccuracy> samples;
164 for(std::size_t i = 0; i != CuttingAccuracy; i++)
165 samples[i] = points[
m_size * (2*i+1) / (2*CuttingAccuracy)];
170 std::vector<double> distance(
m_size);
171 for(std::size_t i = 0; i !=
m_size; ++i){
172 distance[i] = inner_prod(
m_normal, *points[i]);
177 iterator split = this->
splitList(distance,points);
178 iterator begin = boost::begin(points);
179 iterator end = boost::end(points);
187 std::size_t leftSize = split-begin;
192 boost::iterator_range<iterator>
left(begin,split);
193 boost::iterator_range<iterator>
right(split,end);
208 std::size_t numSamples = samples.size();
209 std::size_t besti = 0;
210 std::size_t bestj = 0;
211 double best_dist2 = -1.0;
212 for (std::size_t i = 1; i != numSamples; i++){
213 for (std::size_t j = 0; j != i; j++){
214 double dist2 = distanceSqr(*samples[i], *samples[j]);
215 if (dist2 > best_dist2){
222 double factor = 1.0 / std::sqrt(best_dist2);
223 if (! (boost::math::isfinite)(factor))
226 m_normal = factor * (*samples[besti] - *samples[bestj]);