From 0f8440da4e5f30eb450ab92f75b0dd4b72c27e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 24 Mar 2025 18:43:05 +0100 Subject: [PATCH] use dedicated namespace --- .../include/CGAL/poisson_eliminate.h | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/poisson_eliminate.h b/Point_set_processing_3/include/CGAL/poisson_eliminate.h index 8629d63ae59..9933e696b23 100644 --- a/Point_set_processing_3/include/CGAL/poisson_eliminate.h +++ b/Point_set_processing_3/include/CGAL/poisson_eliminate.h @@ -28,7 +28,7 @@ namespace CGAL { -namespace internal { +namespace poisson_eliminate_impl { double get_maximum_radius(std::size_t dimension, std::size_t sample_size, double domain_size) { double sampleArea = domain_size / double(sample_size); @@ -103,7 +103,7 @@ public: if (range.size() > k) return get(point_map, *(range.begin() + k)); else - return tiling_points[k - range.size()]; + return tiling_points.at(k - range.size()); } friend reference get(const Indexed_extended_point_map& ppmap, key_type k) { @@ -111,7 +111,7 @@ public: if ((k < ppmap.range.size())) return get(ppmap.point_map, *(ppmap.range.begin() + k)); else - return ppmap.tiling_points[k - ppmap.range.size()]; + return ppmap.tiling_points.at(k - ppmap.range.size()); } }; @@ -281,19 +281,19 @@ void poisson_eliminate(const PointRange &points, std::size_t number_of_points, O using Point = typename boost::property_traits::value_type; using GeomTraits = typename NP_helper::Geom_traits; using FT = typename GeomTraits::FT; - using IPM = internal::Indexed_extended_point_map; + using IPM = poisson_eliminate_impl::Indexed_extended_point_map; PointMap point_map = NP_helper::get_const_point_map(points, np); const unsigned int ambient_dimension = CGAL::Ambient_dimension::value; - using Search_base = internal::Search_traits; + using Search_base = poisson_eliminate_impl::Search_traits; using Search_traits = CGAL::Search_traits_adapter; using Splitter = CGAL::Sliding_midpoint; using Fuzzy_sphere = CGAL::Fuzzy_sphere; using Tree = CGAL::Kd_tree; - internal::Compute_squared_distance squared_distance; + poisson_eliminate_impl::Compute_squared_distance squared_distance; // hard coded parameters alpha, beta and gamma with values proposed in publication const double alpha = 8; @@ -329,10 +329,10 @@ void poisson_eliminate(const PointRange &points, std::size_t number_of_points, O domain_size *= CGAL::to_double(upper[i] - lower[i]); // named parameter for r_max - double r_max = CGAL::to_double(parameters::choose_parameter(parameters::get_parameter(np, internal_np::maximum_radius), 2 * internal::get_maximum_radius(dimension, number_of_points, domain_size))); - double r_min = CGAL::to_double(weight_limiting ? internal::get_minimum_radius(points.size(), number_of_points, beta, gamma, r_max) : 0); + double r_max = CGAL::to_double(parameters::choose_parameter(parameters::get_parameter(np, internal_np::maximum_radius), 2 * poisson_eliminate_impl::get_maximum_radius(dimension, number_of_points, domain_size))); + double r_min = CGAL::to_double(weight_limiting ? poisson_eliminate_impl::get_minimum_radius(points.size(), number_of_points, beta, gamma, r_max) : 0); - auto weight_functor = parameters::choose_parameter(parameters::get_parameter(np, internal_np::weight_function), internal::Weight_functor(r_min, alpha)); + auto weight_functor = parameters::choose_parameter(parameters::get_parameter(np, internal_np::weight_function), poisson_eliminate_impl::Weight_functor(r_min, alpha)); std::size_t heap_size = points.size(); std::vector tiling_points; @@ -346,7 +346,7 @@ void poisson_eliminate(const PointRange &points, std::size_t number_of_points, O if (lower[int(dim)] > (*(it + dim) - r_max)) { FT v = 2 * lower[int(dim)] - (*(it + dim)); Point p2; - internal::copy_and_replace(p, p2, dim, v); + poisson_eliminate_impl::copy_and_replace(p, p2, dim, v); tiling_points.emplace_back(p2); if (dim + 1 < CGAL::Ambient_dimension::value) self(self, tiling_points.back(), dim + 1); @@ -355,7 +355,7 @@ void poisson_eliminate(const PointRange &points, std::size_t number_of_points, O if (upper[int(dim)] < (*(it + dim) + r_max)) { FT v = 2 * upper[int(dim)]- (*(it + dim)); Point p2; - internal::copy_and_replace(p, p2, dim, v); + poisson_eliminate_impl::copy_and_replace(p, p2, dim, v); tiling_points.emplace_back(p2); if (dim + 1 < CGAL::Ambient_dimension::value) self(self, tiling_points.back(), dim + 1); @@ -373,7 +373,9 @@ void poisson_eliminate(const PointRange &points, std::size_t number_of_points, O } // Tiling requires either to copy the point range or to use a special Index_property_map with a second array of points to keep the input range const. - Tree tree(boost::counting_iterator(0), boost::counting_iterator(points.size() + tiling_points.size()), Splitter(), Search_traits(ipm)); + Tree tree(boost::counting_iterator(0), + boost::counting_iterator(points.size() + tiling_points.size()), + Splitter(), Search_traits(ipm)); tree.build(); std::vector heap(boost::counting_iterator(0), boost::counting_iterator(points.size())); @@ -385,7 +387,7 @@ void poisson_eliminate(const PointRange &points, std::size_t number_of_points, O // Computing weights std::vector weights(points.size(), 0); std::vector res; - for (std::size_t i = 0; i < heap_size; i++) { + for (std::size_t i = 0; i < heap_size; ++i) { const Point& p = get(ipm, heap[i]); res.clear(); tree.search(std::back_inserter(res), Fuzzy_sphere(p, r_max, 0, Search_traits(ipm))); @@ -413,7 +415,7 @@ void poisson_eliminate(const PointRange &points, std::size_t number_of_points, O while (heap_size > target_points) { std::size_t i = heap[0]; - internal::pop_heap(heap, heap_pos, heap_size, weights); + poisson_eliminate_impl::pop_heap(heap, heap_pos, heap_size, weights); // Adjust weights of neighbors res.clear(); @@ -429,7 +431,7 @@ void poisson_eliminate(const PointRange &points, std::size_t number_of_points, O weights[res[n]] -= weight_functor(p2, p, d2, r_max); - internal::move_down(heap, heap_pos, heap_size, weights, heap_pos[res[n]]); + poisson_eliminate_impl::move_down(heap, heap_pos, heap_size, weights, heap_pos[res[n]]); } }