pass on the doc but the Orthtree class

This commit is contained in:
Sébastien Loriot 2024-01-25 16:06:06 +01:00
parent 787fb84dc6
commit 57fbda8835
12 changed files with 97 additions and 129 deletions

View File

@ -2,9 +2,8 @@
\ingroup PkgOrthtreeConcepts \ingroup PkgOrthtreeConcepts
\cgalConcept \cgalConcept
In addition to the requirements described in the OrthtreeTraits concept, Refinement of the OrthtreeTraits concept, adding requirements for the
the concept `CollectionPartitioningOrthtreeTraits` defines the requirements for the traits class of a `CGAL::Orthtree` in order to supports nearest-neighbor searching.
traits class of a `CGAL::Orthtree` which supports nearest-neighbor searching.
Nearest neighbor searches expect a tree with nodes which contain list types. Nearest neighbor searches expect a tree with nodes which contain list types.
The leaf nodes of the tree represent an exclusive partition of the elements contained in the tree. The leaf nodes of the tree represent an exclusive partition of the elements contained in the tree.
@ -49,7 +48,7 @@ public:
/// @{ /// @{
/*! /*!
* Function used to construct an object of type `Get_geometric_object_for_element`. * constructs an object of type `Get_geometric_object_for_element`.
*/ */
Get_geometric_object_for_element get_geometric_object_for_element_object() const; Get_geometric_object_for_element get_geometric_object_for_element_object() const;

View File

@ -25,7 +25,7 @@ public:
/*! /*!
A random access iterator type to enumerate the A random access iterator type to enumerate the
%Cartesian coordinates of a point. %Cartesian coordinates of a point of type `Point_d`.
*/ */
using Cartesian_const_iterator_d = unspecified_type; using Cartesian_const_iterator_d = unspecified_type;
@ -35,7 +35,7 @@ public:
using Node_data = unspecified_type; using Node_data = unspecified_type;
/*! /*!
* \brief Number type which can take on values indicating adjacency directions. * \brief Integral number type which can take on values indicating adjacency directions.
* *
* Must be able to take on values ranging from 0 to the number of faces of the (hyper)rectangle type, equivalent to 2 * D. * Must be able to take on values ranging from 0 to the number of faces of the (hyper)rectangle type, equivalent to 2 * D.
*/ */
@ -59,13 +59,13 @@ public:
* Each node of a tree has an associated `Node_data` value. * 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. * 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. * Instead, this functor initializes the `Node_data` of the root node.
* It takes no arguments, and return an instance of `Node_data`. * It takes no arguments, and returns an instance of `Node_data`.
* *
* Provides the operator: * Provides the operator:
* `Node_data operator()()` * `Node_data operator()()`
* *
* Typically, the `Node_data` of the root node contains all the elements in the tree. * Typically, the `Node_data` of the root node contains all the elements in the tree.
* For a tree in which each node contains an `std::span()` this function would return the span containing all items. * For a tree in which each node contains a span (such as `std::span()`) this function would return the span containing all items.
* *
*/ */
using Construct_root_node_contents = unspecified_type; using Construct_root_node_contents = unspecified_type;
@ -81,13 +81,11 @@ public:
/*! /*!
* \brief Functor which distributes a node's contents to its children. * \brief Functor which distributes a node's contents to its children.
* *
* The functor takes a node index, a tree reference, and a `Point_d` which is the center of the node.
*
* Provides the operator: * Provides the operator:
* `void operator()(typename Tree::Node_index, Tree&, const Point_d&)` * `void operator()(typename Tree::Node_index, Tree&, const Point_d&)`
* *
* It can use `tree.children(node_index)` to access the children of the node, and `tree.data(node_index)` * It can use `tree.children(node_index)` to access the children of the node, and `tree.data(node_index)`
* to access the contents of the node and each of its children. * to access its children and the contents of the node.
* It must distribute the contents of the node to each of its children. * It must distribute the contents of the node to each of its children.
* For a tree in which each node contains a span, this may mean rearranging the contents of the original node * For a tree in which each node contains a span, this may mean rearranging the contents of the original node
* and producing spans containing a subset of its contents for each of its children. * and producing spans containing a subset of its contents for each of its children.
@ -108,27 +106,27 @@ public:
/// @{ /// @{
/*! /*!
* Function used to construct an object of type `Construct_root_node_bbox`. * constructs an object of type `Construct_root_node_bbox`.
*/ */
Construct_root_node_bbox construct_root_node_bbox_object() const; Construct_root_node_bbox construct_root_node_bbox_object() const;
/*! /*!
* Function used to construct an object of type `Construct_root_node_contents`. * constructs an object of type `Construct_root_node_contents`.
*/ */
Construct_root_node_contents construct_root_node_contents_object() const; Construct_root_node_contents construct_root_node_contents_object() const;
/*! /*!
* Function used to construct an object of type `Distribute_node_contents`. * constructs an object of type `Distribute_node_contents`.
*/ */
Distribute_node_contents distribute_node_contents_object() const; Distribute_node_contents distribute_node_contents_object() const;
/*! /*!
* Function used to construct an object of type `Locate_halfspace`. * constructs an object of type `Locate_halfspace`.
*/ */
Locate_halfspace locate_halfspace_object() const; Locate_halfspace locate_halfspace_object() const;
/*! /*!
* Function used to construct an object of type `Construct_point_d`. * constructs an object of type `Construct_point_d`.
*/ */
Construct_point_d construct_point_d_object() const; Construct_point_d construct_point_d_object() const;

