diff --git a/Orthtree/doc/Orthtree/Concepts/CollectionPartitioningOrthtreeTraits.h b/Orthtree/doc/Orthtree/Concepts/CollectionPartitioningOrthtreeTraits.h index 0d6f1f0222a..e56e8578668 100644 --- a/Orthtree/doc/Orthtree/Concepts/CollectionPartitioningOrthtreeTraits.h +++ b/Orthtree/doc/Orthtree/Concepts/CollectionPartitioningOrthtreeTraits.h @@ -49,6 +49,9 @@ public: /// \name Operations /// @{ + /*! + Function used to construct an object of type `Get_geometric_object_for_element`. + */ Get_geometric_object_for_element get_geometric_object_for_element_object() const; /// @} diff --git a/Orthtree/doc/Orthtree/Concepts/OrthtreeTraits.h b/Orthtree/doc/Orthtree/Concepts/OrthtreeTraits.h index 09837bfbbd0..fc9e369659f 100644 --- a/Orthtree/doc/Orthtree/Concepts/OrthtreeTraits.h +++ b/Orthtree/doc/Orthtree/Concepts/OrthtreeTraits.h @@ -27,7 +27,6 @@ public: %Cartesian coordinates of a point. */ typedef unspecified_type Cartesian_const_iterator_d; - typedef std::array Array; ///< Array used for easy point constructions. /*! @@ -38,9 +37,9 @@ public: typedef unspecified_type Adjacency; ///< Specify the adjacency directions /*! - Functor with an operator to construct a `Point_d` from an `Array` object. + Functor with an operator to construct a `Point_d` from an appropriate number of x, y, z etc. FT arguments. */ - typedef unspecified_type Construct_point_d_from_array; + typedef unspecified_type Construct_point_d; /// @} @@ -48,9 +47,9 @@ public: /// @{ /*! - Function used to construct an object of type `Construct_point_d_from_array`. + Function used to construct an object of type `Construct_point_d`. */ - Construct_point_d_from_array construct_point_d_from_array_object() const; + Construct_point_d construct_point_d() const; /*! * \brief Produces a bounding box which encloses the contents of the tree @@ -61,7 +60,7 @@ public: * * @return std::pair, where min and max represent cartesian corners which define a bounding box */ - std::pair root_node_bbox() const; + Bbox_d root_node_bbox() const; /*! * \brief Initializes the contained elements for the root node. diff --git a/Orthtree/examples/Orthtree/quadtree_build_manually.cpp b/Orthtree/examples/Orthtree/quadtree_build_manually.cpp index 9cfa40d7419..55be9e46ed6 100644 --- a/Orthtree/examples/Orthtree/quadtree_build_manually.cpp +++ b/Orthtree/examples/Orthtree/quadtree_build_manually.cpp @@ -23,11 +23,6 @@ struct Orthtree_traits_empty_2 : public Orthtree_traits_2_base { Orthtree_traits_empty_2(typename Self::Bbox_d bbox) : m_bbox(bbox) {}; - auto construct_point_d_from_array_object() const { - return [](const typename Self::Array& array) -> typename Self::Point_d { return {array[0], array[1]}; }; - } - using Construct_point_d_from_array = std::invoke_result_t; - auto root_node_bbox_object() const { return [&]() -> typename Self::Bbox_d { return m_bbox; }; } diff --git a/Orthtree/include/CGAL/Orthtree.h b/Orthtree/include/CGAL/Orthtree.h index 998255cc2c0..9172e5d3e23 100644 --- a/Orthtree/include/CGAL/Orthtree.h +++ b/Orthtree/include/CGAL/Orthtree.h @@ -85,9 +85,6 @@ public: typedef typename Traits::Node_data Node_data; // todo: Node_data_element will only exist for certain Traits types, so I don't know if it can be re-exported - /// \cond SKIP_IN_MANUAL - typedef typename Traits::Array Array; ///< Array type. - /// \endcond /// @} /// \name Public Types @@ -802,7 +799,7 @@ public: Bbox_dimensions size = m_side_per_depth[depth(n)]; // Determine the location this node should be split - Array bary; + Bbox_dimensions bary; std::size_t i = 0; for (const FT& f: cartesian_range(m_bbox_min)) { bary[i] = FT(global_coordinates(n)[i]) * size[i] + size[i] / FT(2) + f; @@ -810,9 +807,7 @@ public: } // Convert that location into a point - auto construct_point_d_from_array - = m_traits.construct_point_d_from_array_object(); - return construct_point_d_from_array(bary); + return std::apply(m_traits.construct_point_d_object(), bary); } static bool is_topology_equal(Node_index lhsNode, const Self& lhsTree, Node_index rhsNode, const Self& rhsTree) { diff --git a/Orthtree/include/CGAL/Orthtree_traits_2_base.h b/Orthtree/include/CGAL/Orthtree_traits_2_base.h index 620089c0098..eb8393f48e6 100644 --- a/Orthtree/include/CGAL/Orthtree_traits_2_base.h +++ b/Orthtree/include/CGAL/Orthtree_traits_2_base.h @@ -47,7 +47,6 @@ public: using Bbox_d = typename K::Iso_rectangle_2; using Sphere_d = typename K::Circle_2; using Cartesian_const_iterator_d = typename K::Cartesian_const_iterator_2; - using Array = std::array; // todo: This should have a more descriptive name /*! * \brief Two directions along each axis in Cartesian space, relative to a node. diff --git a/Orthtree/include/CGAL/Orthtree_traits_3_base.h b/Orthtree/include/CGAL/Orthtree_traits_3_base.h index 1cf7c8327a3..4ad143f1be4 100644 --- a/Orthtree/include/CGAL/Orthtree_traits_3_base.h +++ b/Orthtree/include/CGAL/Orthtree_traits_3_base.h @@ -48,7 +48,6 @@ public: using Bbox_d = typename K::Iso_cuboid_3; using Sphere_d = typename K::Sphere_3; using Cartesian_const_iterator_d = typename K::Cartesian_const_iterator_3; - using Array = std::array; // todo: This should have a more descriptive name /*! * \brief Two directions along each axis in Cartesian space, relative to a node. diff --git a/Orthtree/include/CGAL/Orthtree_traits_d_base.h b/Orthtree/include/CGAL/Orthtree_traits_d_base.h index 279d37c03a5..7851c397087 100644 --- a/Orthtree/include/CGAL/Orthtree_traits_d_base.h +++ b/Orthtree/include/CGAL/Orthtree_traits_d_base.h @@ -45,7 +45,6 @@ public: using Bbox_d = typename K::Iso_box_d; using Sphere_d = typename K::Sphere_d; using Cartesian_const_iterator_d = typename K::Cartesian_const_iterator_d; - using Array = std::array; /*! Adjacency type. diff --git a/Orthtree/include/CGAL/Orthtree_traits_face_graph.h b/Orthtree/include/CGAL/Orthtree_traits_face_graph.h index 01b709efc35..084baed7b4d 100644 --- a/Orthtree/include/CGAL/Orthtree_traits_face_graph.h +++ b/Orthtree/include/CGAL/Orthtree_traits_face_graph.h @@ -36,8 +36,6 @@ struct Orthtree_traits_face_graph using Dimension = typename Self::Dimension; using Bbox_d = typename Self::Bbox_d; using FT = typename Self::FT; - using Sphere_d = typename Self::Sphere_d; // SL: why? - using Array = typename Self::Array; // SL: why? using Cartesian_const_iterator_d = typename Self::Cartesian_const_iterator_d; // SL: these could be considered as built-in data and if the typedefs are not present, the tree have none @@ -45,19 +43,10 @@ struct Orthtree_traits_face_graph using Geom_traits = typename Kernel_traits::type; - // SL: why? - struct Construct_point_d_from_array { - Point_d operator()(const Array& array) const { - return Point_d(array[0], array[1], array[2]); - } - }; - - Construct_point_d_from_array construct_point_d_from_array_object() const { return Construct_point_d_from_array(); } - auto root_node_bbox_object() const { return [&]() -> Bbox_d { - Array min = {0.0, 0}, max = {0.0, 0}; + std::array min = {0.0, 0}, max = {0.0, 0}; if (faces(m_pm).begin() != faces(m_pm).end()) { const Point_d& p = get(m_vpm, *vertices(m_pm).begin()); min = {p.x(), p.y(), p.z()}; @@ -71,8 +60,8 @@ struct Orthtree_traits_face_graph } } - return {construct_point_d_from_array_object()(min), - construct_point_d_from_array_object()(max)}; + return {std::apply(Self::construct_point_d_object(), min), + std::apply(Self::construct_point_d_object(), max)}; }; } diff --git a/Orthtree/include/CGAL/Orthtree_traits_point_2.h b/Orthtree/include/CGAL/Orthtree_traits_point_2.h index ff52558d1e8..165eca646b8 100644 --- a/Orthtree/include/CGAL/Orthtree_traits_point_2.h +++ b/Orthtree/include/CGAL/Orthtree_traits_point_2.h @@ -57,21 +57,6 @@ public: using Node_data = boost::iterator_range; using Node_data_element = typename std::iterator_traits::value_type; -#ifdef DOXYGEN_RUNNING - /*! - Functor with an operator to construct a `Point_d` from an `Array` object. - */ - typedef unspecified_type Construct_point_d_from_array; -#else - struct Construct_point_d_from_array - { - typename Self::Point_d operator() (const typename Self::Array& array) const - { - return typename Self::Point_d (array[0], array[1]); - } - }; -#endif - /// @} Orthtree_traits_point_2( @@ -82,16 +67,10 @@ public: /// \name Operations /// @{ - /*! - Function used to construct an object of type `Construct_point_d_from_array`. - */ - Construct_point_d_from_array construct_point_d_from_array_object() const { return Construct_point_d_from_array(); } - auto root_node_bbox_object() const { return [&]() -> typename Self::Bbox_d { - typename Self::Array bbox_min; - typename Self::Array bbox_max; + std::array bbox_min, bbox_max; Orthtrees::internal::Cartesian_ranges cartesian_range; // init bbox with first values found @@ -115,8 +94,8 @@ public: } } - return {construct_point_d_from_array_object()(bbox_min), - construct_point_d_from_array_object()(bbox_max)}; + return {std::apply(Self::construct_point_d_object(), bbox_min), + std::apply(Self::construct_point_d_object(), bbox_max)}; }; } diff --git a/Orthtree/include/CGAL/Orthtree_traits_point_3.h b/Orthtree/include/CGAL/Orthtree_traits_point_3.h index 9bd3a12cd04..e3f52f67be8 100644 --- a/Orthtree/include/CGAL/Orthtree_traits_point_3.h +++ b/Orthtree/include/CGAL/Orthtree_traits_point_3.h @@ -57,21 +57,6 @@ public: using Node_data = boost::iterator_range; using Node_data_element = typename std::iterator_traits::value_type; -#ifdef DOXYGEN_RUNNING - /*! - Functor with an operator to construct a `Point_d` from an `Array` object. - */ - typedef unspecified_type Construct_point_d_from_array; -#else - - struct Construct_point_d_from_array { - typename Self::Point_d operator()(const typename Self::Array& array) const { - return typename Self::Point_d(array[0], array[1], array[2]); - } - }; - -#endif - /// @} Orthtree_traits_point_3( @@ -82,16 +67,10 @@ public: /// \name Operations /// @{ - /*! - Function used to construct an object of type `Construct_point_d_from_array`. - */ - Construct_point_d_from_array construct_point_d_from_array_object() const { return Construct_point_d_from_array(); } - auto root_node_bbox_object() const { return [&]() -> typename Self::Bbox_d { - typename Self::Array bbox_min; - typename Self::Array bbox_max; + std::array bbox_min, bbox_max; Orthtrees::internal::Cartesian_ranges cartesian_range; // init bbox with first values found @@ -115,8 +94,8 @@ public: } } - return {construct_point_d_from_array_object()(bbox_min), - construct_point_d_from_array_object()(bbox_max)}; + return {std::apply(Self::construct_point_d_object(), bbox_min), + std::apply(Self::construct_point_d_object(), bbox_max)}; }; } diff --git a/Orthtree/include/CGAL/Orthtree_traits_point_d.h b/Orthtree/include/CGAL/Orthtree_traits_point_d.h index 48d3a905690..807b0a2ab7e 100644 --- a/Orthtree/include/CGAL/Orthtree_traits_point_d.h +++ b/Orthtree/include/CGAL/Orthtree_traits_point_d.h @@ -93,21 +93,6 @@ public: using Node_data = boost::iterator_range; using Node_data_element = typename std::iterator_traits::value_type; -#ifdef DOXYGEN_RUNNING - /*! - Functor with an operator to construct a `Point_d` from an `Array` object. - */ - typedef unspecified_type Construct_point_d_from_array; -#else - - struct Construct_point_d_from_array { - typename Self::Point_d operator()(const typename Self::Array& array) const { - return typename Self::Point_d(array.size(), array.begin(), array.end()); - } - }; - -#endif - /// @} Orthtree_traits_point_d( @@ -118,16 +103,10 @@ public: /// \name Operations /// @{ - /*! - Function used to construct an object of type `Construct_point_d_from_array`. - */ - Construct_point_d_from_array construct_point_d_from_array_object() const { return Construct_point_d_from_array(); } - auto root_node_bbox_object() const { return [&]() -> typename Self::Bbox_d { - typename Self::Array bbox_min; - typename Self::Array bbox_max; + std::array bbox_min, bbox_max; Orthtrees::internal::Cartesian_ranges cartesian_range; // init bbox with first values found @@ -151,8 +130,8 @@ public: } } - return {construct_point_d_from_array_object()(bbox_min), - construct_point_d_from_array_object()(bbox_max)}; + return {std::apply(Self::construct_point_d_object(), bbox_min), + std::apply(Self::construct_point_d_object(), bbox_max)}; }; }