pass on doc

This commit is contained in:
Sven Oesau 2024-01-12 11:13:17 +01:00
parent 626a23a49a
commit 85e598772d
4 changed files with 56 additions and 30 deletions

View File

@ -15,6 +15,10 @@
/// \defgroup PkgOrthtreeConcepts Concepts /// \defgroup PkgOrthtreeConcepts Concepts
/// \ingroup PkgOrthtreeRef /// \ingroup PkgOrthtreeRef
/// \defgroup PkgOrthtreeNeighbors Neighbor Search Functions
/// \ingroup PkgOrthtreeRef
/*! /*!
\addtogroup PkgOrthtreeRef \addtogroup PkgOrthtreeRef
@ -62,4 +66,6 @@
- `CGAL::Orthtrees::Leaves_traversal` - `CGAL::Orthtrees::Leaves_traversal`
- `CGAL::Orthtrees::Level_traversal` - `CGAL::Orthtrees::Level_traversal`
\cgalCRPSection{Neighbor search}
- \link PkgOrthtreeNeighbors `CGAL::Orthtrees::nearest_neighbors` \endlink
*/ */

View File

@ -63,22 +63,22 @@ namespace CGAL {
\sa `CGAL::Quadtree` \sa `CGAL::Quadtree`
\sa `CGAL::Octree` \sa `CGAL::Octree`
\tparam Traits_ must be a model of `OrthtreeTraits` \tparam GeomTraits must be a model of `OrthtreeTraits`
*/ */
template <typename Traits_> template <typename GeomTraits>
class Orthtree { class Orthtree {
public: public:
/// \name Template Types /// \name Template Types
/// @{ /// @{
using Traits = Traits_; ///< Geometry traits using Traits = GeomTraits; ///< Geometry traits
/// @} /// @}
/// \name Traits Types /// \name Traits Types
/// @{ /// @{
using Dimension = typename Traits::Dimension; ///< Dimension of the tree 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 FT = typename Traits::FT; ///< Number type.
using Point = typename Traits::Point_d; ///< Point type. using Point = typename Traits::Point_d; ///< Point type.
using Bbox = typename Traits::Bbox_d; ///< Bounding box type. using Bbox = typename Traits::Bbox_d; ///< Bounding box type.
@ -113,9 +113,6 @@ public:
*/ */
using Maybe_node_index = std::optional<Node_index>; using Maybe_node_index = std::optional<Node_index>;
// todo: maybe this could be private?
using Node_property_container = Properties::Experimental::Property_container<Node_index>;
/*! /*!
\brief Set of bits representing this node's relationship to its parent. \brief Set of bits representing this node's relationship to its parent.
@ -150,22 +147,44 @@ public:
using Node_index_range = boost::iterator_range<Index_traversal_iterator<Self>>; using Node_index_range = boost::iterator_range<Index_traversal_iterator<Self>>;
#endif #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<Index_traversal_iterator<Self>>;
#endif
/*!
* \brief A Model of `LvaluePropertyMap` with `Node_index` as key type and `T` as value type.
*/
#ifdef DOXYGEN_RUNNING
template <class T>
using Property_map = unspecified_type;
#else
template <class T>
using Property_map = Properties::Experimental::Property_container<Node_index>::Array<T>;
#endif
/// \cond SKIP_IN_MANUAL /// \cond SKIP_IN_MANUAL
using Cartesian_ranges = Orthtrees::internal::Cartesian_ranges<Traits>;
/// \endcond /// \endcond
/// @} /// @}
private: // data members : private: // data members :
using Cartesian_ranges = Orthtrees::internal::Cartesian_ranges<Traits>;
using Node_property_container = Properties::Experimental::Property_container<Node_index>;
Traits m_traits; /* the tree traits */ Traits m_traits; /* the tree traits */
Node_property_container m_node_properties; Node_property_container m_node_properties;
Node_property_container::Array <Node_data>& m_node_contents; Property_map<Node_data>& m_node_contents;
Node_property_container::Array <std::uint8_t>& m_node_depths; Property_map<std::uint8_t>& m_node_depths;
Node_property_container::Array <Global_coordinates>& m_node_coordinates; Property_map<Global_coordinates>& m_node_coordinates;
Node_property_container::Array <Maybe_node_index>& m_node_parents; Property_map<Maybe_node_index>& m_node_parents;
Node_property_container::Array <Maybe_node_index>& m_node_children; Property_map<Maybe_node_index>& m_node_children;
using Bbox_dimensions = std::array<CGAL::Exact_predicates_exact_constructions_kernel::FT, Dimension::value>; using Bbox_dimensions = std::array<CGAL::Exact_predicates_exact_constructions_kernel::FT, Dimension::value>;
CGAL::NT_converter<CGAL::Exact_predicates_exact_constructions_kernel::FT, typename Traits::Kernel::FT> conv; CGAL::NT_converter<CGAL::Exact_predicates_exact_constructions_kernel::FT, typename Traits::Kernel::FT> conv;
@ -435,7 +454,7 @@ public:
Node_index first = traversal.first_index(); 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); return traversal.next_index(index);
}; };
@ -497,11 +516,10 @@ public:
\param name the name of the new property \param name the name of the new property
\param default_value the default value assigned to nodes for this property \param default_value the default value assigned to nodes for this property
\return pair of a reference to the new node property array \return pair of the property map and a boolean which is True if the property needed to be created
and a boolean which is True if the property needed to be created
*/ */
template <typename T> template <typename T>
std::pair<std::reference_wrapper<Node_property_container::Array < T>>, bool> std::pair<Property_map<T>, bool>
get_or_add_node_property(const std::string& name, const T default_value = T()) { 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); 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 name the name of the new property
\param default_value the default value assigned to nodes for this 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 <typename T> template <typename T>
Node_property_container::Array <T>& add_node_property(const std::string& name, const T default_value = T()) { Property_map<T> add_node_property(const std::string& name, const T default_value = T()) {
return m_node_properties.add_property(name, default_value); return m_node_properties.add_property(name, default_value);
} }
@ -530,10 +548,10 @@ public:
\param name the name of the property \param name the name of the property
\return a reference to the property array \return the property map
*/ */
template <typename T> template <typename T>
Node_property_container::Array <T>& get_node_property(const std::string& name) { Property_map<T> get_node_property(const std::string& name) {
return m_node_properties.get_property<T>(name); return m_node_properties.get_property<T>(name);
} }
@ -544,10 +562,10 @@ public:
\param name the name of the property \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 <typename T> template <typename T>
std::optional<std::reference_wrapper<Node_property_container::Array < T>>> std::optional<Property_map<T>>
get_node_property_if_exists(const std::string& name) { get_node_property_if_exists(const std::string& name) {
return m_node_properties.get_property_if_exists<T>(name); return m_node_properties.get_property_if_exists<T>(name);
} }
@ -568,7 +586,7 @@ public:
\return the index of the node which contains the point. \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 // Make sure the point is enclosed by the orthtree
CGAL_precondition (CGAL::do_intersect(point, bbox(root()))); CGAL_precondition (CGAL::do_intersect(point, bbox(root())));

