Removed redundant call to random_shuffle when using 'is_large_point_set'

This commit is contained in:
Mael Rouxel-Labbé 2018-10-10 10:59:18 +02:00
parent 592d60ff0d
commit 7b90f28601
2 changed files with 18 additions and 9 deletions

View File

@ -490,21 +490,27 @@ public:
is_large_point_set = false; is_large_point_set = false;
std::vector<Point> points(first, last); std::vector<Point> points(first, last);
CGAL::cpp98::random_shuffle (points.begin(), points.end());
Cell_handle hint;
std::vector<Vertex_handle> dummy_points, double_vertices; std::vector<Vertex_handle> dummy_points, double_vertices;
typename std::vector<Point>::iterator pbegin = points.begin(); typename std::vector<Point>::iterator pbegin = points.begin();
if(is_large_point_set) if(is_large_point_set)
{
dummy_points = insert_dummy_points(); dummy_points = insert_dummy_points();
else while(!is_1_cover()) { } else {
insert(*pbegin); CGAL::cpp98::random_shuffle(points.begin(), points.end());
++pbegin; pbegin = points.begin();
if(pbegin == points.end()) while(!is_1_cover()) {
return number_of_vertices() - n; 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()); spatial_sort (pbegin, points.end(), this->geom_traits());
Cell_handle hint;
Conflict_tester tester(*pbegin,this); Conflict_tester tester(*pbegin,this);
Point_hider hider; Point_hider hider;
Cover_manager cover_manager(*this); Cover_manager cover_manager(*this);

View File

@ -519,8 +519,6 @@ public:
is_large_point_set = false; is_large_point_set = false;
std::vector<Weighted_point> points(first, last); std::vector<Weighted_point> points(first, last);
CGAL::cpp98::random_shuffle(points.begin(), points.end());
Cell_handle hint;
std::vector<Vertex_handle> dummy_points_vhs, double_vertices; std::vector<Vertex_handle> dummy_points_vhs, double_vertices;
std::vector<Weighted_point> dummy_points; std::vector<Weighted_point> dummy_points;
typename std::vector<Weighted_point>::iterator pbegin = points.begin(); typename std::vector<Weighted_point>::iterator pbegin = points.begin();
@ -533,6 +531,8 @@ public:
} }
else else
{ {
CGAL::cpp98::random_shuffle(points.begin(), points.end());
pbegin = points.begin();
while(!is_1_cover()) while(!is_1_cover())
{ {
insert(*pbegin); 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 // 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 Geom_traits::Construct_point_3 Construct_point_3;
typedef typename boost::result_of<const Construct_point_3(const Weighted_point&)>::type Ret; typedef typename boost::result_of<const Construct_point_3(const Weighted_point&)>::type Ret;
@ -553,6 +555,7 @@ public:
CGAL::internal::boost_::make_function_property_map<Weighted_point, Ret, Construct_point_3>( CGAL::internal::boost_::make_function_property_map<Weighted_point, Ret, Construct_point_3>(
geom_traits().construct_point_3_object()), geom_traits())); geom_traits().construct_point_3_object()), geom_traits()));
Cell_handle hint;
Conflict_tester tester(*pbegin, this); Conflict_tester tester(*pbegin, this);
Point_hider hider(this); Point_hider hider(this);
Cover_manager cover_manager(*this); Cover_manager cover_manager(*this);