From ddfc4fc0fe0b1178a69b74dc2ee99d14632878af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 15 May 2017 17:13:38 +0200 Subject: [PATCH] T2/T3 now use Perturbation_order in tests with symbolic perturbations --- .../include/CGAL/Regular_triangulation_2.h | 5 +--- .../include/CGAL/Delaunay_triangulation_3.h | 17 ++---------- .../include/CGAL/Regular_triangulation_3.h | 26 ++----------------- .../include/CGAL/Triangulation_3.h | 13 ++++++++++ 4 files changed, 18 insertions(+), 43 deletions(-) diff --git a/Triangulation_2/include/CGAL/Regular_triangulation_2.h b/Triangulation_2/include/CGAL/Regular_triangulation_2.h index 5b8ccb5ffa5..959d1c7e3df 100644 --- a/Triangulation_2/include/CGAL/Regular_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Regular_triangulation_2.h @@ -854,10 +854,7 @@ power_test(const Weighted_point &p0, // We sort the points lexicographically. const Weighted_point * points[4] = {&p0, &p1, &p2, &p}; - std::sort(points, points + 4, - boost::bind(&Self::compare_xy, this, - boost::bind(Dereference(), _1), - boost::bind(Dereference(), _2)) == SMALLER); + std::sort(points, points + 4, typename Base::Perturbation_order(this)); // We successively look whether the leading monomial, then 2nd monomial // of the determinant has non null coefficient. diff --git a/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h b/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h index aa953ac960b..3f18c2f5e57 100644 --- a/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h @@ -905,18 +905,6 @@ protected: void hide_point(Cell_handle, const Point &) {} }; - class Perturbation_order { - const Self *t; - - public: - Perturbation_order(const Self *tr) - : t(tr) {} - - bool operator()(const Point *p, const Point *q) const { - return t->compare_xyz(*p, *q) == SMALLER; - } - }; - #ifdef CGAL_LINKED_WITH_TBB // Functor for parallel insert(begin, end) function template @@ -1132,7 +1120,6 @@ protected: template < class DelaunayTriangulation_3 > class Vertex_inserter; - friend class Perturbation_order; friend class Conflict_tester_3; friend class Conflict_tester_2; @@ -1458,7 +1445,7 @@ side_of_oriented_sphere(const Point &p0, const Point &p1, const Point &p2, // We sort the points lexicographically. const Point * points[5] = {&p0, &p1, &p2, &p3, &p}; - std::sort(points, points+5, Perturbation_order(this) ); + std::sort(points, points + 5, typename Tr_Base::Perturbation_order(this)); // We successively look whether the leading monomial, then 2nd monomial // of the determinant has non null coefficient. @@ -1502,7 +1489,7 @@ coplanar_side_of_bounded_circle(const Point &p0, const Point &p1, // We sort the points lexicographically. const Point * points[4] = {&p0, &p1, &p2, &p}; - std::sort(points, points+4, Perturbation_order(this) ); + std::sort(points, points + 4, typename Tr_Base::Perturbation_order(this)); Orientation local = coplanar_orientation(p0, p1, p2); diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_3.h index f681352c462..b1830cd024f 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_3.h @@ -1844,22 +1844,11 @@ namespace CGAL { return os; // We are now in a degenerate case => we do a symbolic perturbation. - typedef typename Geom_traits::Construct_point_3 Construct_point_3; - Construct_point_3 cp = geom_traits().construct_point_3_object(); // We sort the points lexicographically. const Weighted_point * points[5] = {&p0, &p1, &p2, &p3, &p}; - // boost::bind is used twice, to grab the Bare_point within the Weighted_point*. - // `result_of` is used to go around the way the Lazy kernel works - // (simply grabbing it as a `const Bare_point&` would not work) - std::sort(points, points + 5, - boost::bind(geom_traits().compare_xyz_3_object(), - boost::bind::type>( - cp, boost::bind(Dereference(), _1)), - boost::bind::type>( - cp, boost::bind(Dereference(), _2))) - == SMALLER); + std::sort(points, points + 5, typename Tr_Base::Perturbation_order(this)); // We successively look whether the leading monomial, then 2nd monomial // of the determinant has non null coefficient. @@ -1963,22 +1952,11 @@ namespace CGAL { return os; // We are now in a degenerate case => we do a symbolic perturbation. - typedef typename Geom_traits::Construct_point_3 Construct_point_3; - Construct_point_3 cp = geom_traits().construct_point_3_object(); // We sort the points lexicographically. const Weighted_point * points[4] = {&p0, &p1, &p2, &p}; - // boost::bind is used twice, to grab the Bare_point within the Weighted_point*. - // `result_of` is used to go around the way the Lazy kernel works - // (simply grabbing it as a `const Bare_point&` would not work) - std::sort(points, points + 4, - boost::bind(geom_traits().compare_xyz_3_object(), - boost::bind::type>( - cp, boost::bind(Dereference(), _1)), - boost::bind::type>( - cp, boost::bind(Dereference(), _2))) - == SMALLER); + std::sort(points, points + 4, typename Tr_Base::Perturbation_order(this)); // We successively look whether the leading monomial, then 2nd monomial // of the determinant has non null coefficient. diff --git a/Triangulation_3/include/CGAL/Triangulation_3.h b/Triangulation_3/include/CGAL/Triangulation_3.h index 4db1440c33d..72f81923209 100644 --- a/Triangulation_3/include/CGAL/Triangulation_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_3.h @@ -648,6 +648,19 @@ protected: return AFTER; } + // used as functor in std::sort in Delaunay and regular triangulations + struct Perturbation_order + { + bool operator()(const Point* p, const Point* q) const { + return t->compare_xyz(*p, *q) == SMALLER; + } + + Perturbation_order(const Self *tr) + : t(tr) {} + + const Self *t; + }; + void init_tds() { infinite = _tds.insert_increase_dimension();