mirror of https://github.com/CGAL/cgal
fixes and modifications to tests
This commit is contained in:
parent
158fcfd24b
commit
4e98d38ac9
|
|
@ -0,0 +1,23 @@
|
|||
---- for best results, make sure that you have compiled me in Release mode ----
|
||||
iteration 1: inserting into hyperbolic periodic triangulation... DONE! (# of vertices = 1000000, time = 50.3773 secs)
|
||||
iteration 1: inserting into Euclidean non-periodic triangulation... DONE! (# of vertices = 1000000, time = 20.7566 secs)
|
||||
iteration 2: inserting into hyperbolic periodic triangulation... DONE! (# of vertices = 1000000, time = 58.7336 secs)
|
||||
iteration 2: inserting into Euclidean non-periodic triangulation... DONE! (# of vertices = 1000000, time = 24.6808 secs)
|
||||
iteration 3: inserting into hyperbolic periodic triangulation... DONE! (# of vertices = 1000000, time = 57.6734 secs)
|
||||
iteration 3: inserting into Euclidean non-periodic triangulation... DONE! (# of vertices = 1000000, time = 23.9461 secs)
|
||||
iteration 4: inserting into hyperbolic periodic triangulation... DONE! (# of vertices = 1000000, time = 54.9728 secs)
|
||||
iteration 4: inserting into Euclidean non-periodic triangulation... DONE! (# of vertices = 1000000, time = 21.1166 secs)
|
||||
iteration 5: inserting into hyperbolic periodic triangulation... DONE! (# of vertices = 1000000, time = 51.4028 secs)
|
||||
iteration 5: inserting into Euclidean non-periodic triangulation... DONE! (# of vertices = 1000000, time = 21.3222 secs)
|
||||
iteration 6: inserting into hyperbolic periodic triangulation... DONE! (# of vertices = 1000000, time = 50.6842 secs)
|
||||
iteration 6: inserting into Euclidean non-periodic triangulation... DONE! (# of vertices = 1000000, time = 21.144 secs)
|
||||
iteration 7: inserting into hyperbolic periodic triangulation... DONE! (# of vertices = 1000000, time = 52.2119 secs)
|
||||
iteration 7: inserting into Euclidean non-periodic triangulation... DONE! (# of vertices = 1000000, time = 21.848 secs)
|
||||
iteration 8: inserting into hyperbolic periodic triangulation... DONE! (# of vertices = 1000000, time = 52.7987 secs)
|
||||
iteration 8: inserting into Euclidean non-periodic triangulation... DONE! (# of vertices = 1000000, time = 23.4349 secs)
|
||||
iteration 9: inserting into hyperbolic periodic triangulation... DONE! (# of vertices = 1000000, time = 56.7236 secs)
|
||||
iteration 9: inserting into Euclidean non-periodic triangulation... DONE! (# of vertices = 1000000, time = 22.5812 secs)
|
||||
iteration 10: inserting into hyperbolic periodic triangulation... DONE! (# of vertices = 1000000, time = 56.6275 secs)
|
||||
iteration 10: inserting into Euclidean non-periodic triangulation... DONE! (# of vertices = 1000000, time = 22.441 secs)
|
||||
Hyperbolic periodic triangulation: average time = 54.2206
|
||||
Euclidean non-periodic triangulation: average time = 22.3271
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include <iostream>
|
||||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/Exact_complex.h>
|
||||
#include <CGAL/internal/Exact_complex.h>
|
||||
#include <CGAL/Point_2.h>
|
||||
#include <CGAL/Circle_2.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.h>
|
||||
#include <CGAL/Periodic_4_hyperbolic_triangulation_dummy_14.h>
|
||||
#include <CGAL/internal/Periodic_4_hyperbolic_triangulation_dummy_14.h>
|
||||
#include <CGAL/Hyperbolic_octagon_translation.h>
|
||||
#include <CGAL/Algebraic_kernel_for_circles_2_2.h>
|
||||
#include <CGAL/Circular_kernel_2.h>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include <boost/random/uniform_smallint.hpp>
|
||||
#include <boost/random/variate_generator.hpp>
|
||||
#include <CGAL/point_generators_2.h>
|
||||
#include <CGAL/Hyperbolic_random_points_in_disc_2.h>
|
||||
//#include <CGAL/Hyperbolic_random_points_in_disc_2.h>
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.h>
|
||||
#include <CGAL/Hyperbolic_octagon_translation.h>
|
||||
|
|
@ -61,21 +61,18 @@ int main(int argc, char** argv) {
|
|||
|
||||
for (int exec = 1; exec <= iters; exec++) {
|
||||
|
||||
std::vector<Point_double> v;
|
||||
std::vector<Point> pts;
|
||||
|
||||
Hyperbolic_random_points_in_disc_2_double(v, 5*N, -1, 0.159);
|
||||
CGAL::Random_points_in_disc_2<Point_double, Creator> g(0.85);
|
||||
|
||||
int cnt = 0;
|
||||
int idx = 0;
|
||||
do {
|
||||
Point pt = Point(v[idx].x(), v[idx].y());
|
||||
Point_double pd = *(++g);
|
||||
Point pt = Point(pd.x(), pd.y());
|
||||
if (pred(pt) != CGAL::ON_UNBOUNDED_SIDE) {
|
||||
pts.push_back(pt);
|
||||
cnt++;
|
||||
}
|
||||
idx++;
|
||||
} while (cnt < N && idx < v.size());
|
||||
} while (cnt < N);
|
||||
|
||||
if (cnt < N) {
|
||||
cout << "I failed to generate all the random points! Exiting..." << endl;
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ int main(int argc, char** argv) {
|
|||
|
||||
CGAL::Timer tt;
|
||||
tt.start();
|
||||
tr.insert(pts.begin(), pts.end(), true);
|
||||
tr.insert(pts.begin(), pts.end());
|
||||
tt.stop();
|
||||
cout << "DONE! (# of vertices = " << tr.number_of_vertices() << ", time = " << tt.time() << " secs)" << endl;
|
||||
extime += tt.time();
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@
|
|||
#include <CGAL/Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/determinant.h>
|
||||
|
||||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.h>
|
||||
#include <CGAL/Timer.h>
|
||||
|
||||
typedef double NT;
|
||||
|
|
@ -18,6 +19,13 @@ typedef Kernel::Point_2
|
|||
typedef Triangulation::Vertex_handle Vertex_handle;
|
||||
typedef CGAL::Creator_uniform_2<double, Point> Creator;
|
||||
|
||||
|
||||
typedef CORE::Expr NT2;
|
||||
typedef CGAL::Cartesian<NT2> Kernel2;
|
||||
typedef CGAL::Periodic_4_hyperbolic_Delaunay_triangulation_traits_2<Kernel2,
|
||||
CGAL::Hyperbolic_octagon_translation> Traits2;
|
||||
typedef Traits2::Side_of_original_octagon Side_of_original_octagon;
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
|
|
@ -37,23 +45,27 @@ int main(int argc, char** argv) {
|
|||
cout << "---- for best results, make sure that you have compiled me in Release mode ----" << endl;
|
||||
|
||||
double extime = 0.0;
|
||||
Side_of_original_octagon pred;
|
||||
|
||||
for (int exec = 1; exec <= iters; exec++) {
|
||||
std::vector<Point> pts;
|
||||
pts.reserve(N);
|
||||
CGAL::Random_points_in_disc_2<Point, Creator> g(1.0);
|
||||
CGAL::cpp11::copy_n( g, N, std::back_inserter(pts));
|
||||
CGAL::Random_points_in_disc_2<Point, Creator> g(0.85);
|
||||
|
||||
int cnt = 0;
|
||||
do {
|
||||
Point pt = *(++g);
|
||||
if (pred(pt) != CGAL::ON_UNBOUNDED_SIDE) {
|
||||
pts.push_back(pt);
|
||||
cnt++;
|
||||
}
|
||||
} while (cnt < N);
|
||||
|
||||
cout << "iteration " << exec << ": inserting into triangulation (rational dummy points)... "; cout.flush();
|
||||
Triangulation tr;
|
||||
//tr.insert_dummy_points(true);
|
||||
|
||||
CGAL::Timer tt;
|
||||
tt.start();
|
||||
tr.insert(pts.begin(), pts.end());
|
||||
//for (int j = 0; j < pts.size(); j++) {
|
||||
// tr.insert(pts[j]);
|
||||
//}
|
||||
tt.stop();
|
||||
cout << "DONE! (# of vertices = " << tr.number_of_vertices() << ", time = " << tt.time() << " secs)" << endl;
|
||||
extime += tt.time();
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.h>
|
||||
#include <CGAL/Periodic_4_hyperbolic_triangulation_dummy_14.h>
|
||||
#include <CGAL/internal/Periodic_4_hyperbolic_triangulation_dummy_14.h>
|
||||
#include <CGAL/Hyperbolic_octagon_translation.h>
|
||||
#include <CGAL/Algebraic_kernel_for_circles_2_2.h>
|
||||
#include <CGAL/Circular_kernel_2.h>
|
||||
|
|
@ -55,7 +55,7 @@ int main(void) {
|
|||
cout << "---- locating dummy points (all should be vertices) ----" << endl;
|
||||
for (int j = 0; j < 14; j++) {
|
||||
Point query = tr.get_dummy_point(j);
|
||||
fh = tr.locate(query, lt, li);
|
||||
fh = tr.hyperbolic_locate(query, lt, li);
|
||||
assert(lt == Triangulation::VERTEX);
|
||||
cout << " dummy point " << j << ": OK " << endl;
|
||||
}
|
||||
|
|
@ -63,13 +63,13 @@ int main(void) {
|
|||
cout << "---- locating the midpoint of a Euclidean segment ----" << endl;
|
||||
Point p1 = tr.get_dummy_point(0), p2 = tr.get_dummy_point(1);
|
||||
Point query = midpoint(p1, p2);
|
||||
fh = tr.locate(query, lt, li);
|
||||
fh = tr.hyperbolic_locate(query, lt, li);
|
||||
assert(lt == Triangulation::EDGE);
|
||||
cout << " located as edge OK" << endl;
|
||||
|
||||
cout << "---- inserting a single point and locating it ----" << endl;
|
||||
Vertex_handle v = tr.insert(Point(-0.4, -0.1));
|
||||
fh = tr.locate(v->point(), lt, li);
|
||||
fh = tr.hyperbolic_locate(v->point(), lt, li);
|
||||
assert(lt == Triangulation::VERTEX);
|
||||
cout << " located as vertex OK" << endl;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
#include <CGAL/Point_2.h>
|
||||
#include <CGAL/Circle_2.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Exact_complex.h>
|
||||
#include <CGAL/Hyperbolic_octagon_translation_matrix.h>
|
||||
#include <CGAL/internal/Exact_complex.h>
|
||||
#include <CGAL/internal/Hyperbolic_octagon_translation_matrix.h>
|
||||
#include <vector>
|
||||
|
||||
using namespace CGAL;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <boost/random/uniform_smallint.hpp>
|
||||
#include <boost/random/variate_generator.hpp>
|
||||
#include <CGAL/point_generators_2.h>
|
||||
#include <CGAL/Hyperbolic_random_points_in_disc_2.h>
|
||||
//#include <CGAL/Random_points_in_disc_2.h>
|
||||
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.h>
|
||||
|
|
@ -44,10 +44,10 @@ int main(int argc, char** argv) {
|
|||
int max = -1;
|
||||
double mean = 0.0;
|
||||
for (int j = 0; j < iter; j++) {
|
||||
cout << "Iteration " << (j+1) << "/" << iter << "..." << endl;
|
||||
//cout << "Iteration " << (j+1) << "/" << iter << "..." << endl;
|
||||
|
||||
std::vector<Point_double> v;
|
||||
Hyperbolic_random_points_in_disc_2_double(v, N, -1, 0.159);
|
||||
CGAL::Random_points_in_disc_2<Point_double, Creator> g(0.85);
|
||||
|
||||
Triangulation tr;
|
||||
assert(tr.is_valid(true));
|
||||
|
|
@ -55,7 +55,7 @@ int main(int argc, char** argv) {
|
|||
int cnt = 0;
|
||||
int idx = 0;
|
||||
do {
|
||||
Point_double pt = v[idx++];
|
||||
Point_double pt = *(++g);
|
||||
if (pred(pt) != CGAL::ON_UNBOUNDED_SIDE) {
|
||||
tr.insert(Point(pt.x(), pt.y()));
|
||||
cnt++;
|
||||
|
|
@ -66,7 +66,7 @@ int main(int argc, char** argv) {
|
|||
continue;
|
||||
}
|
||||
assert(tr.is_valid());
|
||||
|
||||
std::cout << cnt << std::endl;
|
||||
if (cnt > max)
|
||||
max = cnt;
|
||||
if (cnt < min)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ int main(void) {
|
|||
Triangulation tr;
|
||||
CGAL_assertion(tr.is_valid());
|
||||
|
||||
cout << "triangulation works!" <<
|
||||
cout << "triangulation works!" << std::endl;
|
||||
cout << "nb of vertices: " << tr.number_of_vertices() << endl;
|
||||
cout << "nb of faces: " << tr.number_of_faces() << endl;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include <CGAL/Circle_2.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
// #include <CGAL/Hyperbolic_octagon_translation_matrix.h>
|
||||
#include <CGAL/Exact_complex.h>
|
||||
#include <CGAL/internal/Exact_complex.h>
|
||||
#include <CGAL/Hyperbolic_octagon_translation.h>
|
||||
#include <vector>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
Test ran on 04/06/2018, 11:18am
|
||||
=================================================
|
||||
Finished 100 iterations!
|
||||
Minimum number of points inserted: 30
|
||||
Maximum number of points inserted: 147
|
||||
Average number of points inserted: 61.66
|
||||
|
||||
|
||||
Context
|
||||
=================================================
|
||||
There were some doubts about how correct it is to say that we used random points
|
||||
uniformly distributed in the hyperbolic metric. I ran the test with points
|
||||
distributed uniformly in the Euclidean metric, and these are the results.
|
||||
Loading…
Reference in New Issue