From c255b51b4bddfb9f01327e3f18276cd4392ad742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 29 Nov 2022 12:15:24 +0100 Subject: [PATCH] Generalize orthosphere radius threshold computation to non-cubic domains --- .../CGAL/Periodic_3_regular_triangulation_3.h | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h index d59967f0055..194baf7f15f 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h @@ -181,7 +181,7 @@ private: FT orthosphere_radius_threshold; /// This container stores all the cells whose orthosphere radius is larger - /// than the treshold `orthosphere_radius_threshold`. + /// than the threshold `orthosphere_radius_threshold`. boost::unordered_set cells_with_too_big_orthoball; class Cover_manager @@ -220,13 +220,20 @@ public: }; public: + FT compute_cover_threshold() const + { + FT min_span = (std::min)({ domain().xmax() - domain().xmin(), + domain().ymax() - domain().ymin(), + domain().zmax() - domain().zmin() }); + return FT(0.015625) * CGAL::square(min_span); + } + /** @name Creation */ Periodic_3_regular_triangulation_3(const Iso_cuboid& domain = Iso_cuboid(0, 0, 0, 1, 1, 1), const Geometric_traits& gt = Geometric_traits()) : Tr_Base(domain, gt) { - orthosphere_radius_threshold = FT(0.015625) * (domain.xmax() - domain.xmin()) - * (domain.xmax() - domain.xmin()); + orthosphere_radius_threshold = compute_cover_threshold(); } template < typename InputIterator > @@ -236,8 +243,7 @@ public: bool is_large_point_set = false) : Tr_Base(domain, gt) { - orthosphere_radius_threshold = FT(0.015625) * (domain.xmax() - domain.xmin()) - * (domain.xmax() - domain.xmin()); + orthosphere_radius_threshold = compute_cover_threshold(); insert(first, last, is_large_point_set); } @@ -383,8 +389,7 @@ public: virtual void update_cover_data_after_setting_domain () { - orthosphere_radius_threshold = FT(0.015625) * (domain().xmax() - domain().xmin()) - * (domain().xmax() - domain().xmin()); + orthosphere_radius_threshold = compute_cover_threshold(); } // the function below is used in `convert_to_1_sheeted_covering()` of P3T3 @@ -1750,8 +1755,7 @@ operator>> (std::istream& is, Periodic_3_regular_triangulation_3& tr) is >> static_cast(tr); - tr.orthosphere_radius_threshold = FT(0.015625) * (tr.domain().xmax() - tr.domain().xmin()) - * (tr.domain().xmax() - tr.domain().xmin()); + tr.orthosphere_radius_threshold = tr.compute_cover_threshold(); tr.insert_cells_with_too_big_orthoball(tr.cells_begin(), tr.cells_end());