View File

@ -3,11 +3,7 @@
\ingroup PkgOrthtreeConcepts \ingroup PkgOrthtreeConcepts
\cgalConcept \cgalConcept
\brief A traversal provides the functions needed to traverse the \brief Requirements for defining a traversal strategie of an orthtree.
nodes of an orthtree.
A traversal is used to iterate on a tree with a user-selected order
(e.g., preorder, postorder).
\cgalHasModelsBegin \cgalHasModelsBegin
\cgalHasModels{CGAL::Orthtrees::Preorder_traversal} \cgalHasModels{CGAL::Orthtrees::Preorder_traversal}
@ -23,7 +19,7 @@ public:
using Node_index = unspecified_type; ///< Index type of the orthtree to be traversed using Node_index = unspecified_type; ///< Index type of the orthtree to be traversed
/*! /*!
\brief returns the first node to iterate to, given the root of the orthtree. \brief returns the first node of the traversal.
*/ */
Node_index first_index() const; Node_index first_index() const;

View File

@ -42,6 +42,7 @@ Quadtree, Octree and Orthtree Reference
\cgalCRPSection{Concepts} \cgalCRPSection{Concepts}
- `OrthtreeTraits` - `OrthtreeTraits`
- `OrthtreeTraversal` - `OrthtreeTraversal`
- `CollectionPartitioningOrthtreeTraits`
\cgalCRPSection{Classes} \cgalCRPSection{Classes}
- `CGAL::Quadtree<GeomTraits, PointRange, PointMap>` - `CGAL::Quadtree<GeomTraits, PointRange, PointMap>`

View File

