From 14089f54f916b078bcf0054bfb6cbc8b2732b039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 19 Feb 2024 18:42:35 +0100 Subject: [PATCH] clean up --- .../Concepts/CollectionPartitioningOrthtreeTraits.h | 4 ++-- .../doc/Orthtree/Concepts/OrthtreeTraitsWithData.h | 5 ++--- Orthtree/doc/Orthtree/Concepts/OrthtreeTraversal.h | 3 +-- Orthtree/include/CGAL/Orthtree.h | 13 ++++++++++--- Orthtree/include/CGAL/Orthtree_traits_face_graph.h | 6 +++--- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Orthtree/doc/Orthtree/Concepts/CollectionPartitioningOrthtreeTraits.h b/Orthtree/doc/Orthtree/Concepts/CollectionPartitioningOrthtreeTraits.h index 523408e63e8..6c8df3b9347 100644 --- a/Orthtree/doc/Orthtree/Concepts/CollectionPartitioningOrthtreeTraits.h +++ b/Orthtree/doc/Orthtree/Concepts/CollectionPartitioningOrthtreeTraits.h @@ -2,7 +2,7 @@ \ingroup PkgOrthtreeConcepts \cgalConcept - Refinement of the OrthtreeTraitsWithData concept, adding requirements for the + Refinement of the `OrthtreeTraitsWithData` concept, adding requirements for the traits class of a `CGAL::Orthtree` in order to supports nearest-neighbor searching. Nearest neighbor searches expect a tree where `Node_data` is a model of `ForwardRange`. @@ -36,7 +36,7 @@ public: using Node_data_element = unspecified_type; /*! - * \brief Functor with an operator calculate the squared distance of `Node_data_element` from a point. + * \brief Functor with an operator that calculates the squared distance of a `Node_data_element` from a point. * * Provides the operator: * `FT operator()(const Node_data_element&, const Point_d&)` diff --git a/Orthtree/doc/Orthtree/Concepts/OrthtreeTraitsWithData.h b/Orthtree/doc/Orthtree/Concepts/OrthtreeTraitsWithData.h index e3e5f5e6124..508a639361d 100644 --- a/Orthtree/doc/Orthtree/Concepts/OrthtreeTraitsWithData.h +++ b/Orthtree/doc/Orthtree/Concepts/OrthtreeTraitsWithData.h @@ -25,11 +25,10 @@ public: using Node_data = unspecified_type; /*! - * \brief Functor which initializes the contained elements for the root node. + * \brief Functor which initializes elements contained by the root node. * * Each node of a tree has an associated `Node_data` value. - * For most nodes, this is set by `Distribute_node_contents`, but that is not possible for the root node. - * Instead, this functor initializes the `Node_data` of the root node. + * This functor initializes the `Node_data` of the root node. * It takes no arguments, and returns an instance of `Node_data`. * * Provides the operator: diff --git a/Orthtree/doc/Orthtree/Concepts/OrthtreeTraversal.h b/Orthtree/doc/Orthtree/Concepts/OrthtreeTraversal.h index b95cb0908f6..64e84572cea 100644 --- a/Orthtree/doc/Orthtree/Concepts/OrthtreeTraversal.h +++ b/Orthtree/doc/Orthtree/Concepts/OrthtreeTraversal.h @@ -1,4 +1,3 @@ - /*! \ingroup PkgOrthtreeConcepts \cgalConcept @@ -24,7 +23,7 @@ public: Node_index first_index() const; /*! - \brief returns the next node to iterate to, given the previous node. + \brief returns the next node to be traversed given the previous node `n`. */ Node_index next(Node_index n) const; }; diff --git a/Orthtree/include/CGAL/Orthtree.h b/Orthtree/include/CGAL/Orthtree.h index af99d730eaf..aa866510a83 100644 --- a/Orthtree/include/CGAL/Orthtree.h +++ b/Orthtree/include/CGAL/Orthtree.h @@ -110,12 +110,10 @@ struct Node_data_wrapper \sa `CGAL::Quadtree` \sa `CGAL::Octree` - \tparam GeomTraits must be a model of `OrthtreeTraits` + \tparam GeomTraits must be a model of `OrthtreeTraits` or `OrthtreeTraitswithData`. */ template class Orthtree { - static inline constexpr bool has_data = Orthtree_impl::has_Node_data::value; - public: /// \name Template Types /// @{ @@ -124,6 +122,11 @@ public: /// \name Traits Types /// @{ +#ifndef DOXYGEN_RUNNING + static inline constexpr bool has_data = Orthtree_impl::has_Node_data::value; +#else + static inline constexpr bool has_data = bool_value; ///< `true` if `GeomTraits` is a model of `OrthtreeTraitswithData` and `false` otherwise. +#endif static constexpr int dimension = Traits::dimension; ///< Dimension of the tree using Kernel = typename Traits::Kernel; ///< Kernel type. using FT = typename Traits::FT; ///< Number type. @@ -133,7 +136,11 @@ public: using Adjacency = typename Traits::Adjacency; ///< Adjacency type. using Node_index = typename Traits::Node_index; ///< Index of a given node in the tree; the root always has index 0. +#ifndef DOXYGEN_RUNNING using Node_data = typename Orthtree_impl::Node_data_wrapper::Node_data; +#else + using Node_data = std::conditional_t; +#endif /// @} diff --git a/Orthtree/include/CGAL/Orthtree_traits_face_graph.h b/Orthtree/include/CGAL/Orthtree_traits_face_graph.h index 3562a97b10b..4f06dff45da 100644 --- a/Orthtree/include/CGAL/Orthtree_traits_face_graph.h +++ b/Orthtree/include/CGAL/Orthtree_traits_face_graph.h @@ -26,7 +26,7 @@ namespace CGAL { /*! \ingroup PkgOrthtreeTraits -Traits class for the `Orthtree` class to be used to contruct a 3D octree around +Traits class for the `Orthtree` class to be used to construct a 3D octree around a triangulated surface mesh. Each node of the octree will store all the faces of the mesh intersected by its bounding box. The subdivision of the octree is controlled by the nested class `Orthtree_traits_face_graph::Split_predicate_node_min_extent` @@ -93,13 +93,13 @@ struct Orthtree_traits_face_graph : public Orthtree_traits_base< }; } - auto construct_root_node_contents_object() { + auto construct_root_node_contents_object() const { return [&]() -> Node_data { return {faces(m_pm).begin(), faces(m_pm).end()}; }; } - auto distribute_node_contents_object() { + auto distribute_node_contents_object() const { return [&](Node_index n, Tree& tree, const Point_d& /* center */) -> void { Node_data& ndata = tree.data(n); for (int i = 0; i < 8; ++i) {