From 85e598772d092bc3d1b536dff45a0ed129e02ae4 Mon Sep 17 00:00:00 2001 From: Sven Oesau Date: Fri, 12 Jan 2024 11:13:17 +0100 Subject: [PATCH] pass on doc --- Orthtree/doc/Orthtree/PackageDescription.txt | 6 ++ Orthtree/include/CGAL/Orthtree.h | 66 ++++++++++++------- .../include/CGAL/Orthtree/Nearest_neighbors.h | 9 ++- .../CGAL/Orthtree/Traversal_iterator.h | 5 +- 4 files changed, 56 insertions(+), 30 deletions(-) diff --git a/Orthtree/doc/Orthtree/PackageDescription.txt b/Orthtree/doc/Orthtree/PackageDescription.txt index 818358a29c8..a81cb6f42e3 100644 --- a/Orthtree/doc/Orthtree/PackageDescription.txt +++ b/Orthtree/doc/Orthtree/PackageDescription.txt @@ -15,6 +15,10 @@ /// \defgroup PkgOrthtreeConcepts Concepts /// \ingroup PkgOrthtreeRef +/// \defgroup PkgOrthtreeNeighbors Neighbor Search Functions +/// \ingroup PkgOrthtreeRef + + /*! \addtogroup PkgOrthtreeRef @@ -62,4 +66,6 @@ - `CGAL::Orthtrees::Leaves_traversal` - `CGAL::Orthtrees::Level_traversal` +\cgalCRPSection{Neighbor search} +- \link PkgOrthtreeNeighbors `CGAL::Orthtrees::nearest_neighbors` \endlink */ diff --git a/Orthtree/include/CGAL/Orthtree.h b/Orthtree/include/CGAL/Orthtree.h index 43d9c78c177..3b620fb0138 100644 --- a/Orthtree/include/CGAL/Orthtree.h +++ b/Orthtree/include/CGAL/Orthtree.h @@ -63,22 +63,22 @@ namespace CGAL { \sa `CGAL::Quadtree` \sa `CGAL::Octree` - \tparam Traits_ must be a model of `OrthtreeTraits` + \tparam GeomTraits must be a model of `OrthtreeTraits` */ -template +template class Orthtree { public: /// \name Template Types /// @{ - using Traits = Traits_; ///< Geometry traits + using Traits = GeomTraits; ///< Geometry traits /// @} /// \name Traits Types /// @{ using Dimension = typename Traits::Dimension; ///< Dimension of the tree - using Kernel = typename Traits::Kernel; + using Kernel = typename Traits::Kernel; ///< Kernel type. using FT = typename Traits::FT; ///< Number type. using Point = typename Traits::Point_d; ///< Point type. using Bbox = typename Traits::Bbox_d; ///< Bounding box type. @@ -113,9 +113,6 @@ public: */ using Maybe_node_index = std::optional; - // todo: maybe this could be private? - using Node_property_container = Properties::Experimental::Property_container; - /*! \brief Set of bits representing this node's relationship to its parent. @@ -150,22 +147,44 @@ public: using Node_index_range = boost::iterator_range>; #endif + /*! + * \brief A model of `ConstRange` whose value type is `Node_index`. + */ +#ifdef DOXYGEN_RUNNING + using Node_range = unspecified_type; + using Node_index_range = unspecified_type; +#else + using Node_index_range = boost::iterator_range>; +#endif + /*! + * \brief A Model of `LvaluePropertyMap` with `Node_index` as key type and `T` as value type. + */ +#ifdef DOXYGEN_RUNNING + template + using Property_map = unspecified_type; +#else + template + using Property_map = Properties::Experimental::Property_container::Array; +#endif + /// \cond SKIP_IN_MANUAL - using Cartesian_ranges = Orthtrees::internal::Cartesian_ranges; /// \endcond /// @} private: // data members : + using Cartesian_ranges = Orthtrees::internal::Cartesian_ranges; + using Node_property_container = Properties::Experimental::Property_container; + Traits m_traits; /* the tree traits */ Node_property_container m_node_properties; - Node_property_container::Array & m_node_contents; - Node_property_container::Array & m_node_depths; - Node_property_container::Array & m_node_coordinates; - Node_property_container::Array & m_node_parents; - Node_property_container::Array & m_node_children; + Property_map& m_node_contents; + Property_map& m_node_depths; + Property_map& m_node_coordinates; + Property_map& m_node_parents; + Property_map& m_node_children; using Bbox_dimensions = std::array; CGAL::NT_converter conv; @@ -435,7 +454,7 @@ public: Node_index first = traversal.first_index(); - auto next = [=](const Self& tree, Node_index index) -> Maybe_node_index { + auto next = [=](const Self&, Node_index index) -> Maybe_node_index { return traversal.next_index(index); }; @@ -497,11 +516,10 @@ public: \param name the name of the new property \param default_value the default value assigned to nodes for this property - \return pair of a reference to the new node property array - and a boolean which is True if the property needed to be created + \return pair of the property map and a boolean which is True if the property needed to be created */ template - std::pair>, bool> + std::pair, bool> get_or_add_node_property(const std::string& name, const T default_value = T()) { return m_node_properties.get_or_add_property(name, default_value); } @@ -514,10 +532,10 @@ public: \param name the name of the new property \param default_value the default value assigned to nodes for this property - \return a reference to the new property array + \return the created property map */ template - Node_property_container::Array & add_node_property(const std::string& name, const T default_value = T()) { + Property_map add_node_property(const std::string& name, const T default_value = T()) { return m_node_properties.add_property(name, default_value); } @@ -530,10 +548,10 @@ public: \param name the name of the property - \return a reference to the property array + \return the property map */ template - Node_property_container::Array & get_node_property(const std::string& name) { + Property_map get_node_property(const std::string& name) { return m_node_properties.get_property(name); } @@ -544,10 +562,10 @@ public: \param name the name of the property - \return an optional containing a reference to the property array if it exists + \return an optional containing the property map if it exists */ template - std::optional>> + std::optional> get_node_property_if_exists(const std::string& name) { return m_node_properties.get_property_if_exists(name); } @@ -568,7 +586,7 @@ public: \return the index of the node which contains the point. */ - const Node_index locate(const Point& point) const { + Node_index locate(const Point& point) const { // Make sure the point is enclosed by the orthtree CGAL_precondition (CGAL::do_intersect(point, bbox(root()))); diff --git a/Orthtree/include/CGAL/Orthtree/Nearest_neighbors.h b/Orthtree/include/CGAL/Orthtree/Nearest_neighbors.h index 270ac53179c..7fcdbf36696 100644 --- a/Orthtree/include/CGAL/Orthtree/Nearest_neighbors.h +++ b/Orthtree/include/CGAL/Orthtree/Nearest_neighbors.h @@ -9,8 +9,8 @@ // // Author(s) : Jackson Campolattaro -#ifndef ORTHTREE_EXAMPLES_NEAREST_NEIGHBORS_H -#define ORTHTREE_EXAMPLES_NEAREST_NEIGHBORS_H +#ifndef ORTHTREE_NEAREST_NEIGHBORS_H +#define ORTHTREE_NEAREST_NEIGHBORS_H #include @@ -116,6 +116,7 @@ void nearest_k_neighbors_recursive(const Tree& orthtree, namespace Orthtrees { /*! + \ingroup PkgOrthtreeNeighbors \brief finds the `k` points within a specific radius that are nearest to the center of `query_sphere`. @@ -166,6 +167,7 @@ OutputIterator nearest_k_neighbors_in_radius( /*! + \ingroup PkgOrthtreeNeighbors \brief finds the `k` nearest neighbors of `query`. Nearest neighbors are outputted in order of increasing distance to @@ -188,6 +190,7 @@ OutputIterator nearest_neighbors(const Tree& orthtree, const typename Tree::Poin } /*! + \ingroup PkgOrthtreeNeighbors \brief finds the points in `sphere`. Nearest neighbors are outputted in order of increasing distance to @@ -209,4 +212,4 @@ OutputIterator nearest_neighbors(const Tree& orthtree, const typename Tree::Sphe } } -#endif //ORTHTREE_EXAMPLES_NEAREST_NEIGHBORS_H +#endif //ORTHTREE_NEAREST_NEIGHBORS_H diff --git a/Orthtree/include/CGAL/Orthtree/Traversal_iterator.h b/Orthtree/include/CGAL/Orthtree/Traversal_iterator.h index 75c7abb990a..f202406fb1f 100644 --- a/Orthtree/include/CGAL/Orthtree/Traversal_iterator.h +++ b/Orthtree/include/CGAL/Orthtree/Traversal_iterator.h @@ -101,10 +101,9 @@ private: private: - Traversal_function m_next; - - std::optional m_index; const Tree* m_tree = nullptr; + std::optional m_index; + Traversal_function m_next; };