renaming nearest_neighbors to nearest_k_neighbors

This commit is contained in:
Sven Oesau 2024-03-01 16:32:00 +01:00
parent a8fd56c724
commit caa833f439
3 changed files with 5 additions and 5 deletions

View File

@ -46,7 +46,7 @@ int main(int argc, char** argv) {
}; };
for (const Point& p : points_to_find) for (const Point& p : points_to_find)
octree.nearest_neighbors octree.nearest_k_neighbors
(p, 1, // k=1 to find the single closest point (p, 1, // k=1 to find the single closest point
boost::make_function_output_iterator boost::make_function_output_iterator
([&](const Point_set::Index& nearest) ([&](const Point_set::Index& nearest)
@ -57,7 +57,7 @@ int main(int argc, char** argv) {
typename Octree::Sphere s(points_to_find[0], 0.0375); typename Octree::Sphere s(points_to_find[0], 0.0375);
std::cout << std::endl << "Closest points within the sphere around " << s.center() << " with squared radius of " << s.squared_radius() << ":" << std::endl; std::cout << std::endl << "Closest points within the sphere around " << s.center() << " with squared radius of " << s.squared_radius() << ":" << std::endl;
octree.nearest_neighbors octree.neighbors_in_radius
(s, (s,
boost::make_function_output_iterator boost::make_function_output_iterator
([&](const Point_set::Index& nearest) ([&](const Point_set::Index& nearest)

View File

@ -682,7 +682,7 @@ public:
\warning Nearest neighbor searches requires `GeomTraits` to be a model of `CollectionPartitioningOrthtreeTraits`. \warning Nearest neighbor searches requires `GeomTraits` to be a model of `CollectionPartitioningOrthtreeTraits`.
*/ */
template<typename OutputIterator> template<typename OutputIterator>
auto nearest_neighbors(const Point& query, auto nearest_k_neighbors(const Point& query,
std::size_t k, std::size_t k,
OutputIterator output) const -> std::enable_if_t<supports_neighbor_search, OutputIterator> { OutputIterator output) const -> std::enable_if_t<supports_neighbor_search, OutputIterator> {
Sphere query_sphere(query, (std::numeric_limits<FT>::max)()); Sphere query_sphere(query, (std::numeric_limits<FT>::max)());

View File

@ -71,7 +71,7 @@ void naive_vs_octree(std::size_t dataset_size) {
auto octree_start_time = high_resolution_clock::now(); auto octree_start_time = high_resolution_clock::now();
{ {
std::vector<Point_set::Index> k_neighbors; std::vector<Point_set::Index> k_neighbors;
octree.nearest_neighbors(random_point, 1, std::back_inserter(k_neighbors)); octree.nearest_k_neighbors(random_point, 1, std::back_inserter(k_neighbors));
octree_nearest = get(points.point_map(), *k_neighbors.begin()); octree_nearest = get(points.point_map(), *k_neighbors.begin());
} }
duration<float> octree_elapsed_time = high_resolution_clock::now() - octree_start_time; duration<float> octree_elapsed_time = high_resolution_clock::now() - octree_start_time;
@ -121,7 +121,7 @@ void kdtree_vs_octree(std::size_t dataset_size, std::size_t K) {
Octree octree(points, points.point_map()); Octree octree(points, points.point_map());
octree.refine(10, 20); octree.refine(10, 20);
auto octree_start_time = high_resolution_clock::now(); auto octree_start_time = high_resolution_clock::now();
octree.nearest_neighbors(random_point, K, std::back_inserter(octree_nearest_neighbors)); octree.nearest_k_neighbors(random_point, K, std::back_inserter(octree_nearest_neighbors));
duration<float> octree_elapsed_time = high_resolution_clock::now() - octree_start_time; duration<float> octree_elapsed_time = high_resolution_clock::now() - octree_start_time;
std::cout << "Octree --> " std::cout << "Octree --> "