@ -22,15 +22,11 @@ namespace CGAL {
/*! /*!
\ingroup PkgOrthtreeRef \ingroup PkgOrthtreeRef
\brief Alias that specializes the `Orthtree` class to a 3D octree. \brief Alias that specializes the `Orthtree` class to a 3D octree storing 3D points.
These two types are exactly equivalent: \tparam GeomTraits a model of `Kernel`
- `Octree<GeomTraits, PointRange, PointMap>` \tparam PointRange a model of `Range` whose value type is the key type of `PointMap`
- `Orthtree<Orthtree_traits_point<GeomTraits, PointRange, PointMap, Dimension_tag<3>>>`. \tparam PointMap a model of `ReadablePropertyMap` whose value type is `GeomTraits::Point_3`
\tparam GeomTraits must be a model of `Kernel`
\tparam PointRange must be a model of `Range` whose value type is the key type of `PointMap`
\tparam PointMap must be a model of `ReadablePropertyMap` whose value type is `GeomTraits::Point_3`
*/ */
template < template <
typename GeomTraits, typename GeomTraits,

View File

@ -117,18 +117,15 @@ namespace Orthtrees {
/*! /*!
\ingroup PkgOrthtreeNeighbors \ingroup PkgOrthtreeNeighbors
\brief finds the `k` points within a specific radius that are \brief finds at most `k` points within a specific radius that are
nearest to the center of the sphere `query`. nearest to the center of the sphere `query`: if `query` does not contain
at least `k` points, only contained points will be returned.
This function guarantees that there are no closer points than the ones returned,
but it does not guarantee that it will return at least `k` points.
For a query where the search radius encloses `k` or fewer points, all enclosed points will be returned.
If the search radius is too small, no points may be returned.
This function is useful when the user already knows how sparse the points are, This function is useful when the user already knows how sparse the points are,
or if they do not care about points that are too far away. or if they do not care about points that are too far away.
Setting a small radius may have performance benefits. Setting a small radius may have performance benefits.
\tparam Tree must be an orthtree with traits which are a model of CollectionPartitioningOrthtreeTraits \tparam Tree must be `Orthtree<GT>` with `GT` being a model of `CollectionPartitioningOrthtreeTraits`
\tparam OutputIterator must be a model of `OutputIterator` that accepts points \tparam OutputIterator must be a model of `OutputIterator` that accepts points
\param orthtree the tree to search within \param orthtree the tree to search within
@ -173,13 +170,13 @@ OutputIterator nearest_k_neighbors_in_radius(
Nearest neighbors are outputted in order of increasing distance to Nearest neighbors are outputted in order of increasing distance to
`query`. `query`.
\tparam Tree must be an orthtree with traits which are a model of `CollectionPartitioningOrthtreeTraits` \tparam Tree must be `Orthtree<GT>` with `GT` being a model of `CollectionPartitioningOrthtreeTraits`
\tparam OutputIterator a model of `OutputIterator` that accepts `Point_d` objects. \tparam OutputIterator a model of `OutputIterator` that accepts `Point_d` objects.
\param orthtree the tree to search within \param orthtree the tree to search within
\param query query point. \param query query point
\param k number of neighbors. \param k number of neighbors to find
\param output output iterator. \param output output iterator
*/ */
template <typename Tree, typename OutputIterator> template <typename Tree, typename OutputIterator>
OutputIterator nearest_neighbors(const Tree& orthtree, const typename Tree::Point& query, OutputIterator nearest_neighbors(const Tree& orthtree, const typename Tree::Point& query,
@ -193,15 +190,15 @@ OutputIterator nearest_neighbors(const Tree& orthtree, const typename Tree::Poin
\ingroup PkgOrthtreeNeighbors \ingroup PkgOrthtreeNeighbors
\brief finds the points in the sphere `query`. \brief finds the points in the sphere `query`.
Nearest neighbors are outputted in order of increasing distance to Points are outputted in order of increasing distance to
the center of the sphere. the center of the sphere.
\tparam Tree must be an orthtree with traits which are a model of `CollectionPartitioningOrthtreeTraits` \tparam Tree must be `Orthtree<GT>` with `GT` being a model of `CollectionPartitioningOrthtreeTraits`
\tparam OutputIterator a model of `OutputIterator` that accepts `Point_d` objects. \tparam OutputIterator a model of `OutputIterator` that accepts `Point_d` objects.
\param orthtree the tree to search within \param orthtree the tree to search within
\param query query sphere. \param query query sphere
\param output output iterator. \param output output iterator
*/ */
template <typename Tree, typename OutputIterator> template <typename Tree, typename OutputIterator>
OutputIterator nearest_neighbors(const Tree& orthtree, const typename Tree::Sphere& query, OutputIterator output) { OutputIterator nearest_neighbors(const Tree& orthtree, const typename Tree::Sphere& query, OutputIterator output) {

View File

@ -18,6 +18,9 @@
namespace CGAL { namespace CGAL {
template <typename GeomTraits>
class Orthtree;
namespace Orthtrees { namespace Orthtrees {
/*! /*!
@ -39,10 +42,10 @@ public:
m_bucket_size(bucket_size) {} m_bucket_size(bucket_size) {}
/*! /*!
\brief returns `true` if `i` should be split, `false` otherwise. \brief returns `true` if the node with index `i` should be split, `false` otherwise.
*/ */
template<typename Node_index, typename Tree> template<typename GeomTraits>
bool operator()(Node_index i, const Tree &tree) const { bool operator()(typename Orthtree<GeomTraits>::Node_index i, const Orthtree<GeomTraits> &tree) const {
return (tree.data(i).size() > m_bucket_size); return (tree.data(i).size() > m_bucket_size);
} }
@ -66,10 +69,10 @@ public:
Maximum_depth(std::size_t max_depth) : m_max_depth(max_depth) {} Maximum_depth(std::size_t max_depth) : m_max_depth(max_depth) {}
/*! /*!
\brief returns `true` if `i` should be split, `false` otherwise. \brief returns `true` if the node with index `i` should be split, `false` otherwise.
*/ */
template<typename Node_index, typename Tree> template<typename GeomTraits>
bool operator()(Node_index i, const Tree &tree) const { bool operator()(typename Orthtree<GeomTraits>::Node_index i, const Orthtree<GeomTraits> &tree) const {
return (tree.depth(i) < m_max_depth); return (tree.depth(i) < m_max_depth);
} }
@ -102,10 +105,10 @@ public:
m_max_depth(max_depth), m_bucket_size(bucket_size) {} m_max_depth(max_depth), m_bucket_size(bucket_size) {}
/*! /*!
\brief returns `true` if `i` should be split, `false` otherwise. \brief returns `true` if the node with index `i` should be split, `false` otherwise.
*/ */
template<typename Node_index, typename Tree> template<typename GeomTraits>
bool operator()(Node_index i, const Tree &tree) const { bool operator()(typename Orthtree<GeomTraits>::Node_index i, const Orthtree<GeomTraits> &tree) const {
std::size_t num_points = tree.data(i).size(); std::size_t num_points = tree.data(i).size();
std::size_t depth = tree.depth(i); std::size_t depth = tree.depth(i);
return (num_points > m_bucket_size && depth < m_max_depth); return (num_points > m_bucket_size && depth < m_max_depth);

View File

@ -22,19 +22,14 @@
namespace CGAL { namespace CGAL {
/// \cond SKIP_IN_MANUAL
// todo: is this necessary?
// Forward declaration
template <typename T>
class Orthtree;
/// \endcond
namespace Orthtrees { namespace Orthtrees {
/*! /*!
\ingroup PkgOrthtreeTraversal \ingroup PkgOrthtreeTraversal
\brief A class used for performing a preorder traversal. \brief A class used for performing a preorder traversal.
\tparam Tree an instance of `Orthtree`
A preorder traversal starts from the root towards the leaves. A preorder traversal starts from the root towards the leaves.
\cgalModels{OrthtreeTraversal} \cgalModels{OrthtreeTraversal}
@ -77,6 +72,8 @@ public:
\ingroup PkgOrthtreeTraversal \ingroup PkgOrthtreeTraversal
\brief A class used for performing a postorder traversal. \brief A class used for performing a postorder traversal.
\tparam Tree an instance of `Orthtree`
A postorder traversal starts from the leaves towards the root. A postorder traversal starts from the leaves towards the root.
\cgalModels{OrthtreeTraversal} \cgalModels{OrthtreeTraversal}
@ -106,6 +103,8 @@ public:
\ingroup PkgOrthtreeTraversal \ingroup PkgOrthtreeTraversal
\brief A class used for performing a traversal on leaves only. \brief A class used for performing a traversal on leaves only.
\tparam Tree an instance of `Orthtree`
All non-leave nodes are ignored. All non-leave nodes are ignored.
\cgalModels{OrthtreeTraversal} \cgalModels{OrthtreeTraversal}
@ -142,7 +141,10 @@ public:
\ingroup PkgOrthtreeTraversal \ingroup PkgOrthtreeTraversal
\brief A class used for performing a traversal of a specific depth level. \brief A class used for performing a traversal of a specific depth level.
All trees at another depth are ignored. If the selected depth is \tparam Tree an instance of `Orthtree`
All tree nodes at another depth are ignored. If the selected depth is
All tree nodes at another depth are ignored. If the selected depth is
higher than the maximum depth of the orthtree, no node will be traversed. higher than the maximum depth of the orthtree, no node will be traversed.
\cgalModels{OrthtreeTraversal} \cgalModels{OrthtreeTraversal}
@ -190,7 +192,7 @@ public:
} }
}; };
} // Orthtree } // Orthtrees
} // CGAL } // CGAL
#endif //CGAL_ORTHTREE_TRAVERSALS_H #endif //CGAL_ORTHTREE_TRAVERSALS_H

View File

@ -28,10 +28,8 @@ namespace CGAL {
The class `Orthtree_traits_base_for_dimension` is a base class providing common choices for types and functors. The class `Orthtree_traits_base_for_dimension` is a base class providing common choices for types and functors.
The base class is extended by `CGAL::Orthtree_traits_point<GeomTraits, PointRange, PointMap, DimensionTag>` and by `CGAL::Orthtree_traits_face_graph<PolygonMesh, VertexPointMap>`. The base class is extended by `CGAL::Orthtree_traits_point<GeomTraits, PointRange, PointMap, DimensionTag>` and by `CGAL::Orthtree_traits_face_graph<PolygonMesh, VertexPointMap>`.
\tparam K model of `Kernel`. \tparam K a model of `Kernel`.
\tparam DimensionTag is a tag representing the dimension of the ambient Euclidean space. Must be `Dimension_tag<d>` where `d` is an integer. \tparam DimensionTag a tag representing the dimension of the ambient Euclidean space. Must be `Dimension_tag<d>` where `d` is an integer.
\cgalModels{OrthtreeTraits}
\sa `CGAL::Orthtree_traits_point<GeomTraits, PointRange, PointMap, DimensionTag>` \sa `CGAL::Orthtree_traits_point<GeomTraits, PointRange, PointMap, DimensionTag>`
\sa `CGAL::Orthtree_traits_face_graph<PolygonMesh, VertexPointMap>` \sa `CGAL::Orthtree_traits_face_graph<PolygonMesh, VertexPointMap>`
@ -50,25 +48,25 @@ struct Orthtree_traits_base_for_dimension {
using Sphere_d = typename K::Sphere_d; using Sphere_d = typename K::Sphere_d;
using Cartesian_const_iterator_d = typename K::Cartesian_const_iterator_d; using Cartesian_const_iterator_d = typename K::Cartesian_const_iterator_d;
/*! /*!
Adjacency type. * Adjacency type.
*
\note This type is used to identify adjacency directions with * \note This type is used to identify adjacency directions with
easily understandable keywords (left, right, up, etc.) and is thus * easily understandable keywords (left, right, up, down, ...) and is thus
mainly useful for `Dimension_tag<2>` and `Dimension_tag<3>`. In * mainly useful for `Dimension_tag<2>` and `Dimension_tag<3>`. In
higher dimensions, such keywords do not exist and this type is * higher dimensions, such keywords do not exist and this type is
simply an integer. Conversions from this integer to bitsets still * simply an integer. Conversions from this integer to bitsets still
work but do not provide any easier API for adjacency selection. * work but do not provide any user-friendly API for adjacency selection.
*
Two directions along each axis in %Cartesian space, relative to a node. * Two directions along each axis in %Cartesian space, relative to a node.
*
Directions are mapped to numbers as 3-bit integers in the 3d case or as 2-bit integers in the 2d case. * Directions are mapped to numbers as 3-bit integers in the 3d case or as 2-bit integers in the 2d case.
In the 3d case the numbers 6 and 7 are not used because there are only 6 different directions. * In the 3d case the numbers 6 and 7 are not used because there are only 6 different directions.
*
The first two bits indicate the axis (00 = x, 01 = y, 10 = z), * The first two bits indicate the axis (00 = x, 01 = y, 10 = z),
the third bit indicates the direction along that axis (0 = -, 1 = +). * the third bit indicates the direction along that axis (0 = -, 1 = +).
*
The following diagram showing the 3d case may be a useful reference: * The following diagram and table showing the 3d case may be a useful reference (2d case is identical with one dimension less):
*
* 3 * * 3 *
* | * 4 * | * 4
* | / y+ * | / y+
@ -94,8 +92,6 @@ struct Orthtree_traits_base_for_dimension {
using Adjacency = int; using Adjacency = int;
/// @} /// @}
/// \name Operations
/// @{
auto construct_point_d_object() const { auto construct_point_d_object() const {
return [](auto... Args) -> Point_d { return [](auto... Args) -> Point_d {
std::initializer_list<FT> args_list{Args...}; std::initializer_list<FT> args_list{Args...};
@ -108,13 +104,10 @@ struct Orthtree_traits_base_for_dimension {
return a < b; return a < b;
}; };
} }
/// @}
}; };
template <typename K> template <typename K>
struct Orthtree_traits_base_for_dimension<K, Dimension_tag<2>> { struct Orthtree_traits_base_for_dimension<K, Dimension_tag<2>> {
/// \name Types
/// @{
using Node_index = std::size_t; using Node_index = std::size_t;
using Kernel = K; using Kernel = K;
using Dimension = Dimension_tag<2>; using Dimension = Dimension_tag<2>;
@ -130,10 +123,7 @@ struct Orthtree_traits_base_for_dimension<K, Dimension_tag<2>> {
DOWN, DOWN,
UP UP
}; };
/// @}
/// \name Operations
/// @{
auto construct_point_d_object() const { auto construct_point_d_object() const {
return [](const FT& x, const FT& y) -> Point_d { return [](const FT& x, const FT& y) -> Point_d {
return {x, y}; return {x, y};
@ -145,13 +135,10 @@ struct Orthtree_traits_base_for_dimension<K, Dimension_tag<2>> {
return a < b; return a < b;
}; };
} }
/// @}
}; };
template <typename K> template <typename K>
struct Orthtree_traits_base_for_dimension<K, Dimension_tag<3>> { struct Orthtree_traits_base_for_dimension<K, Dimension_tag<3>> {
/// \name Types
/// @{
using Node_index = std::size_t; using Node_index = std::size_t;
using Kernel = K; using Kernel = K;
using Dimension = Dimension_tag<3>; using Dimension = Dimension_tag<3>;
@ -169,7 +156,7 @@ struct Orthtree_traits_base_for_dimension<K, Dimension_tag<3>> {
BACK, BACK,
FRONT FRONT
}; };
/// \cond SKIP_IN_MANUAL
enum Child { enum Child {
LEFT_BOTTOM_BACK, LEFT_BOTTOM_BACK,
RIGHT_BOTTOM_BACK, RIGHT_BOTTOM_BACK,
@ -180,11 +167,7 @@ struct Orthtree_traits_base_for_dimension<K, Dimension_tag<3>> {
LEFT_TOP_FRONT, LEFT_TOP_FRONT,
RIGHT_TOP_FRONT RIGHT_TOP_FRONT
}; };
/// \endcond
/// @}
/// \name Operations
/// @{
auto construct_point_d_object() const { auto construct_point_d_object() const {
return [](const FT& x, const FT& y, const FT& z) -> Point_d { return [](const FT& x, const FT& y, const FT& z) -> Point_d {
return {x, y, z}; return {x, y, z};
@ -196,7 +179,6 @@ struct Orthtree_traits_base_for_dimension<K, Dimension_tag<3>> {
return a < b; return a < b;
}; };
} }
/// @}
}; };
} }

View File

@ -35,10 +35,7 @@ to which the minimal extend of a node should be provided.
\tparam TriangleMesh a model of `FaceListGraph` with all faces being triangles \tparam TriangleMesh a model of `FaceListGraph` with all faces being triangles
\tparam VertexPointMap a property map associating points to the vertices of `TriangleMesh` \tparam VertexPointMap a property map associating points to the vertices of `TriangleMesh`
\todo check how to adapt to non regular splits (cubes vs rectangular cuboid)
\cgalModels{OrthtreeTraits} \cgalModels{OrthtreeTraits}
\sa `CGAL::Orthtree_traits_base_for_dimension<GeomTraits, DimensionTag>`
*/ */
template <class TriangleMesh, class VertexPointMap> template <class TriangleMesh, class VertexPointMap>
struct Orthtree_traits_face_graph : public Orthtree_traits_base_for_dimension< struct Orthtree_traits_face_graph : public Orthtree_traits_base_for_dimension<
@ -129,15 +126,21 @@ struct Orthtree_traits_face_graph : public Orthtree_traits_base_for_dimension<
/// Recommended split predicate to pass to `Orthtree::refine()` function so /// Recommended split predicate to pass to `Orthtree::refine()` function so
/// that the octree is refined until a node is either empty or has an extent /// that the octree is refined until a node is either empty or has an extent
/// that would be smaller after split than the value provided to the constructor. /// that would be smaller after split than the corresponding value provided to the constructor.
class Split_predicate_node_min_extent { class Split_predicate_node_min_extent {
FT m_min_extent; std::array<FT, 3> m_min_extent;
public: public:
/// constructor with `me` being the minimal value a node extent could be. /// constructor with `me` being the minimal value a node extent could be
Split_predicate_node_min_extent(FT me) /// (same value for all dimension).
Split_predicate_node_min_extent(const FT& me)
: m_min_extent({me, me, me}) {}
/// constructor with `me` being the minimal value a node extent could be
/// (one value per dimension).
Split_predicate_node_min_extent(const std::array<FT, 3>& me)
: m_min_extent(me) {} : m_min_extent(me) {}
/*! /*!
@ -150,7 +153,7 @@ struct Orthtree_traits_face_graph : public Orthtree_traits_base_for_dimension<
Bbox_d bb = tree.bbox(ni); Bbox_d bb = tree.bbox(ni);
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)
if (((bb.max)()[i] - (bb.min)()[i]) < 2 * m_min_extent) if (((bb.max)()[i] - (bb.min)()[i]) < 2 * m_min_extent[i])
return false; return false;
return true; return true;
} }

View File

@ -62,16 +62,16 @@ void reassign_points(
/*! /*!
\ingroup PkgOrthtreeTraits \ingroup PkgOrthtreeTraits
The class `Orthtree_traits_point` can be used as a template parameter of Traits class for defining an orthtree of points using the class `CGAL::Orthtree`.
the `Orthtree` class.
\tparam GeomTraits model of `Kernel`. \tparam GeomTraits model of `Kernel`.
\tparam PointRange must be a model of `Range` whose value type is the key type of `PointMap` \tparam PointRange must be a model of `Range` whose value type is the key type of `PointMap` and whose iterator type is model of `RandomAccessIterator`
\tparam PointMap must be a model of `ReadablePropertyMap` whose value type is `GeomTraits::Traits::Point_d` \tparam PointMap must be a model of `ReadablePropertyMap` whose value type is a point type from `GeomTraits` matching the current dimension
\tparam DimensionTag a tag representing the dimension of the ambient Euclidean space. Must be `Dimension_tag<d>` where `d` is an integer.
\warning The input point set is not copied. It is used directly \warning The input point set is not copied. It is used directly
and is rearranged by the `Orthtree`. Altering the point range and is rearranged by the `Orthtree`. Altering the point range
after creating the orthtree might leave it in an invalid state. after creating the orthtree will leave it in an invalid state.
\cgalModels{OrthtreeTraits} \cgalModels{OrthtreeTraits}
\sa `CGAL::Octree` \sa `CGAL::Octree`
@ -89,27 +89,24 @@ template <
> >
struct Orthtree_traits_point : public Orthtree_traits_base_for_dimension<GeomTraits, DimensionTag> { struct Orthtree_traits_point : public Orthtree_traits_base_for_dimension<GeomTraits, DimensionTag> {
public: public:
/// \name Types /// \name Types
/// @{ /// @{
using Node_data = boost::iterator_range<typename PointRange::iterator>;
/// @}
using Base = Orthtree_traits_base_for_dimension<GeomTraits, DimensionTag>; using Base = Orthtree_traits_base_for_dimension<GeomTraits, DimensionTag>;
using Self = Orthtree_traits_point<GeomTraits, PointRange, PointMap, DimensionTag>; using Self = Orthtree_traits_point<GeomTraits, PointRange, PointMap, DimensionTag>;
using Tree = Orthtree<Self>; using Tree = Orthtree<Self>;
using Node_data = boost::iterator_range<typename PointRange::iterator>;
using Node_data_element = typename std::iterator_traits<typename PointRange::iterator>::value_type; using Node_data_element = typename std::iterator_traits<typename PointRange::iterator>::value_type;
using Node_index = typename Base::Node_index; using Node_index = typename Base::Node_index;
/// @}
Orthtree_traits_point( Orthtree_traits_point(
PointRange& points, PointRange& points,
PointMap point_map = PointMap() PointMap point_map = PointMap()
) : m_points(points), m_point_map(point_map) {} ) : m_points(points), m_point_map(point_map) {}
/// \name Operations
/// @{
auto construct_root_node_bbox_object() const { auto construct_root_node_bbox_object() const {
return [&]() -> typename Self::Bbox_d { return [&]() -> typename Self::Bbox_d {
@ -161,8 +158,6 @@ public:
}; };
} }
/// @}
private: private:
PointRange& m_points; PointRange& m_points;

View File

@ -22,11 +22,7 @@ namespace CGAL {
/*! /*!
\ingroup PkgOrthtreeRef \ingroup PkgOrthtreeRef
\brief Alias that specializes the `Orthtree` class to a 2D quadtree. \brief Alias that specializes the `Orthtree` class to a 2D quadtree storing 2D points.
These two types are exactly equivalent:
- `Quadtree<GeomTraits, PointRange, PointMap>`
- `Orthtree<Orthtree_traits_point<GeomTraits, PointRange, PointMap, Dimension_tag<2>>>`.
\tparam GeomTraits must be a model of `Kernel` \tparam GeomTraits must be a model of `Kernel`
\tparam PointRange must be a model of `Range` whose value type is the key type of `PointMap` \tparam PointRange must be a model of `Range` whose value type is the key type of `PointMap`