Fix examples/tests/demos

This commit is contained in:
Andreas Fabri 2018-04-04 14:18:22 +01:00
parent 063a91a771
commit 3955f031bd
14 changed files with 24 additions and 15 deletions

View File

@ -15,6 +15,7 @@
#include <CGAL/Cartesian_d.h> #include <CGAL/Cartesian_d.h>
#include <CGAL/point_generators_d.h> #include <CGAL/point_generators_d.h>
#include <CGAL/MP_Float.h> #include <CGAL/MP_Float.h>
#include <CGAL/algorithm.h>
#include <CGAL/Approximate_min_ellipsoid_d.h> #include <CGAL/Approximate_min_ellipsoid_d.h>
#include <CGAL/Approximate_min_ellipsoid_d_traits_2.h> #include <CGAL/Approximate_min_ellipsoid_d_traits_2.h>
@ -148,7 +149,7 @@ void simple_test(int n, int d, int multiplicity, double eps)
Point_list P; Point_list P;
typedef typename is_d_dimensional<Traits>::value is_d; typedef typename is_d_dimensional<Traits>::value is_d;
add_random_points<Kernel>(n, d, multiplicity, P, is_d()); add_random_points<Kernel>(n, d, multiplicity, P, is_d());
std::random_shuffle(P.begin(), P.end()); CGAL::random_shuffle(P.begin(), P.end());
// compute minellipsoid: // compute minellipsoid:
Traits tco; Traits tco;

View File

