11 struct compareByDistance {
21 std::vector<GlobalPoint>
pts;
23 std::vector<PointAndDistance> sorted_values(
values.size());
24 partial_sort_copy(
values.begin(),
values.end(), sorted_values.begin(), sorted_values.end(), compareByDistance());
26 std::vector<PointAndDistance>::iterator
end = sorted_values.end();
27 std::vector<PointAndDistance>::iterator begin = sorted_values.begin();
32 unsigned int min_num =
values.size() < 30 ?
values.size() : 30;
35 if (
values.size() > 2 * min_num)
36 min_num = (
int)
values.size() / 2;
38 while (
pts.size() < min_num) {
40 std::vector<PointAndDistance>::iterator
i;
41 for (
i = begin;
i !=
end && (
i->second < dmax); ++
i) {
42 pts.push_back(
i->first);