14 #include <CGAL/boost/graph/properties.h>
16 #include <CGAL/Search_traits_3.h>
17 #include <CGAL/Search_traits_adapter.h>
18 #include <CGAL/Orthogonal_k_neighbor_search.h>
19 #include <CGAL/Orthogonal_incremental_neighbor_search.h>
20 #include <CGAL/boost/iterator/counting_iterator.hpp>
48 return ps.point_map();
55 return ps.point_map();
65 using Traits_base = CGAL::Search_traits_3< FEVV::CGALPointSetKernel >;
69 using KdTree = CGAL::Kd_tree< Traits >;
90 auto ppmap = pc.point_map();
94 new KdTree(boost::counting_iterator< std::size_t >(0),
95 boost::counting_iterator< std::size_t >(pc.number_of_points()),
111 std::pair< std::vector< CGALPointSetNNSearch::vertex_descriptor >,
112 std::vector< double > >
121 typedef CGAL::Orthogonal_k_neighbor_search< Traits > K_neighbor_search;
122 typedef K_neighbor_search::Distance Distance;
125 auto ppmap = pc.point_map();
128 Distance sq_dist(ppmap);
129 K_neighbor_search search(kd_tree, query, k, 0,
true, sq_dist);
132 std::vector< vertex_descriptor > nn_ids;
133 std::vector< double > nn_distances;
134 for(
auto it = search.begin(); it != search.end(); it++)
136 nn_ids.push_back(it->first);
137 nn_distances.push_back(sq_dist.inverse_of_transformed_distance(it->second));
141 return make_pair(nn_ids, nn_distances);
155 std::pair< std::vector< CGALPointSetNNSearch::vertex_descriptor >,
156 std::vector< double > >
165 typedef CGAL::Orthogonal_incremental_neighbor_search< Traits >
166 NN_incremental_search;
167 typedef NN_incremental_search::Distance Distance;
170 auto ppmap = pc.point_map();
173 Distance sq_dist(ppmap);
174 NN_incremental_search search(kd_tree, query, 0.0,
true, sq_dist);
177 std::vector< vertex_descriptor > nn_ids;
178 std::vector< double > nn_distances;
179 for(
auto it = search.begin(); it != search.end(); ++it)
181 double distance = sq_dist.inverse_of_transformed_distance(it->second);
182 if(distance > radius)
186 nn_ids.push_back(it->first);
187 nn_distances.push_back(distance);
191 return make_pair(nn_ids, nn_distances);
203 typedef FEVV::CGALPointSetPointMap::reference
reference;