@ -40,7 +40,7 @@ int main() {
// Use a random permutation to hide the creation history // Use a random permutation to hide the creation history
// of the point set. // of the point set.
std::random_shuffle( points.begin(), points.end(), get_default_random()); CGAL::random_shuffle( points.begin(), points.end());
// Check range of values. // Check range of values.
for ( Vector::iterator i = points.begin(); i != points.end(); i++){ for ( Vector::iterator i = points.begin(); i != points.end(); i++){

View File

@ -97,7 +97,7 @@ void test_point_generators_2() {
perturb_points_2( i1, i2, 10.0); perturb_points_2( i1, i2, 10.0);
// Create a random permutation. // Create a random permutation.
std::random_shuffle( points.begin(), points.end(), get_default_random()); CGAL::random_shuffle( points.begin(), points.end(), get_default_random());
assert( points.size() == 1000); assert( points.size() == 1000);
for ( std::vector<Point_2>::iterator i = points.begin(); for ( std::vector<Point_2>::iterator i = points.begin();

View File

@ -1,5 +1,6 @@
#include <CGAL/Interval_skip_list.h> #include <CGAL/Interval_skip_list.h>
#include <CGAL/Interval_skip_list_interval.h> #include <CGAL/Interval_skip_list_interval.h>
#include <CGAL/algorithm.h>
#include <vector> #include <vector>
#include <list> #include <list>
#include <iostream> #include <iostream>
@ -19,7 +20,7 @@ int main()
for(i = 0; i < n; i++) { for(i = 0; i < n; i++) {
intervals[i] = Interval(i, i+d); intervals[i] = Interval(i, i+d);
} }
std::random_shuffle(intervals.begin(), intervals.end()); CGAL::random_shuffle(intervals.begin(), intervals.end());
isl.insert(intervals.begin(), intervals.end()); isl.insert(intervals.begin(), intervals.end());

View File

@ -1,5 +1,7 @@
#include <CGAL/Interval_skip_list.h> #include <CGAL/Interval_skip_list.h>
#include <CGAL/Interval_skip_list_interval.h> #include <CGAL/Interval_skip_list_interval.h>
#include <CGAL/algorithm.h>
#include <vector> #include <vector>
#include <iostream> #include <iostream>
#include <list> #include <list>
@ -20,7 +22,7 @@ fct()
for(i = 0; i < n; i++) { for(i = 0; i < n; i++) {
intervals[i] = Interval(i,i+d); intervals[i] = Interval(i,i+d);
} }
std::random_shuffle(intervals.begin(), intervals.end()); CGAL::random_shuffle(intervals.begin(), intervals.end());
for(i = 0; i < n; i++) { for(i = 0; i < n; i++) {
isl.insert(intervals[i]); isl.insert(intervals[i]);

View File

@ -19,7 +19,7 @@ int main()
#include <fstream> #include <fstream>
#include <ctime> #include <ctime>
#include <algorithm> #include <CGAL/algorithm.h>
const bool pre_run = false; const bool pre_run = false;
const bool do_remove = true; const bool do_remove = true;
@ -63,7 +63,7 @@ void test(const std::vector<Point> &input, T &t)
vhs.push_back(it); vhs.push_back(it);
} }
std::random_shuffle(vhs.begin(), vhs.end()); CGAL::random_shuffle(vhs.begin(), vhs.end());
vhs.resize(vhs.size() / 2); vhs.resize(vhs.size() / 2);
for (size_t i = 0; i < vhs.size(); ++i) for (size_t i = 0; i < vhs.size(); ++i)
t.remove(vhs[i]); t.remove(vhs[i]);

View File

@ -972,7 +972,7 @@ void Scene::load_points(const QString& fileName) {
std::copy(std::istream_iterator<Point>(ifs), std::copy(std::istream_iterator<Point>(ifs),
std::istream_iterator<Point>(), std::istream_iterator<Point>(),
std::back_inserter(points)); std::back_inserter(points));
std::random_shuffle(points.begin(), points.end()); CGAL::random_shuffle(points.begin(), points.end());
p3dt.insert(points.begin(), points.end()); p3dt.insert(points.begin(), points.end());
QString snv; QString snv;

View File

@ -6,6 +6,7 @@
#include <CGAL/Periodic_3_Delaunay_triangulation_3.h> #include <CGAL/Periodic_3_Delaunay_triangulation_3.h>
#include <CGAL/point_generators_3.h> #include <CGAL/point_generators_3.h>
#include <CGAL/algorithm.h>
// Making available the Periodic_3_Delaunay_triangulation_3 to be // Making available the Periodic_3_Delaunay_triangulation_3 to be
// drawn in the Scene. // drawn in the Scene.

View File

@ -9,6 +9,7 @@
#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h> #include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
#include <CGAL/IO/Polyhedron_iostream.h> #include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/algorithm.h>
#include <CGAL/Timer.h> #include <CGAL/Timer.h>
#include <fstream> #include <fstream>
@ -86,7 +87,7 @@ void shuffle_off(const char* fname_in, const char* fname_out)
for (int k=0;k<n;++k) for (int k=0;k<n;++k)
input >> indices[k]; input >> indices[k];
std::random_shuffle(indices.begin(), indices.end()); CGAL::random_shuffle(indices.begin(), indices.end());
output << n; output << n;
for (int k=0;k<n;++k) for (int k=0;k<n;++k)

View File

@ -12,6 +12,7 @@
#include <CGAL/Search_traits_3.h> #include <CGAL/Search_traits_3.h>
#include <CGAL/Search_traits_adapter.h> #include <CGAL/Search_traits_adapter.h>
#include <CGAL/linear_least_squares_fitting_3.h> #include <CGAL/linear_least_squares_fitting_3.h>
#include <CGAL/algorithm.h>
#include <QObject> #include <QObject>
#include <QApplication> #include <QApplication>
@ -451,9 +452,9 @@ void Scene_points_with_normal_item_priv::compute_normals_and_vertices() const
colors_points.resize(0); colors_points.resize(0);
//Shuffle container to allow quick display random points //Shuffle container to allow quick display random points
std::random_shuffle (m_points->begin(), m_points->first_selected()); CGAL::random_shuffle (m_points->begin(), m_points->first_selected());
if (m_points->nb_selected_points() != 0) if (m_points->nb_selected_points() != 0)
std::random_shuffle (m_points->first_selected(), m_points->end()); CGAL::random_shuffle (m_points->first_selected(), m_points->end());
//if item has normals, points will be one point out of two in the lines data. //if item has normals, points will be one point out of two in the lines data.
//else points will be lines and lines discarded. //else points will be lines and lines discarded.
double average_spacing = 0; double average_spacing = 0;

View File

@ -22,6 +22,7 @@
// ============================================================================ // ============================================================================
#include <CGAL/Random.h> #include <CGAL/Random.h>
#include <CGAL/algorithm.h>
#include <cassert> #include <cassert>
#include <iterator> #include <iterator>
#include <vector> #include <vector>
@ -160,7 +161,7 @@ main()
std::vector<int> numbers; std::vector<int> numbers;
numbers.push_back(1); numbers.push_back(1);
std::random_shuffle(numbers.begin(), numbers.end(), CGAL::get_default_random()); CGAL::random_shuffle(numbers.begin(), numbers.end(), CGAL::get_default_random());
return( 0); return( 0);
} }

View File

@ -1,4 +1,5 @@
#include <CGAL/assertions.h> #include <CGAL/assertions.h>
#include <CGAL/algorithm.h>
#include <CGAL/Modifiable_priority_queue.h> #include <CGAL/Modifiable_priority_queue.h>
#include <iostream> #include <iostream>
#include <functional> #include <functional>
@ -127,7 +128,7 @@ int main()
//testing correctness of the order //testing correctness of the order
int array[10] = {0,1,2,3,4,5,6,7,8,9}; int array[10] = {0,1,2,3,4,5,6,7,8,9};
std::random_shuffle(array,array+10); CGAL::random_shuffle(array,array+10);
data.clear(); data.clear();
data.reserve(10); data.reserve(10);
for (int i=0;i<10;++i){ for (int i=0;i<10;++i){

View File

@ -96,7 +96,7 @@ void test(const int D, const int d, const int N, bool no_transform)
assert( 2 * dc.number_of_vertices() == dc.number_of_full_cells() + 2 ); assert( 2 * dc.number_of_vertices() == dc.number_of_full_cells() + 2 );
if( dc.current_dimension() > 3 ) if( dc.current_dimension() > 3 )
{ {
std::random_shuffle(points.begin(), points.end()); CGAL::random_shuffle(points.begin(), points.end());
if (points.size() > 100) if (points.size() > 100)
points.resize(100); points.resize(100);
} }

View File

@ -130,7 +130,7 @@ int main()
std::cout <<" Removing vertices in random order" << std::endl; std::cout <<" Removing vertices in random order" << std::endl;
std::random_shuffle(V.begin(), V.end()); CGAL::random_shuffle(V.begin(), V.end());
for (i=0; i<125; ++i) { for (i=0; i<125; ++i) {
T.remove(V[i]); T.remove(V[i]);