View File

@ -9,8 +9,8 @@
// //
// Author(s) : Jackson Campolattaro // Author(s) : Jackson Campolattaro
#ifndef ORTHTREE_EXAMPLES_NEAREST_NEIGHBORS_H #ifndef ORTHTREE_NEAREST_NEIGHBORS_H
#define ORTHTREE_EXAMPLES_NEAREST_NEIGHBORS_H #define ORTHTREE_NEAREST_NEIGHBORS_H
#include <CGAL/license/Orthtree.h> #include <CGAL/license/Orthtree.h>
@ -116,6 +116,7 @@ void nearest_k_neighbors_recursive(const Tree& orthtree,
namespace Orthtrees { namespace Orthtrees {
/*! /*!
\ingroup PkgOrthtreeNeighbors
\brief finds the `k` points within a specific radius that are \brief finds the `k` points within a specific radius that are
nearest to the center of `query_sphere`. 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`. \brief finds the `k` nearest neighbors of `query`.
Nearest neighbors are outputted in order of increasing distance to 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`. \brief finds the points in `sphere`.
Nearest neighbors are outputted in order of increasing distance to 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

View File

@ -101,10 +101,9 @@ private:
private: private:
Traversal_function m_next;
std::optional<std::size_t> m_index;
const Tree* m_tree = nullptr; const Tree* m_tree = nullptr;
std::optional<std::size_t> m_index;
Traversal_function m_next;
}; };