diff --git a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h index 8fed0f20918..35cecade1f4 100644 --- a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h +++ b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h @@ -3476,7 +3476,6 @@ get_least_square_surface_plane(const Vertex_handle& v, tr_.geom_traits(), Default_diagonalize_traits()); - // The surface center of a facet might have an offset in periodic triangulations const Bare_point& ref_facet_scp = ref_facet.first->get_facet_surface_center(ref_facet.second); const Bare_point& ref_point = tr_.get_closest_point(cp(position), ref_facet_scp); 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 58b2b7d5350..0b86341b9d8 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 @@ -511,16 +511,19 @@ public: typename Geom_traits::Construct_vector_3 cv = geom_traits().construct_vector_3_object(); typename Geom_traits::Construct_triangle_3 ct = geom_traits().construct_triangle_3_object(); - CGAL_precondition(f.first->has_vertex(ref_v)); + 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_in_f = cp(point(f.first, ref_v_pos)); + 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); const int s = f.second; - return ct(tr(cp(point(f.first, (s+1)%4)), move_to_canonical), - tr(cp(point(f.first, (s+2)%4)), move_to_canonical), - tr(cp(point(f.first, (s+3)%4)), move_to_canonical)); + const Bare_point mp0 = tr(cp(point(f.first, (s+1)%4)), move_to_canonical); + const Bare_point mp1 = tr(cp(point(f.first, (s+2)%4)), move_to_canonical); + const Bare_point mp2 = tr(cp(point(f.first, (s+3)%4)), move_to_canonical); + const Triangle t = ct(mp0, mp1, mp2); + + return t; } // Warning: This is a periodic version that computes the smallest possible