From 58cc66188ee6f86cc3bdd9a682ddf361e51f1e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 23 Mar 2023 23:47:58 +0100 Subject: [PATCH] Fix point() for P3T3/P3DT3/P3RT3/P3M3 --- .../Protect_edges_sizing_field.h | 3 +- .../CGAL/Periodic_3_mesh_triangulation_3.h | 8 ++++- .../Periodic_3_Delaunay_triangulation_3.h | 23 -------------- .../include/CGAL/Periodic_3_triangulation_3.h | 31 ++++++++++--------- 4 files changed, 25 insertions(+), 40 deletions(-) diff --git a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h index 175dcf7bc63..b40cb647db9 100644 --- a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h +++ b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h @@ -1038,8 +1038,7 @@ get_maximum_weight(const Vertex_handle protection_vertex, const FT intended_weig max_possible_weight = minimal_weight_; CGAL_assertion_code(const Weighted_point& pvwp = c3t3_.triangulation().point(protection_vertex);) - CGAL_assertion_code(const Bare_point& pvp = - c3t3_.triangulation().geom_traits().construct_point_3_object()(pvwp);) + CGAL_assertion_code(const Bare_point& pvp = c3t3_.triangulation().geom_traits().construct_point_3_object()(pvwp);) CGAL_assertion_code(const int dim = get_dimension(protection_vertex);) CGAL_assertion_code(const Index index = c3t3_.index(protection_vertex);) CGAL_assertion_code(const FT w_max = CGAL::square(query_size(pvp, dim, index));) diff --git a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_triangulation_3.h b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_triangulation_3.h index 0b86341b9d8..a7e1239b174 100644 --- a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_triangulation_3.h +++ b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_triangulation_3.h @@ -202,6 +202,12 @@ public: return P3T3::internal::robust_canonicalize_point(p, geom_traits()); } + // 1-cover, so we can take a const& + const Weighted_point& point(const Vertex_handle v) const + { + return v->point(); + } + Triangle triangle(const Facet& f) const { Periodic_triangle ptri = periodic_triangle(f); @@ -513,7 +519,7 @@ public: CGAL_precondition(f.first != Cell_handle() && f.first->has_vertex(ref_v)); const int ref_v_pos = f.first->index(ref_v); - const Bare_point ref_p = cp(point(ref_v)); + const Bare_point& ref_p = cp(point(ref_v)); const Bare_point ref_p_in_f = cp(point(f.first, ref_v_pos)); Vector_3 move_to_canonical = cv(ref_p_in_f, ref_p); diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_Delaunay_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_Delaunay_triangulation_3.h index 70bf3137a9c..24d15446e8d 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_Delaunay_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_Delaunay_triangulation_3.h @@ -665,29 +665,6 @@ private: } public: - /** @name Geometric access functions */ - - Point point(const Periodic_point& pp) const - { - return point(pp, geom_traits().construct_point_3_object()); - } - - // The following functions return the "real" position in space (unrestrained - // to the fundamental domain) of the vertices v and c->vertex(idx), - // respectively - - Point point(Vertex_handle v) const - { - return point(v, geom_traits().construct_point_3_object()); - } - - Point point(Cell_handle c, int idx) const - { - return point(c, idx, geom_traits().construct_point_3_object()); - } - - // end of geometric functions - Periodic_point periodic_circumcenter(Cell_handle c) const { return Base::periodic_circumcenter(c, geom_traits().construct_circumcenter_3_object()); } diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h index 048325e88f3..003e6976d38 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h @@ -693,14 +693,6 @@ public: return point(periodic_point(v), cp); } - virtual Point point(Vertex_handle) const - { - // This is a purely virtual function, but it cannot be made "= 0;" otherwise - // one cannot use P3T3 by itself (which never happens except in tests...) - CGAL_assertion(false); - return Point(); - }; - template Point point(Cell_handle c, int idx, ConstructPoint cp) const { @@ -758,13 +750,24 @@ public: return Point(); } - virtual Point point(Cell_handle, int) const + Point point(const Periodic_point& pp) const { - // This is a purely virtual function, but it cannot be made "= 0;" otherwise - // one cannot use P3T3 by itself (which never happens except in tests...) - CGAL_assertion(false); - return Point(); - }; + return point(pp, geom_traits().construct_point_3_object()); + } + + // The following functions return the "real" position in space (unrestrained + // to the fundamental domain) of the vertices v and c->vertex(idx), + // respectively + + Point point(Vertex_handle v) const + { + return point(v, geom_traits().construct_point_3_object()); + } + + Point point(Cell_handle c, int idx) const + { + return point(c, idx, geom_traits().construct_point_3_object()); + } Periodic_point periodic_point(const Vertex_handle v) const {