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 5bfe6f65892..11ac33d2628 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 @@ -490,21 +490,27 @@ public: is_large_point_set = false; std::vector points(first, last); - CGAL::cpp98::random_shuffle (points.begin(), points.end()); - Cell_handle hint; std::vector dummy_points, double_vertices; typename std::vector::iterator pbegin = points.begin(); if(is_large_point_set) + { dummy_points = insert_dummy_points(); - else while(!is_1_cover()) { - insert(*pbegin); - ++pbegin; - if(pbegin == points.end()) - return number_of_vertices() - n; + } else { + CGAL::cpp98::random_shuffle(points.begin(), points.end()); + pbegin = points.begin(); + while(!is_1_cover()) { + insert(*pbegin); + ++pbegin; + if(pbegin == points.end()) + return number_of_vertices() - n; + } } + CGAL_postcondition(is_1_cover()); + spatial_sort (pbegin, points.end(), this->geom_traits()); + Cell_handle hint; Conflict_tester tester(*pbegin,this); Point_hider hider; Cover_manager cover_manager(*this); 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 14a7419274c..180cb4e36ee 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 @@ -519,8 +519,6 @@ public: is_large_point_set = false; std::vector points(first, last); - CGAL::cpp98::random_shuffle(points.begin(), points.end()); - Cell_handle hint; std::vector dummy_points_vhs, double_vertices; std::vector dummy_points; typename std::vector::iterator pbegin = points.begin(); @@ -533,6 +531,8 @@ public: } else { + CGAL::cpp98::random_shuffle(points.begin(), points.end()); + pbegin = points.begin(); while(!is_1_cover()) { insert(*pbegin); @@ -542,6 +542,8 @@ public: } } + CGAL_postcondition(is_1_cover()); + // Spatial sorting can only be applied to bare points, so we need an adaptor typedef typename Geom_traits::Construct_point_3 Construct_point_3; typedef typename boost::result_of::type Ret; @@ -553,6 +555,7 @@ public: CGAL::internal::boost_::make_function_property_map( geom_traits().construct_point_3_object()), geom_traits())); + Cell_handle hint; Conflict_tester tester(*pbegin, this); Point_hider hider(this); Cover_manager cover_manager(*this);