From 05667adc398cb034ad6ebe706c571569d6e45f21 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 27 Dec 2024 16:14:34 +0000 Subject: [PATCH] Document class --- .../Frechet_distance/PackageDescription.txt | 1 + .../CGAL/Frechet_distance/Neighbor_search.h | 27 ++++++++++--------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Frechet_distance/doc/Frechet_distance/PackageDescription.txt b/Frechet_distance/doc/Frechet_distance/PackageDescription.txt index a2d7779f850..930fd624f0a 100644 --- a/Frechet_distance/doc/Frechet_distance/PackageDescription.txt +++ b/Frechet_distance/doc/Frechet_distance/PackageDescription.txt @@ -34,6 +34,7 @@ This package provides functions for computing the Fréchet distance of polylines - `FrechetDistanceTraits` \cgalCRPSection{Classes} +- `CGAL::Frechet_distance::Neighbor_search` - `CGAL::Frechet_distance_traits_2` - `CGAL::Frechet_distance_traits_3` - `CGAL::Frechet_distance_traits_d` diff --git a/Frechet_distance/include/CGAL/Frechet_distance/Neighbor_search.h b/Frechet_distance/include/CGAL/Frechet_distance/Neighbor_search.h index a90622585c3..4f6fc781268 100644 --- a/Frechet_distance/include/CGAL/Frechet_distance/Neighbor_search.h +++ b/Frechet_distance/include/CGAL/Frechet_distance/Neighbor_search.h @@ -13,8 +13,8 @@ // Andreas Fabri // ============================================================================= -#ifndef CGAL_FRECHET_DISTANCE_NEAR_NEIGHBORS_DS_H -#define CGAL_FRECHET_DISTANCE_NEAR_NEIGHBORS_DS_H +#ifndef CGAL_FRECHET_DISTANCE_NEIGHBOR_SEARCH_H +#define CGAL_FRECHET_DISTANCE_NEIGHBOR_SEARCH_H #include #include @@ -27,13 +27,13 @@ namespace CGAL { namespace Frechet_distance { -// TODO: hide away in Frechet_distance_::internal (different naming but nvm) -template -using PointRangeKernel = typename CGAL::Kernel_traits< - typename std::iterator_traits::value_type>:: - Kernel; // TODO: replace by CORE type for initial testing - -template > +/*! + * A data structure to store curves with a function that enables to find those curves which are close to a query curve. + * + * \tparam Traits a model of `FrechetDistanceTraits` + * \tparam PointRange a model of the concept `RandomAccessContainer` with `Traits::Point_d` as value type. +*/ +template class Neighbor_search { using PT = Traits; // Polyline_traits_2; @@ -47,10 +47,13 @@ class Neighbor_search public: Neighbor_search() = default; - void insert(const Polyline& curve); + /*! inserts curves + */ void insert(const Polylines& curves); - PolylineIDs get_close_curves(const Polyline& curve, double distance); + /*! returns the indices of the inserted curves that are closer than `distance` to `curve`. + */ + std::vector get_close_curves(const Polyline& curve, double distance); private: Polylines curves; @@ -89,4 +92,4 @@ auto Neighbor_search::get_close_curves( } } // end of namespace CGAL -#endif // CGAL_FRECHET_DISTANCE_NEAR_NEIGHBORS_DS_H +#endif // CGAL_FRECHET_DISTANCE_NEIGHBOR_SEARCH_H