#include <CGAL/Hyperbolic_octagon_translation.h>
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_2.h>
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.h>
#include <CGAL/point_generators_2.h>
typedef Traits::FT NT;
typedef Triangulation::Vertex_handle Vertex_handle;
typedef Triangulation::Point Point;
typedef Triangulation::size_type size_type;
int main(int argc, char** argv)
{
int N;
if(argc < 2) {
std::cout << "usage: " << argv[0] << " [number_of_points_to_insert]" << std::endl;
std::cout << "Defaulting to 100k points..." << std::endl;
N = 100000;
} else {
N = atoi(argv[1]);
}
int N1 = N/2;
int N2 = N - N1;
std::vector<Point> pts;
CGAL::Random_points_in_disc_2<Point,Creator> g(0.85);
Triangulation tr;
std::cout << "Batch-inserting " << N1 << " random points in the triangulation... "; std::cout.flush();
size_type N_batch_inserted = tr.insert(pts.begin(), pts.end(), false);
std::cout << "DONE! " << std::endl;
std::cout << "Single-inserting " << N2 << " random points in the triangulation... "; std::cout.flush();
int N_single_inserted = 0;
for(int i=0; i<N2; ++i)
{
Vertex_handle vh = tr.insert(*(++g));
if(vh != Vertex_handle())
N_single_inserted++;
}
std::cout << "DONE! " << std::endl;
std::size_t N_inserted = N_batch_inserted + N_single_inserted;
std::cout << "Cleaning dummy points from the triangulation... "; std::cout.flush();
tr.try_to_remove_dummy_vertices();
std::cout << "DONE! " << std::endl;
assert(tr.is_valid());
std::size_t NV = tr.number_of_vertices();
std::size_t NF = tr.number_of_faces();
std::size_t NE = tr.number_of_edges();
int NDP = tr.number_of_dummy_points();
std::cout << std::endl;
std::cout << "-------------- STATS --------------" << std::endl;
std::cout << "Random points generated: " << N << std::endl;
std::cout << "Vertices in the triangulation: " << NV << std::endl;
std::cout << "Dummy points in the triangulation: " << NDP << std::endl;
std::cout << "Random points inserted: " << N_inserted << std::endl;
std::cout << "Random points outside/duplicates: " << (N - N_inserted) << std::endl;
std::cout << std::endl;
std::cout << "---------- COMBINATORICS ----------" << std::endl;
std::cout << "Number of vertices NV: " << NV << std::endl;
std::cout << "Number of faces NF: " << NF << std::endl;
std::cout << "Number of edges NE: " << NE << std::endl;
assert(N_inserted + NDP == NV);
std::cout << "Number of vertices is correct! " << std::endl;
assert((2 + NE - NV - NF) / 2 == 2);
std::cout << "Euler relation verified! " << std::endl << std::endl;
return EXIT_SUCCESS;
}