T2/T3 now use Perturbation_order in tests with symbolic perturbations

This commit is contained in:
Mael Rouxel-Labbé 2017-05-15 17:13:38 +02:00
parent 044deb6c7e
commit ddfc4fc0fe
4 changed files with 18 additions and 43 deletions

View File

@ -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<Weighted_point>(), _1),
boost::bind(Dereference<Weighted_point>(), _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.

View File

@ -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 <typename DT>
@ -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);

View File

@ -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<Comparison_result>(geom_traits().compare_xyz_3_object(),
boost::bind<typename cpp11::result_of<const Construct_point_3(const Weighted_point&)>::type>(
cp, boost::bind<const Weighted_point&>(Dereference<Weighted_point>(), _1)),
boost::bind<typename cpp11::result_of<const Construct_point_3(const Weighted_point&)>::type>(
cp, boost::bind<const Weighted_point&>(Dereference<Weighted_point>(), _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<Comparison_result>(geom_traits().compare_xyz_3_object(),
boost::bind<typename cpp11::result_of<const Construct_point_3(const Weighted_point&)>::type>(
cp, boost::bind<const Weighted_point&>(Dereference<Weighted_point>(), _1)),
boost::bind<typename cpp11::result_of<const Construct_point_3(const Weighted_point&)>::type>(
cp, boost::bind<const Weighted_point&>(Dereference<Weighted_point>(), _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.

View File

@ -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();