mirror of https://github.com/CGAL/cgal
Eliminate Array and Construct_point_d_from_array
This commit is contained in:
parent
bf5bbcc0f1
commit
32c6d61f27
|
|
@ -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;
|
||||
|
||||
/// @}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ public:
|
|||
%Cartesian coordinates of a point.
|
||||
*/
|
||||
typedef unspecified_type Cartesian_const_iterator_d;
|
||||
typedef std::array<FT, Dimension::value> 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<min, max>, where min and max represent cartesian corners which define a bounding box
|
||||
*/
|
||||
std::pair<Array, Array> root_node_bbox() const;
|
||||
Bbox_d root_node_bbox() const;
|
||||
|
||||
/*!
|
||||
* \brief Initializes the contained elements for the root node.
|
||||
|
|
|
|||
|
|
@ -23,11 +23,6 @@ struct Orthtree_traits_empty_2 : public Orthtree_traits_2_base<K> {
|
|||
|
||||
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<decltype(&Self::construct_point_d_from_array_object), Self>;
|
||||
|
||||
auto root_node_bbox_object() const {
|
||||
return [&]() -> typename Self::Bbox_d { return m_bbox; };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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<FT, Dimension::value>; // todo: This should have a more descriptive name
|
||||
|
||||
/*!
|
||||
* \brief Two directions along each axis in Cartesian space, relative to a node.
|
||||
|
|
|
|||
|
|
@ -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<FT, Dimension::value>; // todo: This should have a more descriptive name
|
||||
|
||||
/*!
|
||||
* \brief Two directions along each axis in Cartesian space, relative to a node.
|
||||
|
|
|
|||
|
|
@ -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<FT, Dimension::value>;
|
||||
|
||||
/*!
|
||||
Adjacency type.
|
||||
|
|
|
|||
|
|
@ -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<Point_d>::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<FT, Dimension::value> 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)};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,21 +57,6 @@ public:
|
|||
using Node_data = boost::iterator_range<typename PointSet::iterator>;
|
||||
using Node_data_element = typename std::iterator_traits<typename PointSet::iterator>::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<typename Self::FT, Self::Dimension::value> bbox_min, bbox_max;
|
||||
Orthtrees::internal::Cartesian_ranges<Self> 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)};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,21 +57,6 @@ public:
|
|||
using Node_data = boost::iterator_range<typename PointSet::iterator>;
|
||||
using Node_data_element = typename std::iterator_traits<typename PointSet::iterator>::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<typename Self::FT, Self::Dimension::value> bbox_min, bbox_max;
|
||||
Orthtrees::internal::Cartesian_ranges<Self> 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)};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,21 +93,6 @@ public:
|
|||
using Node_data = boost::iterator_range<typename PointSet::iterator>;
|
||||
using Node_data_element = typename std::iterator_traits<typename PointSet::iterator>::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<typename Self::FT, Self::Dimension::value> bbox_min, bbox_max;
|
||||
Orthtrees::internal::Cartesian_ranges<Self> 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)};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue