CGAL 6.0.2 - 3D Periodic Triangulations

Loading...
Searching...
No Matches
Periodic_3_triangulation_3/large_point_set.cpp
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
#include <CGAL/Periodic_3_Delaunay_triangulation_3.h>
#include <CGAL/Random.h>
#include <CGAL/point_generators_3.h>
#include <CGAL/Timer.h>
#include <iostream>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K> Gt;
typedef CGAL::Periodic_3_Delaunay_triangulation_3<Gt> P3DT3;
typedef P3DT3::Point Point;
int main(int, char**)
{
CGAL::Timer t;
typedef CGAL::Creator_uniform_3<double, Point> Creator;
CGAL::Random random(7);
CGAL::Random_points_in_cube_3<Point, Creator> in_cube(.5, random);
int n = 10000;
std::vector<Point> pts;
P3DT3 PT1, PT2, PT3;
// Generating n random points
for (int i=0 ; i < n ; i++) {
Point p = *in_cube;
in_cube++;
pts.push_back(Point(p.x()+.5,p.y()+.5,p.z()+.5));
}
// Standard insertion
t.start();
for (int i=0 ; i < n ; i++) {
PT1.insert(pts[i]);
}
t.stop();
std::cout<<" Time: "<<t.time()<<" sec. (Standard insertion)"<<std::endl;
t.reset();
// Iterator range insertion using spatial sorting but no dummy points
t.start();
PT2.insert(pts.begin(), pts.end()); // third parameter defaults to false
t.stop();
std::cout<<" Time: "<<t.time()<<" sec. (with spatial sorting)"<<std::endl;
t.reset();
// Iterator range insertion using spatial sorting and dummy point heuristic
t.start();
PT3.insert(pts.begin(), pts.end(), true);
t.stop();
std::cout<<" Time: "<<t.time()<<" sec. (Dummy point heuristic)"<<std::endl;
return 0;
}
CGAL::Creator_uniform_3
CGAL::Exact_predicates_inexact_constructions_kernel
CGAL::Periodic_3_Delaunay_triangulation_3
The class Periodic_3_Delaunay_triangulation_3 represents a Delaunay triangulation in three-dimensiona...
Definition: Periodic_3_Delaunay_triangulation_3.h:26
CGAL::Periodic_3_Delaunay_triangulation_traits_3
The class Periodic_3_Delaunay_triangulation_traits_3 is designed as a default traits class for the cl...
Definition: Periodic_3_Delaunay_triangulation_traits_3.h:23