mirror of https://github.com/CGAL/cgal
Cleaned P4HT2 tests
This commit is contained in:
parent
852ef51bce
commit
94e9ae9667
|
|
@ -42,7 +42,6 @@ namespace CGAL {
|
|||
template <class NumberType>
|
||||
class Exact_complex
|
||||
{
|
||||
|
||||
typedef Exact_complex<NumberType> Self;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -61,11 +61,6 @@ typedef Triangulation::Face_handle
|
|||
typedef Triangulation::Face_iterator Face_iterator;
|
||||
typedef Traits::Construct_point_2 Make_point;
|
||||
|
||||
|
||||
using CGAL::to_double;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
class MainWindow :
|
||||
public CGAL::Qt::DemosMainWindow,
|
||||
public Ui::Periodic_4_hyperbolic_Delaunay_triangulation_2
|
||||
|
|
@ -400,8 +395,8 @@ MainWindow::on_actionInsertRandomPoints_triggered()
|
|||
dt.insert(pts.begin(), pts.end());
|
||||
tt.stop();
|
||||
|
||||
cout << "Time elapsed for the insertion of " << number_of_points << " points: " << tt.time() << " secs." << endl;
|
||||
cout << "Number of vertices in the triangulation: " << dt.number_of_vertices() << endl;
|
||||
std::cout << "Time elapsed for the insertion of " << number_of_points << " points: " << tt.time() << " secs." << std::endl;
|
||||
std::cout << "Number of vertices in the triangulation: " << dt.number_of_vertices() << std::endl;
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
emit(changed());
|
||||
|
|
@ -432,9 +427,9 @@ MainWindow::open(QString fileName)
|
|||
while(ifs >> p) {
|
||||
points.push_back(p);
|
||||
}
|
||||
cout << "Read " << points.size() << " input points." << endl << "Inserting!" << endl;
|
||||
std::cout << "Read " << points.size() << " input points." << std::endl << "Inserting!" << std::endl;
|
||||
dt.insert(points.begin(), points.end());
|
||||
cout << "Done inserting!" << endl;
|
||||
std::cout << "Done inserting!" << std::endl;
|
||||
|
||||
// default cursor
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
|
|
|||
|
|
@ -37,9 +37,6 @@
|
|||
|
||||
//#define DRAW_OCTAGON_IMAGE ;
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
namespace CGAL {
|
||||
namespace Qt {
|
||||
|
||||
|
|
@ -167,7 +164,7 @@ public:
|
|||
trans.push_back(tmp[k]);
|
||||
}
|
||||
}
|
||||
cout << "translations ready; tmp has " << tmp.size() << " elems, trans has " << trans.size() << " elems" << endl;
|
||||
std::cout << "translations ready; tmp has " << tmp.size() << " elems, trans has " << trans.size() << " elems" << std::endl;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
@ -315,7 +312,7 @@ TriangulationGraphicsItem<T>::drawAll(QPainter *painter)
|
|||
}
|
||||
|
||||
if(visible_edges) {
|
||||
//cout << "painting edges" << endl;
|
||||
//cout << "painting edges" << std::endl;
|
||||
temp.setWidthF(0.01);
|
||||
temp.setColor(::Qt::darkGreen);
|
||||
painter->setPen(temp);
|
||||
|
|
@ -331,9 +328,9 @@ TriangulationGraphicsItem<T>::drawAll(QPainter *painter)
|
|||
painterostream << t->construct_hyperbolic_segment(pts[0], pts[1]);
|
||||
painterostream << t->construct_hyperbolic_segment(pts[1], pts[2]);
|
||||
painterostream << t->construct_hyperbolic_segment(pts[2], pts[0]);
|
||||
//cout << " original painted" << endl;
|
||||
//cout << " original painted" << std::endl;
|
||||
if(visible_copies) {
|
||||
// cout << "painting copies" << endl;
|
||||
// std::cout << "painting copies" << std::endl;
|
||||
// typename Geom_traits::Point_2 pts[] = {fit->translation(Triangulation_cw_ccw_2::ccw(0)).apply(fit->vertex(Triangulation_cw_ccw_2::ccw(k))->point());
|
||||
// typename Geom_traits::Point_2 tgt = fit->translation(Triangulation_cw_ccw_2::cw(k)).apply(fit->vertex(Triangulation_cw_ccw_2::cw(k))->point());
|
||||
for(int j=0; j<trans.size(); ++j) {
|
||||
|
|
@ -342,7 +339,7 @@ TriangulationGraphicsItem<T>::drawAll(QPainter *painter)
|
|||
painterostream << t->construct_hyperbolic_segment( CP2()(pts[2], trans[j]), CP2()(pts[0], trans[j]) );
|
||||
}
|
||||
}
|
||||
//cout << " copies painted" << endl;
|
||||
//cout << " copies painted" << std::endl;
|
||||
}
|
||||
|
||||
if(visible_demo) {
|
||||
|
|
@ -357,7 +354,7 @@ TriangulationGraphicsItem<T>::drawAll(QPainter *painter)
|
|||
painter->setPen(old);
|
||||
//
|
||||
|
||||
//cout << "painting vertices" << endl;
|
||||
//cout << "painting vertices" << std::endl;
|
||||
paintVertices(painter);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ private:
|
|||
std::vector<Word_idx_type> word, sub;
|
||||
bool is_inverse;
|
||||
Word_idx_type N, idx;
|
||||
//cout << "Nb = " << Nb << ", Nf = " << Nf << endl;
|
||||
//cout << "Nb = " << Nb << ", Nf = " << Nf << std::endl;
|
||||
if(Nb > Nf)
|
||||
{
|
||||
word = inv;
|
||||
|
|
|
|||
|
|
@ -1,59 +1,57 @@
|
|||
#include <iostream>
|
||||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/internal/Exact_complex.h>
|
||||
#include <CGAL/Point_2.h>
|
||||
#include <CGAL/Circle_2.h>
|
||||
|
||||
#include <CGAL/Cartesian.h>
|
||||
|
||||
using namespace CGAL;
|
||||
using namespace std;
|
||||
#include <iostream>
|
||||
|
||||
int main(void) {
|
||||
int main(int, char**)
|
||||
{
|
||||
typedef CORE::Expr NT;
|
||||
typedef CGAL::Cartesian<NT> Kernel;
|
||||
typedef CGAL::Exact_complex<NT> cplx;
|
||||
typedef Kernel::Point_2 Point;
|
||||
typedef Kernel::Circle_2 Circle;
|
||||
|
||||
typedef CORE::Expr NT;
|
||||
typedef Exact_complex<NT> cplx;
|
||||
typedef Point_2< Cartesian<NT> > Point;
|
||||
typedef Circle_2< Cartesian<NT> > Circle;
|
||||
cplx n;
|
||||
n.set_imag(-1);
|
||||
n.set_real(3);
|
||||
std::cout << "n = " << n << std::endl;
|
||||
std::cout << "sq_mod(n) = " << n.square_modulus() << std::endl;
|
||||
std::cout << "mod(n) = " << n.modulus() << std::endl;
|
||||
std::cout << std::endl;
|
||||
cplx m(2, 3);
|
||||
std::cout << "m = " << m << std::endl;
|
||||
std::cout << "sq_mod(m) = " << m.square_modulus() << std::endl;
|
||||
std::cout << "mod(m) = " << m.modulus() << std::endl;
|
||||
std::cout << std::endl;
|
||||
|
||||
cplx n;
|
||||
n.set_imag(-1);
|
||||
n.set_real(3);
|
||||
cout << "n = " << n << endl;
|
||||
cout << "sq_mod(n) = " << n.square_modulus() << endl;
|
||||
cout << "mod(n) = " << n.modulus() << endl;
|
||||
cout << endl;
|
||||
cplx m(2, 3);
|
||||
cout << "m = " << m << endl;
|
||||
cout << "sq_mod(m) = " << m.square_modulus() << endl;
|
||||
cout << "mod(m) = " << m.modulus() << endl;
|
||||
cout << endl;
|
||||
std::cout << "m + n = " << m + n << std::endl;
|
||||
std::cout << "m - n = " << m - n << std::endl;
|
||||
std::cout << "m * n = " << m * n << std::endl;
|
||||
std::cout << "m / n = " << m / n << std::endl;
|
||||
std::cout << "n / m = " << n / m << std::endl;
|
||||
|
||||
cout << "m + n = " << m + n << endl;
|
||||
cout << "m - n = " << m - n << endl;
|
||||
cout << "m * n = " << m * n << endl;
|
||||
cout << "m / n = " << m / n << endl;
|
||||
cout << "n / m = " << n / m << endl;
|
||||
cplx mon = m/n;
|
||||
cplx nom = n/m;
|
||||
|
||||
cplx mon = m/n;
|
||||
cplx nom = n/m;
|
||||
cplx res1(NT(3)/NT(10), NT(11)/NT(10));
|
||||
cplx res2(NT(3)/NT(13), NT(-11)/NT(13));
|
||||
|
||||
cplx res1(NT(3)/NT(10), NT(11)/NT(10));
|
||||
cplx res2(NT(3)/NT(13), NT(-11)/NT(13));
|
||||
CGAL_assertion(mon == res1);
|
||||
CGAL_assertion(nom == res2);
|
||||
|
||||
CGAL_assertion(mon == res1);
|
||||
CGAL_assertion(nom == res2);
|
||||
std::cout << "n < m: " << (n < m ? "true" : "false") << std::endl;
|
||||
|
||||
cout << "n < m: " << (n < m ? "true" : "false") << endl;
|
||||
Point pt(NT(2)/NT(10), NT(6)/NT(10));
|
||||
cplx p(pt.x(), pt.y());
|
||||
std::cout << "p = " << p << std::endl;
|
||||
std::cout << "recip = " << p.reciprocal() << std::endl;
|
||||
std::cout << "inver = " << p.invert_in_unit_circle() << std::endl;
|
||||
|
||||
Point pt(NT(2)/NT(10), NT(6)/NT(10));
|
||||
cplx p(pt.x(), pt.y());
|
||||
cout << "p = " << p << endl;
|
||||
cout << "recip = " << p.reciprocal() << endl;
|
||||
cout << "inver = " << p.invert_in_unit_circle() << endl;
|
||||
Circle c(Point(NT(2)/NT(10), NT(3)/NT(4)), NT(1)/NT(2));
|
||||
cplx ipc = p.invert_in_circle(c);
|
||||
std::cout << "inverted in circle: " << ipc << std::endl;
|
||||
|
||||
Circle c(Point(NT(2)/NT(10), NT(3)/NT(4)), NT(1)/NT(2));
|
||||
cplx ipc = p.invert_in_circle(c);
|
||||
cout << "inverted in circle: " << ipc << endl;
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,35 +1,33 @@
|
|||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
|
||||
#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/basic.h>
|
||||
|
||||
typedef CORE::Expr NT;
|
||||
typedef CGAL::Cartesian<NT> Kernel;
|
||||
typedef CGAL::Periodic_4_hyperbolic_Delaunay_triangulation_traits_2<Kernel,
|
||||
CGAL::Hyperbolic_octagon_translation> Traits;
|
||||
CGAL::Hyperbolic_octagon_translation> Traits;
|
||||
typedef CGAL::Periodic_4_hyperbolic_Delaunay_triangulation_2<Traits> Triangulation;
|
||||
typedef Kernel::Point_2 Point;
|
||||
|
||||
typedef Traits::Construct_hyperbolic_point_2 CP2;
|
||||
typedef Traits::Hyperbolic_translation Trans;
|
||||
|
||||
using namespace std;
|
||||
using namespace CGAL;
|
||||
|
||||
int main(int /*argc*/, char** /*argv*/)
|
||||
{
|
||||
std::vector<Trans> gens;
|
||||
Trans::generators(gens);
|
||||
std::vector<Trans> gens;
|
||||
Trans::generators(gens);
|
||||
|
||||
Point O(0,0);
|
||||
for(std::size_t i=0; i<gens.size(); ++i) {
|
||||
Point pt = CP2()(O, gens[i]);
|
||||
cout << "Image " << i << ": " << pt << endl;
|
||||
}
|
||||
Point O(0,0);
|
||||
for(std::size_t i=0; i<gens.size(); ++i)
|
||||
{
|
||||
Point pt = CP2()(O, gens[i]);
|
||||
std::cout << "Image " << i << ": " << pt << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,44 +1,42 @@
|
|||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.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>
|
||||
#include <CGAL/determinant.h>
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
#include <boost/random/uniform_smallint.hpp>
|
||||
#include <boost/random/variate_generator.hpp>
|
||||
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.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>
|
||||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/determinant.h>
|
||||
|
||||
|
||||
typedef CORE::Expr NT;
|
||||
typedef CORE::Expr NT;
|
||||
typedef CGAL::Algebraic_kernel_for_circles_2_2<NT> AK; // Algebraic kernel
|
||||
typedef CGAL::Cartesian<NT> BK; // Basic kernel
|
||||
typedef CGAL::Circular_kernel_2<BK, AK> Kernel;
|
||||
typedef CGAL::Periodic_4_hyperbolic_Delaunay_triangulation_traits_2<Kernel,
|
||||
CGAL::Hyperbolic_octagon_translation> Traits;
|
||||
typedef CGAL::Periodic_4_hyperbolic_Delaunay_triangulation_traits_2<
|
||||
Kernel, CGAL::Hyperbolic_octagon_translation> Traits;
|
||||
typedef CGAL::Periodic_4_hyperbolic_Delaunay_triangulation_2<Traits> Triangulation;
|
||||
typedef Triangulation::Face_iterator Face_iterator;
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
int main(int, char**)
|
||||
{
|
||||
Triangulation tr;
|
||||
|
||||
int main(void) {
|
||||
std::cout << "Triangulation successfully initialized with dummy points!" << std::endl << "---------------------------------------------" << std::endl;
|
||||
std::cout << "Number of vertices: " << tr.number_of_vertices() << std::endl;
|
||||
std::cout << "Number of faces: " << tr.number_of_faces() << std::endl;
|
||||
std::cout << "Number of edges: " << tr.number_of_edges() << std::endl;
|
||||
std::cout << "Expected edges (by Euler relation): " << tr.number_of_vertices() + tr.number_of_faces() + 2 << std::endl;
|
||||
|
||||
Triangulation tr;
|
||||
assert(tr.is_valid(true));
|
||||
if(!tr.is_valid(true))
|
||||
return EXIT_FAILURE;
|
||||
|
||||
cout << "Triangulation successfully initialized with dummy points!" << endl << "---------------------------------------------" << endl;
|
||||
cout << "Number of vertices: " << tr.number_of_vertices() << endl;
|
||||
cout << "Number of faces: " << tr.number_of_faces() << endl;
|
||||
cout << "Number of edges: " << tr.number_of_edges() << endl;
|
||||
cout << "Expected edges (by Euler relation): " << tr.number_of_vertices() + tr.number_of_faces() + 2 << endl;
|
||||
|
||||
assert(tr.is_valid(true));
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,22 +1,22 @@
|
|||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/Cartesian.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>
|
||||
#include <CGAL/Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Periodic_2_Delaunay_triangulation_traits_2.h>
|
||||
#include <CGAL/Periodic_2_Delaunay_triangulation_2.h>
|
||||
|
||||
#include <CGAL/determinant.h>
|
||||
#include <CGAL/point_generators_2.h>
|
||||
#include <CGAL/Timer.h>
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
#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/Periodic_4_hyperbolic_Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.h>
|
||||
#include <CGAL/Hyperbolic_octagon_translation.h>
|
||||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/determinant.h>
|
||||
|
||||
#include <CGAL/Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Periodic_2_Delaunay_triangulation_traits_2.h>
|
||||
#include <CGAL/Periodic_2_Delaunay_triangulation_2.h>
|
||||
|
||||
#include <CGAL/Timer.h>
|
||||
|
||||
typedef CORE::Expr NT;
|
||||
typedef CGAL::Cartesian<NT> Kernel;
|
||||
|
|
@ -39,91 +39,90 @@ typedef double
|
|||
typedef CGAL::Cartesian<dNT> dKernel;
|
||||
typedef CGAL::Delaunay_triangulation_2<dKernel> dTriangulation;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if(argc < 2)
|
||||
{
|
||||
std::cout << "usage: " << argv[0] << " [number_of_points_to_insert] [optional: number_of_iterations]" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
int N = atoi(argv[1]);
|
||||
int iters = 1;
|
||||
if(argc == 3)
|
||||
iters = atoi(argv[2]);
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
Side_of_original_octagon pred;
|
||||
|
||||
if (argc < 2) {
|
||||
cout << "usage: " << argv[0] << " [number_of_points_to_insert] [optional: number_of_iterations]" << endl;
|
||||
return -1;
|
||||
std::cout << "---- for best results, make sure that you have compiled me in Release mode ----" << std::endl;
|
||||
|
||||
double extime1 = 0.0;
|
||||
double extime2 = 0.0;
|
||||
double extime3 = 0.0;
|
||||
|
||||
for(int exec = 1; exec <= iters; ++exec)
|
||||
{
|
||||
std::vector<Point> pts;
|
||||
std::vector<Point_double> dpts;
|
||||
CGAL::Random_points_in_disc_2<Point_double, Creator> g(0.85);
|
||||
|
||||
int cnt = 0;
|
||||
std::cout << "================ iteration " << exec << " : generating points ================" << std::endl;
|
||||
do
|
||||
{
|
||||
Point_double pd = *(++g);
|
||||
Point pt = Point(pd.x(), pd.y());
|
||||
if(pred(pt) != CGAL::ON_UNBOUNDED_SIDE)
|
||||
{
|
||||
pts.push_back(pt);
|
||||
dpts.push_back(pd);
|
||||
++cnt;
|
||||
}
|
||||
}
|
||||
while(cnt < N);
|
||||
|
||||
if(cnt < N)
|
||||
{
|
||||
std::cout << "Failed to generate all the random points! Exiting..." << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int N = atoi(argv[1]);
|
||||
int iters = 1;
|
||||
if (argc == 3) {
|
||||
iters = atoi(argv[2]);
|
||||
}
|
||||
std::cout << "Inserting into hyperbolic periodic CORE triangulation... "; std::cout.flush();
|
||||
Triangulation tr;
|
||||
CGAL::Timer t1;
|
||||
t1.start();
|
||||
tr.insert(pts.begin(), pts.end());
|
||||
t1.stop();
|
||||
extime1 += t1.time();
|
||||
std::cout << "DONE! (# of vertices = " << tr.number_of_vertices() << ", time = " << t1.time() << " secs)" << std::endl;
|
||||
|
||||
Side_of_original_octagon pred;
|
||||
std::cout << "inserting into Euclidean non-periodic CORE triangulation... "; std::cout.flush();
|
||||
Euclidean_triangulation etr;
|
||||
CGAL::Timer t2;
|
||||
t2.start();
|
||||
etr.insert(pts.begin(), pts.end());
|
||||
t2.stop();
|
||||
extime2 += t2.time();
|
||||
std::cout << "DONE! (# of vertices = " << etr.number_of_vertices() << ", time = " << t2.time() << " secs)" << std::endl;
|
||||
|
||||
std::cout << "Inserting into Euclidean non-periodic DOUBLE triangulation... "; std::cout.flush();
|
||||
dTriangulation dtr;
|
||||
CGAL::Timer t3;
|
||||
t3.start();
|
||||
dtr.insert(dpts.begin(), dpts.end());
|
||||
t3.stop();
|
||||
extime3 += t3.time();
|
||||
std::cout << "DONE! (# of vertices = " << dtr.number_of_vertices() << ", time = " << t3.time() << " secs)" << std::endl;
|
||||
}
|
||||
|
||||
cout << "---- for best results, make sure that you have compiled me in Release mode ----" << endl;
|
||||
double diters(iters);
|
||||
extime1 /= diters;
|
||||
extime2 /= diters;
|
||||
extime3 /= diters;
|
||||
|
||||
double extime1 = 0.0;
|
||||
double extime2 = 0.0;
|
||||
double extime3 = 0.0;
|
||||
std::cout << "Hyperbolic periodic CORE triangulation: average time = " << extime1 << std::endl;
|
||||
std::cout << "Euclidean non-periodic CORE triangulation: average time = " << extime2 << std::endl;
|
||||
std::cout << "Euclidean non-periodic DOUBLE triangulation: average time = " << extime3 << std::endl;
|
||||
|
||||
for (int exec = 1; exec <= iters; exec++) {
|
||||
|
||||
std::vector<Point> pts;
|
||||
std::vector<Point_double> dpts;
|
||||
CGAL::Random_points_in_disc_2<Point_double, Creator> g(0.85);
|
||||
|
||||
int cnt = 0;
|
||||
cout << "================ iteration " << exec << " : generating points ================" << endl;
|
||||
do {
|
||||
Point_double pd = *(++g);
|
||||
Point pt = Point(pd.x(), pd.y());
|
||||
if (pred(pt) != CGAL::ON_UNBOUNDED_SIDE) {
|
||||
pts.push_back(pt);
|
||||
dpts.push_back(pd);
|
||||
cnt++;
|
||||
}
|
||||
} while (cnt < N);
|
||||
|
||||
if (cnt < N) {
|
||||
cout << "I failed to generate all the random points! Exiting..." << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
cout << "inserting into hyperbolic periodic CORE triangulation... "; cout.flush();
|
||||
Triangulation tr;
|
||||
CGAL::Timer t1;
|
||||
t1.start();
|
||||
tr.insert(pts.begin(), pts.end());
|
||||
t1.stop();
|
||||
extime1 += t1.time();
|
||||
cout << "DONE! (# of vertices = " << tr.number_of_vertices() << ", time = " << t1.time() << " secs)" << endl;
|
||||
|
||||
cout << "inserting into Euclidean non-periodic CORE triangulation... "; cout.flush();
|
||||
Euclidean_triangulation etr;
|
||||
CGAL::Timer t2;
|
||||
t2.start();
|
||||
etr.insert(pts.begin(), pts.end());
|
||||
t2.stop();
|
||||
extime2 += t2.time();
|
||||
cout << "DONE! (# of vertices = " << etr.number_of_vertices() << ", time = " << t2.time() << " secs)" << endl;
|
||||
|
||||
cout << "inserting into Euclidean non-periodic DOUBLE triangulation... "; cout.flush();
|
||||
dTriangulation dtr;
|
||||
CGAL::Timer t3;
|
||||
t3.start();
|
||||
dtr.insert(dpts.begin(), dpts.end());
|
||||
t3.stop();
|
||||
extime3 += t3.time();
|
||||
cout << "DONE! (# of vertices = " << dtr.number_of_vertices() << ", time = " << t3.time() << " secs)" << endl;
|
||||
|
||||
}
|
||||
|
||||
extime1 /= (double)iters;
|
||||
extime2 /= (double)iters;
|
||||
extime3 /= (double)iters;
|
||||
|
||||
cout << "Hyperbolic periodic CORE triangulation: average time = " << extime1 << endl;
|
||||
cout << "Euclidean non-periodic CORE triangulation: average time = " << extime2 << endl;
|
||||
cout << "Euclidean non-periodic DOUBLE triangulation: average time = " << extime3 << endl;
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
|
||||
#define PROFILING_MODE
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
#include <boost/random/uniform_smallint.hpp>
|
||||
#include <boost/random/variate_generator.hpp>
|
||||
|
||||
#include <CGAL/point_generators_2.h>
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.h>
|
||||
|
|
@ -19,6 +15,11 @@
|
|||
#include <CGAL/Circular_kernel_2.h>
|
||||
#include <CGAL/Algebraic_kernel_for_circles_2_2.h>
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
#include <boost/random/uniform_smallint.hpp>
|
||||
#include <boost/random/variate_generator.hpp>
|
||||
|
||||
typedef CORE::Expr NT;
|
||||
typedef CGAL::Cartesian<NT> Kernel;
|
||||
|
||||
|
|
@ -34,7 +35,6 @@ typedef Triangulation::Face_iterator
|
|||
typedef CGAL::Cartesian<double>::Point_2 Point_double;
|
||||
typedef CGAL::Creator_uniform_2<double, Point_double > Creator;
|
||||
|
||||
|
||||
long calls_apply_identity(0);
|
||||
long calls_apply_non_identity(0);
|
||||
long calls_append_identity(0);
|
||||
|
|
@ -46,90 +46,95 @@ double time_predicate_identity(0);
|
|||
double time_predicate_non_identity(0);
|
||||
double time_remove_dp(0);
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if(argc < 2)
|
||||
{
|
||||
std::cout << "usage: " << argv[0] << " [number_of_points_to_insert] [optional: number_of_iterations]" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int N = atoi(argv[1]);
|
||||
int iters = 1;
|
||||
if(argc == 3)
|
||||
iters = atoi(argv[2]);
|
||||
|
||||
if (argc < 2) {
|
||||
cout << "usage: " << argv[0] << " [number_of_points_to_insert] [optional: number_of_iterations]" << endl;
|
||||
return -1;
|
||||
Side_of_original_octagon pred;
|
||||
|
||||
std::cout << "---- for best results, make sure that you have compiled me in Release mode ----" << std::endl;
|
||||
|
||||
double extime = 0.0;
|
||||
|
||||
for(int exec = 1; exec <= iters; ++exec)
|
||||
{
|
||||
std::vector<Point> pts;
|
||||
// We can consider points only in the circle circumscribing the fundamental domain
|
||||
CGAL::Random_points_in_disc_2<Point_double, Creator> g(0.85);
|
||||
|
||||
int cnt = 0;
|
||||
do
|
||||
{
|
||||
Point_double pd = *(++g);
|
||||
if(pred(pd) != CGAL::ON_UNBOUNDED_SIDE)
|
||||
{
|
||||
Point pt = Point(pd.x(), pd.y());
|
||||
pts.push_back(pt);
|
||||
++cnt;
|
||||
}
|
||||
}
|
||||
while(cnt < N);
|
||||
|
||||
std::cout << "iteration " << exec << ": inserting into triangulation (rational dummy points)... "; std::cout.flush();
|
||||
Triangulation tr;
|
||||
|
||||
CGAL::Timer tt;
|
||||
tt.start();
|
||||
tr.insert(pts.begin(), pts.end());
|
||||
tt.stop();
|
||||
std::cout << "DONE! (# of vertices = " << tr.number_of_vertices() << ", time = " << tt.time() << " secs)" << std::endl;
|
||||
extime += tt.time();
|
||||
|
||||
int bfc = 0;
|
||||
for(Face_iterator fit = tr.faces_begin(); fit != tr.faces_end(); fit++)
|
||||
{
|
||||
if(!(fit->translation(0).is_identity() &&
|
||||
fit->translation(1).is_identity() &&
|
||||
fit->translation(2).is_identity()))
|
||||
{
|
||||
++bfc;
|
||||
}
|
||||
}
|
||||
|
||||
int N = atoi(argv[1]);
|
||||
int iters = 1;
|
||||
if (argc == 3) {
|
||||
iters = atoi(argv[2]);
|
||||
}
|
||||
Triangulation::size_type Nf = tr.number_of_faces();
|
||||
double perc = double(bfc)/double(Nf) * 100.0;
|
||||
std::cout << "Total number of faces : " << Nf << std::endl;
|
||||
std::cout << "Faces crossing the boundary: " << bfc << std::endl;
|
||||
std::cout << "Percentage : " << perc << std::endl;
|
||||
|
||||
Side_of_original_octagon pred;
|
||||
std::cout << "Triangulation is valid: " << (tr.is_valid() ? "YES" : "NO") << std::endl;
|
||||
}
|
||||
|
||||
cout << "---- for best results, make sure that you have compiled me in Release mode ----" << endl;
|
||||
|
||||
double extime = 0.0;
|
||||
|
||||
for (int exec = 1; exec <= iters; exec++) {
|
||||
|
||||
std::vector<Point> pts;
|
||||
// We can consider points only in the circle circumscribing the fundamental domain
|
||||
CGAL::Random_points_in_disc_2<Point_double, Creator> g(0.85);
|
||||
|
||||
int cnt = 0;
|
||||
do {
|
||||
Point_double pd = *(++g);
|
||||
if (pred(pd) != CGAL::ON_UNBOUNDED_SIDE) {
|
||||
Point pt = Point(pd.x(), pd.y());
|
||||
pts.push_back(pt);
|
||||
cnt++;
|
||||
}
|
||||
} while (cnt < N);
|
||||
|
||||
cout << "iteration " << exec << ": inserting into triangulation (rational dummy points)... "; cout.flush();
|
||||
Triangulation tr;
|
||||
|
||||
CGAL::Timer tt;
|
||||
tt.start();
|
||||
tr.insert(pts.begin(), pts.end());
|
||||
tt.stop();
|
||||
cout << "DONE! (# of vertices = " << tr.number_of_vertices() << ", time = " << tt.time() << " secs)" << endl;
|
||||
extime += tt.time();
|
||||
|
||||
int bfc = 0;
|
||||
for (Face_iterator fit = tr.faces_begin(); fit != tr.faces_end(); fit++) {
|
||||
if (!(fit->translation(0).is_identity() && fit->translation(1).is_identity() && fit->translation(2).is_identity())) {
|
||||
bfc++;
|
||||
}
|
||||
}
|
||||
int Nf = tr.number_of_faces();
|
||||
double perc = (double)bfc/(double)Nf*100.0;
|
||||
cout << "Total number of faces : " << Nf << endl;
|
||||
cout << "Faces crossing the boundary: " << bfc << endl;
|
||||
cout << "Percentage : " << perc << endl;
|
||||
|
||||
cout << "Triangulation is valid: " << (tr.is_valid() ? "YES" : "NO") << endl;
|
||||
}
|
||||
|
||||
double avgtime = extime / (double)iters;
|
||||
cout << "---------------------------------------" << endl;
|
||||
cout << "Average execution time over " << iters << " iterations: " << avgtime << " secs" << endl << endl;
|
||||
double avgtime = extime / double(iters);
|
||||
std::cout << "---------------------------------------" << std::endl;
|
||||
std::cout << "Average execution time over " << iters << " iterations: " << avgtime << " secs" << std::endl << std::endl;
|
||||
|
||||
|
||||
cout << "Calls to append resulting in identity: " << calls_append_identity << endl;
|
||||
cout << "Calls to append resulting in non-identity: " << calls_append_non_identity << endl;
|
||||
cout << "Percentage : " << ((double)(calls_append_non_identity)/(double)(calls_append_non_identity+calls_append_identity)*100.0) << endl << endl;
|
||||
cout << "Calls to apply with identity: " << calls_apply_identity << endl;
|
||||
cout << "Calls to apply with non-identity: " << calls_apply_non_identity << endl;
|
||||
cout << "Percentage : " << ((double)(calls_apply_non_identity)/(double)(calls_apply_non_identity+calls_apply_identity)*100.0) << endl << endl;
|
||||
std::cout << "Calls to append resulting in identity: " << calls_append_identity << std::endl;
|
||||
std::cout << "Calls to append resulting in non-identity: " << calls_append_non_identity << std::endl;
|
||||
std::cout << "Percentage : " << (double(calls_append_non_identity)/double(calls_append_non_identity+calls_append_identity)*100.0) << std::endl << std::endl;
|
||||
std::cout << "Calls to apply with identity: " << calls_apply_identity << std::endl;
|
||||
std::cout << "Calls to apply with non-identity: " << calls_apply_non_identity << std::endl;
|
||||
std::cout << "Percentage : " << double(calls_apply_non_identity)/(double(calls_apply_non_identity+calls_apply_identity)*100.0) << std::endl << std::endl;
|
||||
|
||||
cout << "Predicate calls with identity translations: " << calls_predicate_identity << endl;
|
||||
cout << "Predicate calls with non-identity translations: " << calls_predicate_non_identity << endl;
|
||||
cout << "Percentage : " << (double)calls_predicate_non_identity/(double)(calls_predicate_non_identity+calls_predicate_identity)*100.0 << endl << endl;
|
||||
std::cout << "Predicate calls with identity translations: " << calls_predicate_identity << std::endl;
|
||||
std::cout << "Predicate calls with non-identity translations: " << calls_predicate_non_identity << std::endl;
|
||||
std::cout << "Percentage : " << double(calls_predicate_non_identity)/double(calls_predicate_non_identity+calls_predicate_identity)*100.0 << std::endl << std::endl;
|
||||
|
||||
cout << "Time in predicates with identity translations: " << time_predicate_identity << endl;
|
||||
cout << "Time in predicates with non-identity translations: " << time_predicate_non_identity << endl;
|
||||
cout << "Percentage : " << (double)time_predicate_non_identity/(double)(time_predicate_non_identity+time_predicate_identity)*100.0 << endl << endl;
|
||||
std::cout << "Time in predicates with identity translations: " << time_predicate_identity << std::endl;
|
||||
std::cout << "Time in predicates with non-identity translations: " << time_predicate_non_identity << std::endl;
|
||||
std::cout << "Percentage : " << double(time_predicate_non_identity)/double(time_predicate_non_identity+time_predicate_identity)*100.0 << std::endl << std::endl;
|
||||
|
||||
cout << "Time to remove dummy points : " << time_remove_dp << endl;
|
||||
std::cout << "Time to remove dummy points : " << time_remove_dp << std::endl;
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,22 @@
|
|||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/CORE_Expr.h>
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
|
||||
#include <CGAL/Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.h>
|
||||
|
||||
#include <CGAL/point_generators_2.h>
|
||||
#include <CGAL/determinant.h>
|
||||
#include <CGAL/Timer.h>
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
#include <boost/random/uniform_smallint.hpp>
|
||||
#include <boost/random/variate_generator.hpp>
|
||||
#include <CGAL/point_generators_2.h>
|
||||
#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>
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
typedef double NT;
|
||||
typedef CGAL::Cartesian<NT> Kernel;
|
||||
|
|
@ -19,61 +25,61 @@ 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;
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if(argc < 2)
|
||||
{
|
||||
std::cout << "usage: " << argv[0] << " [number_of_points_to_insert] [optional: number_of_iterations]" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int N = atoi(argv[1]);
|
||||
int iters = 1;
|
||||
if(argc == 3)
|
||||
iters = atoi(argv[2]);
|
||||
|
||||
if (argc < 2) {
|
||||
cout << "usage: " << argv[0] << " [number_of_points_to_insert] [optional: number_of_iterations]" << endl;
|
||||
return -1;
|
||||
std::cout << "---- for best results, make sure that you have compiled me in Release mode ----" << std::endl;
|
||||
|
||||
double extime = 0.0;
|
||||
Side_of_original_octagon pred;
|
||||
|
||||
for(int exec = 1; exec <= iters; ++exec)
|
||||
{
|
||||
std::vector<Point> 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);
|
||||
|
||||
int N = atoi(argv[1]);
|
||||
int iters = 1;
|
||||
if (argc == 3) {
|
||||
iters = atoi(argv[2]);
|
||||
}
|
||||
std::cout << "iteration " << exec << ": inserting into triangulation (rational dummy points)... "; std::cout.flush();
|
||||
Triangulation tr;
|
||||
|
||||
cout << "---- for best results, make sure that you have compiled me in Release mode ----" << endl;
|
||||
CGAL::Timer tt;
|
||||
tt.start();
|
||||
tr.insert(pts.begin(), pts.end());
|
||||
tt.stop();
|
||||
std::cout << "DONE! (# of vertices = " << tr.number_of_vertices() << ", time = " << tt.time() << " secs)" << std::endl;
|
||||
extime += tt.time();
|
||||
}
|
||||
|
||||
double extime = 0.0;
|
||||
Side_of_original_octagon pred;
|
||||
double avgtime = extime / double(iters);
|
||||
std::cout << "---------------------------------------" << std::endl;
|
||||
std::cout << "Average execution time over " << iters << " iterations: " << avgtime << " secs" << std::endl << std::endl;
|
||||
|
||||
for (int exec = 1; exec <= iters; exec++) {
|
||||
std::vector<Point> 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;
|
||||
|
||||
CGAL::Timer tt;
|
||||
tt.start();
|
||||
tr.insert(pts.begin(), pts.end());
|
||||
tt.stop();
|
||||
cout << "DONE! (# of vertices = " << tr.number_of_vertices() << ", time = " << tt.time() << " secs)" << endl;
|
||||
extime += tt.time();
|
||||
}
|
||||
|
||||
double avgtime = extime / (double)iters;
|
||||
cout << "---------------------------------------" << endl;
|
||||
cout << "Average execution time over " << iters << " iterations: " << avgtime << " secs" << endl << endl;
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,19 @@
|
|||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.h>
|
||||
#include <CGAL/Hyperbolic_octagon_translation.h>
|
||||
|
||||
#include <CGAL/determinant.h>
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
#include <boost/random/uniform_smallint.hpp>
|
||||
#include <boost/random/variate_generator.hpp>
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.h>
|
||||
#include <CGAL/Hyperbolic_octagon_translation.h>
|
||||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/determinant.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
typedef CORE::Expr NT;
|
||||
typedef CGAL::Cartesian<NT> Kernel;
|
||||
|
|
@ -19,52 +24,46 @@ typedef Traits::Circle_2
|
|||
typedef Traits::Euclidean_line_2 Line;
|
||||
typedef Traits::Construct_intersection_2 Construct_intersection_2;
|
||||
|
||||
using CGAL::sqrt;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
int main(int /*argc*/, char** /*argv*/)
|
||||
{
|
||||
NT F2(2);
|
||||
NT F2(2);
|
||||
|
||||
Line ell1(sqrt(F2), sqrt(F2 - sqrt(F2)), - sqrt(F2 + sqrt(F2)));
|
||||
Line ell2(sqrt(F2), sqrt(F2), F2*sqrt(F2 + sqrt(F2)));
|
||||
NT sx = -sqrt(F2 + sqrt(F2))*(sqrt(F2) + F2*sqrt(F2 - sqrt(F2)))/(sqrt(F2)*sqrt(F2-sqrt(F2)) - F2);
|
||||
NT sy = NT(3)*sqrt(F2 + sqrt(F2))*sqrt(F2)/(sqrt(F2)*sqrt(F2 - sqrt(F2)) - F2);
|
||||
Point sol(sx, sy);
|
||||
Line ell1(sqrt(F2), sqrt(F2 - sqrt(F2)), - sqrt(F2 + sqrt(F2)));
|
||||
Line ell2(sqrt(F2), sqrt(F2), F2*sqrt(F2 + sqrt(F2)));
|
||||
NT sx = -sqrt(F2 + sqrt(F2))*(sqrt(F2) + F2*sqrt(F2 - sqrt(F2)))/(sqrt(F2)*sqrt(F2-sqrt(F2)) - F2);
|
||||
NT sy = NT(3)*sqrt(F2 + sqrt(F2))*sqrt(F2)/(sqrt(F2)*sqrt(F2 - sqrt(F2)) - F2);
|
||||
Point sol(sx, sy);
|
||||
|
||||
Point p = Construct_intersection_2()(ell1, ell2);
|
||||
cout << "line-line intersection: " << p << endl;
|
||||
CGAL_assertion(p == sol);
|
||||
cout << "The solution is exact!" << endl;
|
||||
Point p = Construct_intersection_2()(ell1, ell2);
|
||||
std::cout << "line-line intersection: " << p << std::endl;
|
||||
CGAL_assertion(p == sol);
|
||||
std::cout << "The solution is exact!" << std::endl;
|
||||
|
||||
NT root24 = sqrt(sqrt(F2));
|
||||
NT root234 = root24*root24*root24;
|
||||
NT x1 = (NT(-15815)*sqrt(F2) + NT(19119)*root24 + NT(13444)*root234 - NT(23479))*sqrt(NT(1)+sqrt(F2))/NT(542) + NT(24831)*sqrt(F2)/NT(542) - NT(14840)*root24/NT(271) - NT(10708)*root234/NT(271) + NT(17856)/NT(271);
|
||||
NT y1 = (NT(-9090)*sqrt(F2) + NT(9803)*root24 + NT(8313)*root234 - NT(13801))*sqrt(NT(1)+sqrt(F2))/NT(542) + NT(14453)*sqrt(F2)/NT(542) - NT(8526)*root24/NT(271) - NT(6195)*root234/NT(271) + NT(9501)/NT(271);
|
||||
NT r12 = (NT(-3028175552)*sqrt(F2) + NT(3601721772)*root24 + NT(2545971914)*root234 - NT(4279338600))*sqrt(NT(1)+sqrt(F2))/NT(146882) + NT(4705259439)*sqrt(F2)/NT(146882) - NT(2797188994)*root24/NT(73441) - NT(1977303520)*root234/NT(73441) + NT(3327746973)/NT(73441);
|
||||
|
||||
NT root24 = sqrt(sqrt(F2));
|
||||
NT root234 = root24*root24*root24;
|
||||
NT x1 = (NT(-15815)*sqrt(F2) + NT(19119)*root24 + NT(13444)*root234 - NT(23479))*sqrt(NT(1)+sqrt(F2))/NT(542) + NT(24831)*sqrt(F2)/NT(542) - NT(14840)*root24/NT(271) - NT(10708)*root234/NT(271) + NT(17856)/NT(271);
|
||||
NT y1 = (NT(-9090)*sqrt(F2) + NT(9803)*root24 + NT(8313)*root234 - NT(13801))*sqrt(NT(1)+sqrt(F2))/NT(542) + NT(14453)*sqrt(F2)/NT(542) - NT(8526)*root24/NT(271) - NT(6195)*root234/NT(271) + NT(9501)/NT(271);
|
||||
NT r12 = (NT(-3028175552)*sqrt(F2) + NT(3601721772)*root24 + NT(2545971914)*root234 - NT(4279338600))*sqrt(NT(1)+sqrt(F2))/NT(146882) + NT(4705259439)*sqrt(F2)/NT(146882) - NT(2797188994)*root24/NT(73441) - NT(1977303520)*root234/NT(73441) + NT(3327746973)/NT(73441);
|
||||
Circle c1(Point(x1, y1), r12);
|
||||
|
||||
Circle c1(Point(x1, y1), r12);
|
||||
std::pair<Point, Point> ipt = Construct_intersection_2()(ell1, c1);
|
||||
Point ip1 = ipt.first, ip2 = ipt.second;
|
||||
std::cout << "Intersection of circle and line: " << ip1 << " and " << ip2 << std::endl;
|
||||
CGAL_assertion(ip1 == sol || ip2 == sol);
|
||||
std::cout << "The solution is exact!" << std::endl;
|
||||
|
||||
std::pair<Point, Point> ipt = Construct_intersection_2()(ell1, c1);
|
||||
Point ip1 = ipt.first, ip2 = ipt.second;
|
||||
cout << "Intersection of circle and line: " << ip1 << " and " << ip2 << endl;
|
||||
CGAL_assertion(ip1 == sol || ip2 == sol);
|
||||
cout << "The solution is exact!" << endl;
|
||||
NT x2 = (NT(203109)*sqrt(F2) - NT(54251)*root24 + NT(10397)*root234 + NT(223071))*sqrt(sqrt(F2) - NT(1))/NT(84386) - NT(48258)*sqrt(F2)/NT(42193) + NT(23571)*root24/NT(42193) + NT(106401)*root234/NT(84386) - NT(14511)/NT(42193);
|
||||
NT y2 = (NT(-406218)*sqrt(F2) + NT(277274)*root24 + NT(105785)*root234 - NT(446142))*sqrt(F2 - sqrt(F2))/NT(168772) - NT(23571)*sqrt(F2)/NT(42193) + NT(14511)*root24/NT(42193) + NT(48258)*root234/NT(42193) - NT(106401)/NT(42193);
|
||||
NT r22 = (NT(-38737365474)*sqrt(F2) + NT(62674657740)*root24 + NT(43541114565)*root234 - NT(69201833202))*sqrt(NT(1)+sqrt(F2))/NT(3560498498) + NT(87751517789)*sqrt(F2)/NT(3560498498) - NT(35806387098)*root24/NT(1780249249) - NT(28113144981)*root234/NT(1780249249) + NT(125172318975)/NT(3560498498);
|
||||
|
||||
Circle c2(Point(x2, y2), r22);
|
||||
std::pair<Point, Point> cpt = Construct_intersection_2()(c1, c2);
|
||||
ip1 = cpt.first;
|
||||
ip2 = cpt.second;
|
||||
std::cout << "Intersection of circles: " << ip1 << " and " << ip2 << std::endl;
|
||||
CGAL_assertion(ip1 == sol || ip2 == sol);
|
||||
std::cout << "The solution is exact!" << std::endl;
|
||||
|
||||
NT x2 = (NT(203109)*sqrt(F2) - NT(54251)*root24 + NT(10397)*root234 + NT(223071))*sqrt(sqrt(F2) - NT(1))/NT(84386) - NT(48258)*sqrt(F2)/NT(42193) + NT(23571)*root24/NT(42193) + NT(106401)*root234/NT(84386) - NT(14511)/NT(42193);
|
||||
NT y2 = (NT(-406218)*sqrt(F2) + NT(277274)*root24 + NT(105785)*root234 - NT(446142))*sqrt(F2 - sqrt(F2))/NT(168772) - NT(23571)*sqrt(F2)/NT(42193) + NT(14511)*root24/NT(42193) + NT(48258)*root234/NT(42193) - NT(106401)/NT(42193);
|
||||
NT r22 = (NT(-38737365474)*sqrt(F2) + NT(62674657740)*root24 + NT(43541114565)*root234 - NT(69201833202))*sqrt(NT(1)+sqrt(F2))/NT(3560498498) + NT(87751517789)*sqrt(F2)/NT(3560498498) - NT(35806387098)*root24/NT(1780249249) - NT(28113144981)*root234/NT(1780249249) + NT(125172318975)/NT(3560498498);
|
||||
|
||||
Circle c2(Point(x2, y2), r22);
|
||||
std::pair<Point, Point> cpt = Construct_intersection_2()(c1, c2);
|
||||
ip1 = cpt.first;
|
||||
ip2 = cpt.second;
|
||||
cout << "Intersection of circles: " << ip1 << " and " << ip2 << endl;
|
||||
CGAL_assertion(ip1 == sol || ip2 == sol);
|
||||
cout << "The solution is exact!" << endl;
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.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>
|
||||
#include <CGAL/determinant.h>
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
#include <boost/random/uniform_smallint.hpp>
|
||||
#include <boost/random/variate_generator.hpp>
|
||||
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.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>
|
||||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/determinant.h>
|
||||
|
||||
using namespace CGAL;
|
||||
#include <iostream>
|
||||
|
||||
typedef CORE::Expr NT;
|
||||
typedef CGAL::Cartesian<NT> Kernel;
|
||||
|
|
@ -28,52 +28,56 @@ typedef Triangulation::Locate_type
|
|||
typedef Triangulation::Hyperbolic_translation Hyperbolic_translation;
|
||||
typedef Triangulation::Point Point;
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const Locate_type& lt)
|
||||
{
|
||||
switch(lt)
|
||||
{
|
||||
case Triangulation::VERTEX:
|
||||
s << "VERTEX";
|
||||
break;
|
||||
case Triangulation::FACE:
|
||||
s << "FACE";
|
||||
break;
|
||||
case Triangulation::EDGE:
|
||||
s << "EDGE";
|
||||
break;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const Locate_type& lt) {
|
||||
switch(lt) {
|
||||
case Triangulation::VERTEX: s << "VERTEX"; break;
|
||||
case Triangulation::FACE: s << "FACE"; break;
|
||||
case Triangulation::EDGE: s << "EDGE"; break;
|
||||
default: s << "ZABABA"; break;
|
||||
}
|
||||
return s;
|
||||
return s;
|
||||
}
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
int main(int, char**)
|
||||
{
|
||||
Triangulation tr;
|
||||
|
||||
int main(void) {
|
||||
assert(tr.is_valid());
|
||||
|
||||
Triangulation tr;
|
||||
Locate_type lt;
|
||||
int li;
|
||||
Face_handle fh;
|
||||
|
||||
assert(tr.is_valid());
|
||||
|
||||
Locate_type lt;
|
||||
int li;
|
||||
Face_handle fh;
|
||||
|
||||
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.hyperbolic_locate(query, lt, li);
|
||||
assert(lt == Triangulation::VERTEX);
|
||||
cout << " dummy point " << j << ": OK " << endl;
|
||||
}
|
||||
|
||||
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);
|
||||
std::cout << "---- locating dummy points (all should be vertices) ----" << std::endl;
|
||||
for(int j=0; j<14; ++j) {
|
||||
Point query = tr.get_dummy_point(j);
|
||||
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.hyperbolic_locate(v->point(), lt, li);
|
||||
assert(lt == Triangulation::VERTEX);
|
||||
cout << " located as vertex OK" << endl;
|
||||
std::cout << " dummy point " << j << ": OK " << std::endl;
|
||||
}
|
||||
|
||||
// TODO: add a test case for a circular edge!
|
||||
std::cout << "---- locating the midpoint of a Euclidean segment ----" << std::endl;
|
||||
Point p1 = tr.get_dummy_point(0), p2 = tr.get_dummy_point(1);
|
||||
Point query = midpoint(p1, p2);
|
||||
fh = tr.hyperbolic_locate(query, lt, li);
|
||||
assert(lt == Triangulation::EDGE);
|
||||
std::cout << " located as edge OK" << std::endl;
|
||||
|
||||
return 0;
|
||||
std::cout << "---- inserting a single point and locating it ----" << std::endl;
|
||||
Vertex_handle v = tr.insert(Point(-0.4, -0.1));
|
||||
fh = tr.hyperbolic_locate(v->point(), lt, li);
|
||||
assert(lt == Triangulation::VERTEX);
|
||||
std::cout << " located as vertex OK" << std::endl;
|
||||
|
||||
// TODO: add a test case for a circular edge!
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,47 +1,49 @@
|
|||
#include <iostream>
|
||||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/Point_2.h>
|
||||
#include <CGAL/Circle_2.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/internal/Exact_complex.h>
|
||||
#include <CGAL/internal/Hyperbolic_octagon_translation_matrix.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace CGAL;
|
||||
using namespace std;
|
||||
|
||||
int main(void) {
|
||||
int main(int, char**)
|
||||
{
|
||||
typedef CORE::Expr NT;
|
||||
typedef Exact_complex<NT> ECplx;
|
||||
typedef Hyperbolic_octagon_translation_matrix<ECplx> Matrix;
|
||||
typedef Point_2< Cartesian<NT> > Point;
|
||||
// typedef Circle_2< Cartesian<NT> > Circle;
|
||||
|
||||
typedef CORE::Expr NT;
|
||||
typedef Exact_complex<NT> ECplx;
|
||||
typedef Hyperbolic_octagon_translation_matrix<ECplx> Matrix;
|
||||
typedef Point_2< Cartesian<NT> > Point;
|
||||
// typedef Circle_2< Cartesian<NT> > Circle;
|
||||
Matrix m;
|
||||
std::cout << "Identity matrix: " << m << std::endl;
|
||||
|
||||
Matrix m;
|
||||
cout << "Identity matrix: " << m << endl;
|
||||
vector<Matrix> gens;
|
||||
Matrix::generators(gens);
|
||||
for(std::size_t i=0; i<gens.size(); ++i)
|
||||
std::cout << "g[" << i << "] = " << gens[i] << std::endl;
|
||||
|
||||
vector<Matrix> gens;
|
||||
Matrix::generators(gens);
|
||||
for (int i = 0; i < gens.size(); i++) {
|
||||
cout << "g[" << i << "] = " << gens[i] << endl;
|
||||
}
|
||||
CGAL_assertion(gens[0]*gens[4] == m);
|
||||
CGAL_assertion(gens[1]*gens[5] == m);
|
||||
CGAL_assertion(gens[2]*gens[6] == m);
|
||||
CGAL_assertion(gens[3]*gens[7] == m);
|
||||
|
||||
CGAL_assertion(gens[0]*gens[4] == m);
|
||||
CGAL_assertion(gens[1]*gens[5] == m);
|
||||
CGAL_assertion(gens[2]*gens[6] == m);
|
||||
CGAL_assertion(gens[3]*gens[7] == m);
|
||||
ECplx o(NT(0), NT(0));
|
||||
vector<ECplx> imp;
|
||||
for(std::size_t i=0; i<gens.size(); ++i)
|
||||
{
|
||||
imp.push_back(gens[i](o));
|
||||
std::cout << "imp[" << i << "] = " << imp[i] << std::endl;
|
||||
}
|
||||
|
||||
ECplx o(NT(0), NT(0));
|
||||
vector<ECplx> imp;
|
||||
for (int i = 0; i < gens.size(); i++) {
|
||||
imp.push_back(gens[i](o));
|
||||
cout << "imp[" << i << "] = " << imp[i] << endl;
|
||||
}
|
||||
CGAL_assertion(imp[0] == ECplx(CGAL::sqrt(NT(2))/(CGAL::sqrt(NT(1)+CGAL::sqrt(NT(2)))), NT(0)));
|
||||
CGAL_assertion(imp[1] == ECplx(NT(1)/(CGAL::sqrt(NT(1)+CGAL::sqrt(NT(2)))), NT(1)/(CGAL::sqrt(NT(1)+CGAL::sqrt(NT(2))))));
|
||||
|
||||
CGAL_assertion(imp[0] == ECplx(CGAL::sqrt(NT(2))/(CGAL::sqrt(NT(1)+CGAL::sqrt(NT(2)))), NT(0)));
|
||||
CGAL_assertion(imp[1] == ECplx(NT(1)/(CGAL::sqrt(NT(1)+CGAL::sqrt(NT(2)))), NT(1)/(CGAL::sqrt(NT(1)+CGAL::sqrt(NT(2))))));
|
||||
std::cout << "test concluded successfully!" << std::endl;
|
||||
|
||||
cout << "test concluded successfully!" << endl;
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,16 +1,20 @@
|
|||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
|
||||
#include <CGAL/point_generators_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>
|
||||
|
||||
#include <CGAL/determinant.h>
|
||||
#include <CGAL/Point_2.h>
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
#include <boost/random/uniform_smallint.hpp>
|
||||
#include <boost/random/variate_generator.hpp>
|
||||
#include <CGAL/point_generators_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>
|
||||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/determinant.h>
|
||||
#include <CGAL/Point_2.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
typedef CORE::Expr NT;
|
||||
typedef CGAL::Cartesian<NT> Kernel;
|
||||
|
|
@ -18,8 +22,8 @@ typedef CGAL::Periodic_4_hyperbolic_Delaunay_triangulation_traits_2<Kernel,
|
|||
CGAL::Hyperbolic_octagon_translation> Traits;
|
||||
typedef CGAL::Periodic_4_hyperbolic_Delaunay_triangulation_2<Traits> Triangulation;
|
||||
typedef Triangulation::Face_iterator Face_iterator;
|
||||
typedef Triangulation::Vertex_handle Vertex_handle;
|
||||
typedef Triangulation::Point Point;
|
||||
typedef Triangulation::Vertex_handle Vertex_handle;
|
||||
typedef Triangulation::Point Point;
|
||||
typedef Triangulation::Vertex_iterator Iter;
|
||||
typedef Traits::Side_of_original_octagon Side_of_original_octagon;
|
||||
|
||||
|
|
@ -27,60 +31,65 @@ typedef CGAL::Cartesian<double>
|
|||
typedef DKernel::Point_2 DPoint;
|
||||
typedef CGAL::Creator_uniform_2<double, DPoint > Creator;
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int N;
|
||||
if(argc < 2)
|
||||
{
|
||||
std::cout << "usage: " << argv[0] << " [number of points]" << std::endl;
|
||||
std::cout << "generating 1000 points (default)!" << std::endl;
|
||||
N = 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
N = atoi(argv[1]);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int iters = 1;
|
||||
if(argc == 3)
|
||||
iters = atoi(argv[2]);
|
||||
|
||||
int N;
|
||||
if (argc < 2) {
|
||||
cout << "usage: " << argv[0] << " [number of points]" << endl;
|
||||
cout << "generating 1000 points (default)!" << endl;
|
||||
N = 1000;
|
||||
} else {
|
||||
N = atoi(argv[1]);
|
||||
|
||||
for(int itr = 0; itr < iters; ++itr)
|
||||
{
|
||||
Triangulation tr;
|
||||
|
||||
CGAL::Random_points_in_disc_2<DPoint, Creator> g(0.85);
|
||||
Side_of_original_octagon pred;
|
||||
|
||||
//std::vector<Vertex_handle> new_v;
|
||||
int cnt = 0;
|
||||
do {
|
||||
DPoint pt = *g;
|
||||
++g;
|
||||
if(pred(pt) != CGAL::ON_UNBOUNDED_SIDE) {
|
||||
//new_v.push_back(tr.insert(pt));
|
||||
tr.insert(Point(pt.x(), pt.y()));
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
while(cnt < N);
|
||||
|
||||
int iters = 1;
|
||||
if (argc == 3) {
|
||||
iters = atoi(argv[2]);
|
||||
tr.try_to_remove_dummy_vertices();
|
||||
assert(tr.is_valid());
|
||||
assert(tr.number_of_dummy_points() == 0);
|
||||
|
||||
bool again;
|
||||
do
|
||||
{
|
||||
again = false;
|
||||
for(Iter it = tr.vertices_begin(); it != tr.vertices_end(); ++it)
|
||||
{
|
||||
if(tr.remove(it))
|
||||
again = true;
|
||||
|
||||
}
|
||||
}
|
||||
while(again);
|
||||
|
||||
for (int itr = 0; itr < iters; itr++) {
|
||||
Triangulation tr;
|
||||
std::cout << "Final count of vertices: " << tr.number_of_vertices() << std::endl;
|
||||
assert(tr.is_valid());
|
||||
}
|
||||
|
||||
CGAL::Random_points_in_disc_2<DPoint, Creator> g( 0.85 );
|
||||
Side_of_original_octagon pred;
|
||||
|
||||
//std::vector<Vertex_handle> new_v;
|
||||
int cnt = 0;
|
||||
do {
|
||||
DPoint pt = *g;
|
||||
++g;
|
||||
if (pred(pt) != CGAL::ON_UNBOUNDED_SIDE) {
|
||||
//new_v.push_back(tr.insert(pt));
|
||||
tr.insert(Point(pt.x(), pt.y()));
|
||||
cnt++;
|
||||
}
|
||||
} while (cnt < N);
|
||||
|
||||
tr.try_to_remove_dummy_vertices();
|
||||
assert(tr.is_valid());
|
||||
assert(tr.number_of_dummy_points() == 0);
|
||||
|
||||
bool again;
|
||||
do {
|
||||
again = false;
|
||||
for (Iter it = tr.vertices_begin(); it != tr.vertices_end(); it++) {
|
||||
if (tr.remove(it)) {
|
||||
again = true;
|
||||
}
|
||||
}
|
||||
} while (again);
|
||||
|
||||
cout << "Final count of vertices: " << tr.number_of_vertices() << endl;
|
||||
assert(tr.is_valid());
|
||||
}
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,83 +1,94 @@
|
|||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
#include <boost/random/uniform_smallint.hpp>
|
||||
#include <boost/random/variate_generator.hpp>
|
||||
#include <CGAL/point_generators_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>
|
||||
#include <CGAL/Hyperbolic_octagon_translation.h>
|
||||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/determinant.h>
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
#include <boost/random/uniform_smallint.hpp>
|
||||
#include <boost/random/variate_generator.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
typedef CORE::Expr NT;
|
||||
typedef CGAL::Cartesian<NT> Kernel;
|
||||
typedef CGAL::Periodic_4_hyperbolic_Delaunay_triangulation_traits_2<Kernel,
|
||||
CGAL::Hyperbolic_octagon_translation> Traits;
|
||||
typedef CGAL::Periodic_4_hyperbolic_Delaunay_triangulation_2<Traits> Triangulation;
|
||||
typedef Triangulation::Face_iterator Face_iterator;
|
||||
typedef Triangulation::Vertex_handle Vertex_handle;
|
||||
typedef Triangulation::Point Point;
|
||||
typedef Triangulation::Vertex_handle Vertex_handle;
|
||||
typedef Triangulation::Point Point;
|
||||
typedef Traits::Side_of_original_octagon Side_of_original_octagon;
|
||||
typedef CGAL::Cartesian<double>::Point_2 Point_double;
|
||||
typedef CGAL::Creator_uniform_2<double, Point_double > Creator;
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if(argc < 2)
|
||||
{
|
||||
std::cout << "usage: " << argv[0] << " [number_of_iterations]" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int iter = atoi(argv[1]);
|
||||
Side_of_original_octagon pred;
|
||||
|
||||
if (argc < 2) {
|
||||
cout << "usage: " << argv[0] << " [number_of_iterations]" << endl;
|
||||
return -1;
|
||||
int N = 500;
|
||||
int min = 2*N;
|
||||
int max = -1;
|
||||
double mean = 0.0;
|
||||
for(int j=0; j<iter; ++j)
|
||||
{
|
||||
//cout << "Iteration " << (j+1) << "/" << iter << "..." << std::endl;
|
||||
|
||||
std::vector<Point_double> v;
|
||||
CGAL::Random_points_in_disc_2<Point_double, Creator> g(0.85);
|
||||
|
||||
Triangulation tr;
|
||||
assert(tr.is_valid(true));
|
||||
|
||||
int cnt = 0;
|
||||
int idx = 0;
|
||||
do
|
||||
{
|
||||
Point_double pt = *(++g);
|
||||
if(pred(pt) != CGAL::ON_UNBOUNDED_SIDE)
|
||||
{
|
||||
tr.insert(Point(pt.x(), pt.y()));
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
while(tr.number_of_dummy_points() > 0 && idx < N-1);
|
||||
|
||||
if(tr.number_of_dummy_points() > 0)
|
||||
{
|
||||
std::cout << "!!! FAILED to remove all dummy points after the insertion of " << N << " random points!" << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
int iter = atoi(argv[1]);
|
||||
Side_of_original_octagon pred;
|
||||
assert(tr.is_valid());
|
||||
std::cout << cnt << std::endl;
|
||||
|
||||
int N = 500;
|
||||
int min = 2*N;
|
||||
int max = -1;
|
||||
double mean = 0.0;
|
||||
for (int j = 0; j < iter; j++) {
|
||||
//cout << "Iteration " << (j+1) << "/" << iter << "..." << endl;
|
||||
if(cnt > max)
|
||||
max = cnt;
|
||||
|
||||
std::vector<Point_double> v;
|
||||
CGAL::Random_points_in_disc_2<Point_double, Creator> g(0.85);
|
||||
if(cnt < min)
|
||||
min = cnt;
|
||||
|
||||
Triangulation tr;
|
||||
assert(tr.is_valid(true));
|
||||
mean += cnt;
|
||||
}
|
||||
mean /= double(iter);
|
||||
|
||||
int cnt = 0;
|
||||
int idx = 0;
|
||||
do {
|
||||
Point_double pt = *(++g);
|
||||
if (pred(pt) != CGAL::ON_UNBOUNDED_SIDE) {
|
||||
tr.insert(Point(pt.x(), pt.y()));
|
||||
cnt++;
|
||||
}
|
||||
} while (tr.number_of_dummy_points() > 0 && idx < N-1);
|
||||
if (tr.number_of_dummy_points() > 0) {
|
||||
cout << "!!! FAILED to remove all dummy points after the insertion of " << N << " random points!" << endl;
|
||||
continue;
|
||||
}
|
||||
assert(tr.is_valid());
|
||||
std::cout << cnt << std::endl;
|
||||
if (cnt > max)
|
||||
max = cnt;
|
||||
if (cnt < min)
|
||||
min = cnt;
|
||||
mean += cnt;
|
||||
}
|
||||
mean /= (double)iter;
|
||||
std::cout << "Finished " << iter << " iterations!" << std::endl;
|
||||
std::cout << "Minimum number of points inserted: " << min << std::endl;
|
||||
std::cout << "Maximum number of points inserted: " << max << std::endl;
|
||||
std::cout << "Average number of points inserted: " << mean << std::endl;
|
||||
|
||||
cout << "Finished " << iter << " iterations!" << endl;
|
||||
cout << "Minimum number of points inserted: " << min << endl;
|
||||
cout << "Maximum number of points inserted: " << max << endl;
|
||||
cout << "Average number of points inserted: " << mean << endl;
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,31 +1,29 @@
|
|||
#include <iostream>
|
||||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/Point_2.h>
|
||||
#include <CGAL/Circle_2.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Hyperbolic_octagon_translation.h>
|
||||
#include <vector>
|
||||
|
||||
#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>
|
||||
|
||||
using namespace CGAL;
|
||||
using namespace std;
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
int main(void) {
|
||||
int main(int, char**)
|
||||
{
|
||||
typedef CORE::Expr NT;
|
||||
typedef CGAL::Cartesian<NT> Kernel;
|
||||
typedef CGAL::Periodic_4_hyperbolic_Delaunay_triangulation_traits_2<Kernel,
|
||||
CGAL::Hyperbolic_octagon_translation> Traits;
|
||||
typedef CGAL::Periodic_4_hyperbolic_Delaunay_triangulation_2<Traits> Triangulation;
|
||||
|
||||
typedef CORE::Expr NT;
|
||||
typedef CGAL::Cartesian<NT> Kernel;
|
||||
typedef CGAL::Periodic_4_hyperbolic_Delaunay_triangulation_traits_2<Kernel,
|
||||
CGAL::Hyperbolic_octagon_translation> Traits;
|
||||
typedef CGAL::Periodic_4_hyperbolic_Delaunay_triangulation_2<Traits> Triangulation;
|
||||
Triangulation tr;
|
||||
assert(tr.is_valid());
|
||||
if(!tr.is_valid())
|
||||
return EXIT_FAILURE;
|
||||
|
||||
Triangulation tr;
|
||||
CGAL_assertion(tr.is_valid());
|
||||
std::cout << "triangulation works!" << std::endl;
|
||||
std::cout << "nb of vertices: " << tr.number_of_vertices() << std::endl;
|
||||
std::cout << "nb of faces: " << tr.number_of_faces() << std::endl;
|
||||
|
||||
cout << "triangulation works!" << std::endl;
|
||||
cout << "nb of vertices: " << tr.number_of_vertices() << endl;
|
||||
cout << "nb of faces: " << tr.number_of_faces() << endl;
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,33 +1,30 @@
|
|||
#include <iostream>
|
||||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/Point_2.h>
|
||||
#include <CGAL/Circle_2.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
|
||||
// #include <CGAL/Hyperbolic_octagon_translation_matrix.h>
|
||||
#include <CGAL/internal/Exact_complex.h>
|
||||
#include <CGAL/Hyperbolic_octagon_translation.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace CGAL;
|
||||
using namespace std;
|
||||
int main(int, char**)
|
||||
{
|
||||
typedef CORE::Expr NT;
|
||||
typedef CGAL::Exact_complex<NT> ECplx;
|
||||
typedef CGAL::Hyperbolic_octagon_translation<NT> Word;
|
||||
|
||||
int main(void) {
|
||||
Word w;
|
||||
// std::cout << "empty word: " << w << ", matrix: " << w.matrix() << std::endl;
|
||||
|
||||
typedef CORE::Expr NT;
|
||||
typedef Exact_complex<NT> ECplx;
|
||||
typedef Hyperbolic_octagon_translation<NT> Word;
|
||||
Word a(0), ab(0, 5), abc(0, 5, 2), abcd(0, 5, 2, 7), dcb(7, 2, 5), dc(7, 2), d(7);
|
||||
// std::cout << "a = " << a << ", matrix: " << a.matrix() << std::endl;
|
||||
// std::cout << "ab = " << ab << ", matrix: " << ab.matrix() << std::endl;
|
||||
// std::cout << "abc = " << abc << ", matrix: " << abc.matrix() << std::endl;
|
||||
// std::cout << "abcd = " << abcd << ", matrix: " << abcd.matrix() << std::endl;
|
||||
// std::cout << "dcb = " << dcb << ", matrix: " << dcb.matrix() << std::endl;
|
||||
// std::cout << "dc = " << dc << ", matrix: " << dc.matrix() << std::endl;
|
||||
// std::cout << "d = " << d << ", matrix: " << d.matrix() << std::endl;
|
||||
|
||||
Word w;
|
||||
// cout << "empty word: " << w << ", matrix: " << w.matrix() << endl;
|
||||
|
||||
Word a(0), ab(0, 5), abc(0, 5, 2), abcd(0, 5, 2, 7), dcb(7, 2, 5), dc(7, 2), d(7);
|
||||
// cout << "a = " << a << ", matrix: " << a.matrix() << endl;
|
||||
// cout << "ab = " << ab << ", matrix: " << ab.matrix() << endl;
|
||||
// cout << "abc = " << abc << ", matrix: " << abc.matrix() << endl;
|
||||
// cout << "abcd = " << abcd << ", matrix: " << abcd.matrix() << endl;
|
||||
// cout << "dcb = " << dcb << ", matrix: " << dcb.matrix() << endl;
|
||||
// cout << "dc = " << dc << ", matrix: " << dc.matrix() << endl;
|
||||
// cout << "d = " << d << ", matrix: " << d.matrix() << endl;
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Loading…
Reference in New Issue