mirror of https://github.com/CGAL/cgal
start removing bind in Bounding_volumes
This commit is contained in:
parent
a925a64fcf
commit
c9a5cf7072
|
|
@ -20,7 +20,6 @@
|
|||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Optimisation/assertions.h>
|
||||
#include <iterator>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/function.hpp>
|
||||
|
||||
#ifdef CGAL_OPTIMISATION_EXPENSIVE_PRECONDITION_TAG
|
||||
|
|
@ -70,13 +69,16 @@ convex_bounding_box_2(
|
|||
typedef typename Traits::Point_2 Point_2;
|
||||
typedef typename Traits::Less_xy_2 Less_xy_2;
|
||||
typedef typename Traits::Less_yx_2 Less_yx_2;
|
||||
typedef boost::function2<bool,Point_2,Point_2> Greater_xy_2;
|
||||
typedef boost::function2<bool,Point_2,Point_2> Greater_yx_2;
|
||||
typedef std::function<bool(const Point_2&,
|
||||
const Point_2&)> Greater_xy_2;
|
||||
typedef Greater_xy_2 Greater_yx_2;
|
||||
|
||||
Less_xy_2 less_xy_2 = t.less_xy_2_object();
|
||||
Less_yx_2 less_yx_2 = t.less_yx_2_object();
|
||||
Greater_xy_2 greater_xy_2 = boost::bind(less_xy_2, _2, _1);
|
||||
Greater_yx_2 greater_yx_2 = boost::bind(less_yx_2, _2, _1);
|
||||
Greater_xy_2 greater_xy_2 = [&less_xy_2](const Point_2& p1, const Point_2& p2)
|
||||
{ return less_xy_2(p2, p1); };
|
||||
Greater_yx_2 greater_yx_2 = [&less_yx_2](const Point_2& p1, const Point_2& p2)
|
||||
{ return less_yx_2(p2, p1); };
|
||||
|
||||
if (less_xy_2(*minx, *f) ||
|
||||
(less_yx_2(*minx, *f) && !less_xy_2(*f, *minx)))
|
||||
|
|
@ -268,21 +270,21 @@ namespace Optimisation {
|
|||
// ---------------------------------------------------------------
|
||||
// Right_of_implicit_line_2
|
||||
// ---------------------------------------------------------------
|
||||
typedef boost::function3<bool,Point_2,Point_2,Direction_2>
|
||||
typedef std::function<bool(const Point_2&, const Point_2& , const Direction_2&)>
|
||||
Right_of_implicit_line_2;
|
||||
|
||||
Right_of_implicit_line_2 right_of_implicit_line_2_object() const {
|
||||
return boost::bind(has_on_negative_side_2_object(),
|
||||
boost::bind(construct_line_2_object(), _2, _3),
|
||||
_1);
|
||||
return [this](const Point_2& p1, const Point_2& p2, const Direction_2& d)
|
||||
{ return this->has_on_negative_side_2_object()(this->construct_line_2_object()(p2, d), p1); };
|
||||
}
|
||||
|
||||
typedef boost::function2<Direction_2,Point_2,Point_2>
|
||||
typedef std::function<Direction_2(const Point_2&, const Point_2&)>
|
||||
Construct_direction_2;
|
||||
|
||||
Construct_direction_2 construct_direction_2_object() const {
|
||||
return boost::bind(Base::construct_direction_2_object(),
|
||||
boost::bind(construct_vector_2_object(), _1, _2));
|
||||
return [this](const Point_2& p1, const Point_2& p2)
|
||||
{ return this->Base::construct_direction_2_object()(
|
||||
this->construct_vector_2_object()(p1, p2)); };
|
||||
}
|
||||
|
||||
template < class Kernel >
|
||||
|
|
@ -324,13 +326,11 @@ namespace Optimisation {
|
|||
rotate_direction_by_multiple_of_pi_2_object() const
|
||||
{ return Rotate_direction_by_multiple_of_pi_2(*this); }
|
||||
|
||||
typedef boost::function2<bool,Direction_2,Direction_2>
|
||||
typedef std::function<bool(const Direction_2&, const Direction_2&)>
|
||||
Less_angle_with_x_axis_2;
|
||||
Less_angle_with_x_axis_2 less_angle_with_x_axis_2_object() const {
|
||||
return boost::bind(std::equal_to<Comparison_result>(),
|
||||
boost::bind(compare_angle_with_x_axis_2_object(),
|
||||
_1, _2),
|
||||
SMALLER);
|
||||
return [this](const Direction_2& d1, const Direction_2& d2)
|
||||
{ return this->compare_angle_with_x_axis_2_object()(d1, d2) == SMALLER; };
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@
|
|||
#include <CGAL/Rectangular_p_center_traits_2.h>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/function.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -38,8 +36,6 @@ rectangular_2_center_2(
|
|||
Traits& t)
|
||||
{
|
||||
using std::pair;
|
||||
using std::greater;
|
||||
using std::less;
|
||||
|
||||
typedef typename Traits::Iso_rectangle_2 Rectangle;
|
||||
typedef typename Traits::Point_2 Point;
|
||||
|
|
@ -53,7 +49,7 @@ rectangular_2_center_2(
|
|||
P_below_right;
|
||||
typedef typename Traits::Construct_point_2_below_left_implicit_point_2
|
||||
P_below_left;
|
||||
typedef boost::function1<FT, Point> Gamma;
|
||||
typedef std::function<FT(const Point&)> Gamma;
|
||||
|
||||
// fetch function objects from traits class
|
||||
CVertex v = t.construct_vertex_2_object();
|
||||
|
|
@ -73,14 +69,14 @@ rectangular_2_center_2(
|
|||
// two cases: top-left & bottom-right or top-right & bottom-left
|
||||
Min< FT > minft;
|
||||
Gamma gamma1 =
|
||||
boost::bind(minft, boost::bind(dist, v(bb, 0), _1), boost::bind(dist, v(bb, 2), _1));
|
||||
[&minft, &bb, &dist, &v](const Point& p){ return minft(dist( v(bb, 0), p), dist(v(bb, 2),p));};
|
||||
Gamma gamma2 =
|
||||
boost::bind(minft, boost::bind(dist, v(bb, 1), _1), boost::bind(dist, v(bb, 3), _1));
|
||||
[&minft, &bb, &dist, &v](const Point& p){ return minft(dist( v(bb, 1), p), dist(v(bb, 3),p));};
|
||||
|
||||
pair< ForwardIterator, ForwardIterator > cand =
|
||||
min_max_element(f, l,
|
||||
boost::bind(greater<FT>(), boost::bind(gamma1, _1), boost::bind(gamma1, _2)),
|
||||
boost::bind(less<FT>(), boost::bind(gamma2, _1), boost::bind(gamma2, _2)));
|
||||
[&gamma1](const Point& p1, const Point& p2){ return std::greater<FT>()(gamma1(p1), gamma1(p2)); },
|
||||
[&gamma2](const Point& p1, const Point& p2){ return std::less<FT>()(gamma2(p1), gamma2(p2)); });
|
||||
|
||||
// return the result
|
||||
if (gamma1(*cand.first) < gamma2(*cand.second)) {
|
||||
|
|
@ -106,9 +102,6 @@ rectangular_3_center_2_type1(
|
|||
typename Traits::FT& rad,
|
||||
Traits& t)
|
||||
{
|
||||
using std::max;
|
||||
using std::less;
|
||||
|
||||
typedef typename Traits::FT FT;
|
||||
typedef typename Traits::Iso_rectangle_2 Rectangle;
|
||||
typedef typename Traits::Point_2 Point;
|
||||
|
|
@ -124,7 +117,7 @@ rectangular_3_center_2_type1(
|
|||
P_below_right;
|
||||
typedef typename Traits::Construct_point_2_below_left_implicit_point_2
|
||||
P_below_left;
|
||||
typedef boost::function1<FT, Point> Gamma;
|
||||
typedef std::function<FT(const Point&)> Gamma;
|
||||
|
||||
// fetch function objects from traits class
|
||||
Rect rect = t.construct_iso_rectangle_2_object();
|
||||
|
|
@ -158,14 +151,14 @@ rectangular_3_center_2_type1(
|
|||
RandomAccessIterator e = l;
|
||||
bool b_empty = true;
|
||||
Min< FT > minft;
|
||||
Gamma gamma = boost::bind(minft,
|
||||
boost::bind(dist, v(r, i), _1),
|
||||
boost::bind(dist, v(r, 2 + i), _1));
|
||||
Gamma gamma = [&minft, &dist, &v, &r, i](const Point& p)
|
||||
{ return minft(dist(v(r, i), p), dist(v(r, 2 + i), p)); };
|
||||
|
||||
while (e - s > 1) {
|
||||
// step (a)
|
||||
RandomAccessIterator m = s + (e - s - 1) / 2;
|
||||
std::nth_element(s, m, e, boost::bind(less<FT>(), boost::bind(gamma, _1), boost::bind(gamma, _2)));
|
||||
std::nth_element(s, m, e, [&gamma](const Point& p1, const Point& p2)
|
||||
{return gamma(p1) < gamma(p2);});
|
||||
|
||||
// step (b)
|
||||
Rectangle b_prime = bounding_box_2(m + 1, e, t);
|
||||
|
|
@ -220,8 +213,9 @@ struct Rectangular_3_center_2_type2_operations_base {
|
|||
typedef typename R::Infinity_distance_2 Infinity_distance_2;
|
||||
typedef typename R::Less_x_2 Less_x_2;
|
||||
typedef typename R::Less_y_2 Less_y_2;
|
||||
typedef boost::function2<bool,Point_2,Point_2> Greater_x_2;
|
||||
typedef boost::function2<bool,Point_2,Point_2> Greater_y_2;
|
||||
typedef std::function<bool(const Point_2& ,
|
||||
const Point_2&)> Greater_x_2;
|
||||
typedef Greater_x_2 Greater_y_2;
|
||||
typedef Min< Point_2, Less_x_2 > Min_x_2;
|
||||
typedef Max< Point_2, Less_x_2 > Max_x_2;
|
||||
typedef Min< Point_2, Less_y_2 > Min_y_2;
|
||||
|
|
@ -236,15 +230,15 @@ struct Rectangular_3_center_2_type2_operations_base {
|
|||
Construct_point_2_below_right_implicit_point_2;
|
||||
typedef typename R::Construct_point_2_below_left_implicit_point_2
|
||||
Construct_point_2_below_left_implicit_point_2;
|
||||
typedef boost::function1<FT,Point_2> Delta;
|
||||
typedef std::function<FT(const Point_2&)> Delta;
|
||||
|
||||
Delta delta() const { return delta_; }
|
||||
Less_x_2 less_x_2_object() const { return r_.less_x_2_object(); }
|
||||
Less_y_2 less_y_2_object() const { return r_.less_y_2_object(); }
|
||||
Greater_x_2 greater_x_2_object() const
|
||||
{ return boost::bind(less_x_2_object(),_2,_1); }
|
||||
{ return [this](const Point_2& p1, const Point_2& p2){ return this->less_x_2_object()(p2, p1); }; }
|
||||
Greater_y_2 greater_y_2_object() const
|
||||
{ return boost::bind(less_y_2_object(),_2,_1); }
|
||||
{ return [this](const Point_2& p1, const Point_2& p2){ return this->less_y_2_object()(p2, p1); }; }
|
||||
Infinity_distance_2 distance() const
|
||||
{ return r_.infinity_distance_2_object(); }
|
||||
Construct_vertex_2 construct_vertex_2_object() const
|
||||
|
|
@ -277,7 +271,7 @@ struct Rectangular_3_center_2_type2_operations_base {
|
|||
public:
|
||||
|
||||
Rectangular_3_center_2_type2_operations_base(R& r, const Point_2& p)
|
||||
: r_(r), delta_(boost::bind(r.infinity_distance_2_object(), p, _1))
|
||||
: r_(r), delta_([&r, &p](const Point_2& q){ return r.infinity_distance_2_object()(p, q); })
|
||||
{}
|
||||
|
||||
};
|
||||
|
|
@ -846,10 +840,6 @@ rectangular_3_center_2_type2(
|
|||
Operations op)
|
||||
{
|
||||
BOOST_USING_STD_MAX();
|
||||
using std::less;
|
||||
using std::greater;
|
||||
using std::greater_equal;
|
||||
using std::not_equal_to;
|
||||
using std::logical_and;
|
||||
using std::max_element;
|
||||
using std::find_if;
|
||||
|
|
@ -894,7 +884,7 @@ rectangular_3_center_2_type2(
|
|||
{
|
||||
// First try whether the best radius so far can be reached at all
|
||||
RandomAccessIterator m =
|
||||
partition(f, l, boost::bind(greater< FT >(), rad, boost::bind(op.delta(), _1)));
|
||||
partition(f, l, [&rad, &op](const Point& p){ return rad > op.delta()(p); });
|
||||
IP pos = min_max_element(m, l, op.compare_x(), op.compare_y());
|
||||
// extreme points of the two other squares
|
||||
Point q_t =
|
||||
|
|
@ -905,11 +895,11 @@ rectangular_3_center_2_type2(
|
|||
op.place_y_square(op.place_y_square(Q_r_empty, Q_r, *pos.second, r),
|
||||
r,
|
||||
rad);
|
||||
boost::function1<bool,FT> le_rad = boost::bind(greater_equal<FT>(), rad, _1);
|
||||
std::function<bool(const FT&)> le_rad = [&rad](const FT& v){return rad >= v;};
|
||||
RandomAccessIterator b1 =
|
||||
partition(m, l, boost::bind(le_rad, boost::bind(op.distance(), q_t, _1)));
|
||||
partition(m, l, [&le_rad, &op, q_t](const Point& p){ return le_rad(op.distance()(q_t, p)); });
|
||||
RandomAccessIterator b2 =
|
||||
partition(b1, l, boost::bind(le_rad, boost::bind(op.distance(), q_r, _1)));
|
||||
partition(b1, l, [&le_rad, &op, q_r](const Point& p){ return le_rad(op.distance()(q_r, p)); });
|
||||
|
||||
if (b2 != l)
|
||||
return o;
|
||||
|
|
@ -921,8 +911,7 @@ rectangular_3_center_2_type2(
|
|||
while (e - s > 6) {
|
||||
std::ptrdiff_t cutoff = (e - s) / 2;
|
||||
RandomAccessIterator m = s + cutoff - 1;
|
||||
std::nth_element(s, m, e,
|
||||
boost::bind(less<FT>(), boost::bind(op.delta(), _1), boost::bind(op.delta(), _2)));
|
||||
std::nth_element(s, m, e, [&op](const Point& p1, const Point& p2){ return op.delta()(p1) < op.delta()(p2); });
|
||||
|
||||
// step (b)
|
||||
IP pos = min_max_element(m + 1, e, op.compare_x(), op.compare_y());
|
||||
|
|
@ -935,13 +924,12 @@ rectangular_3_center_2_type2(
|
|||
Point q_r = op.place_y_square(q_r_afap, r, op.delta()(*m));
|
||||
|
||||
// check for covering
|
||||
boost::function1<bool,FT>
|
||||
le_delta_m = boost::bind(greater_equal<FT>(), op.delta()(*m), _1);
|
||||
std::function<bool(const FT&)>
|
||||
le_delta_m = [&op, m](const FT& v){ return op.delta()(*m) >= v; };
|
||||
RandomAccessIterator b1 =
|
||||
partition(m + 1, e,
|
||||
boost::bind(le_delta_m, boost::bind(op.distance(), q_t, _1)));
|
||||
partition(m + 1, e, [&le_delta_m, &op, & q_t](const Point& p){ return le_delta_m(op.distance()(q_t, p)); });
|
||||
RandomAccessIterator b2 =
|
||||
partition(b1, e, boost::bind(le_delta_m, boost::bind(op.distance(), q_r, _1)));
|
||||
partition(b1, e, [&le_delta_m, &op, & q_r](const Point& p){ return le_delta_m(op.distance()(q_r, p)); });
|
||||
|
||||
if (b2 != e)
|
||||
s = m;
|
||||
|
|
@ -960,7 +948,7 @@ rectangular_3_center_2_type2(
|
|||
std::ptrdiff_t cutoff = (e - s) / fraction;
|
||||
RandomAccessIterator m = s + cutoff - 1;
|
||||
std::nth_element(s, m, e,
|
||||
boost::bind(less<FT>(), boost::bind(op.delta(), _1), boost::bind(op.delta(), _2)));
|
||||
[&op](const Point& p1, const Point& p2){ return op.delta()(p1) < op.delta()(p2); });
|
||||
|
||||
// step (b)
|
||||
IP pos = min_max_element(m + 1, e, op.compare_x(), op.compare_y());
|
||||
|
|
@ -1007,16 +995,17 @@ rectangular_3_center_2_type2(
|
|||
// partition the range [m+1, e) into ranges
|
||||
// [m+1, b1), [b1, b2), [b2, b3) and [b3, e)
|
||||
// R G cap q_t G cap q_r none
|
||||
boost::function1<bool,FT>
|
||||
le_delta_m = boost::bind(greater_equal<FT>(), op.delta()(*m), _1);
|
||||
std::function<bool(const FT&)>
|
||||
le_delta_m = [&op, m](const FT& v){ return op.delta()(*m) >= v; };
|
||||
RandomAccessIterator b2 =
|
||||
partition(m + 1, e, boost::bind(le_delta_m, boost::bind(op.distance(), q_t, _1)));
|
||||
partition(m + 1, e,
|
||||
[&le_delta_m, &op, &q_t](const Point& p) { return le_delta_m(op.distance()(q_t, p)); });
|
||||
RandomAccessIterator b1 =
|
||||
partition(m + 1, b2,
|
||||
boost::bind(le_delta_m, boost::bind(op.distance(), q_r, _1)));
|
||||
[&le_delta_m, &op, &q_r](const Point& p) { return le_delta_m(op.distance()(q_r, p)); });
|
||||
RandomAccessIterator b3 =
|
||||
partition(b2, e, boost::bind(le_delta_m, boost::bind(op.distance(), q_r, _1)));
|
||||
|
||||
partition(b2, e,
|
||||
[&le_delta_m, &op, &q_r](const Point& p) { return le_delta_m(op.distance()(q_r, p)); });
|
||||
|
||||
// step (c)
|
||||
if (b3 != e ||
|
||||
|
|
@ -1100,9 +1089,8 @@ rectangular_3_center_2_type2(
|
|||
// step 1
|
||||
RandomAccessIterator s_m = s_b + (s_e - s_b - 1) / 2;
|
||||
std::nth_element(s_b, s_m, s_e,
|
||||
boost::bind(less<FT>(),
|
||||
boost::bind(op.delta(), _1),
|
||||
boost::bind(op.delta(), _2)));
|
||||
[&op](const Point& p1, const Point& p2)
|
||||
{ return op.delta()(p1) < op.delta()(p2); });
|
||||
|
||||
// step 2 (as above)
|
||||
Point q_t_m = q_t_afap;
|
||||
|
|
@ -1138,14 +1126,18 @@ CGAL_3CENTER_REPEAT_CHECK:
|
|||
// partition the range [s_b+1, e) into ranges
|
||||
// [s_b+1, b1), [b1, b2), [b2, b3) and [b3, e)
|
||||
// R G cap q_t G cap q_r none
|
||||
boost::function1<bool,FT>
|
||||
le_delta_sb = boost::bind(greater_equal<FT>(), op.delta()(*s_b), _1);
|
||||
b2 = partition(s_b + 1, e, boost::bind(le_delta_sb,
|
||||
boost::bind(op.distance(), q_t, _1)));
|
||||
b1 = partition(s_b + 1, b2, boost::bind(le_delta_sb,
|
||||
boost::bind(op.distance(), q_r, _1)));
|
||||
std::function<bool(const FT&)>
|
||||
le_delta_sb = [&op, s_b](const FT& v){ return op.delta()(*s_b) >= v;} ;
|
||||
|
||||
b2 = partition(s_b + 1, e,
|
||||
[&le_delta_sb, &op, &q_t](const Point& p)
|
||||
{ return le_delta_sb(op.distance()(q_t, p)); });
|
||||
b1 = partition(s_b + 1, b2,
|
||||
[&le_delta_sb, &op, &q_r](const Point& p)
|
||||
{ return le_delta_sb(op.distance()(q_r, p)); });
|
||||
b3 = partition(b2, e,
|
||||
boost::bind(le_delta_sb, boost::bind(op.distance(), q_r, _1)));
|
||||
[&le_delta_sb, &op, &q_r](const Point& p)
|
||||
{ return le_delta_sb(op.distance()(q_r, p)); });
|
||||
|
||||
if (b3 != e ||
|
||||
(!Q_t_empty && op.compute_x_distance(q_t, Q_t) > op.delta()(*s_b)) ||
|
||||
|
|
@ -1183,7 +1175,7 @@ CGAL_3CENTER_REPEAT_CHECK:
|
|||
std::vector< Point > tmppts(f, l);
|
||||
RandomAccessIterator ii =
|
||||
partition(tmppts.begin(), tmppts.end(),
|
||||
boost::bind(le_delta_sb, boost::bind(op.delta(), _1)));
|
||||
[&le_delta_sb, &op](const FT& v){ return le_delta_sb(op.delta()(v)); });
|
||||
IP tmppos = min_max_element(ii, tmppts.end(),
|
||||
op.compare_x(), op.compare_y());
|
||||
)
|
||||
|
|
@ -1228,12 +1220,8 @@ CGAL_3CENTER_REPEAT_CHECK:
|
|||
// we have to take the next smaller radius
|
||||
RandomAccessIterator next =
|
||||
max_element_if(s, s_b,
|
||||
boost::bind(less<FT>(),
|
||||
boost::bind(op.delta(), _1),
|
||||
boost::bind(op.delta(), _2)),
|
||||
boost::bind(not_equal_to<FT>(),
|
||||
op.delta()(*s_b),
|
||||
boost::bind(op.delta(), _1)));
|
||||
[&op](const Point& p1, const Point& p2){ return op.delta()(p1) < op.delta()(p2); },
|
||||
[&op, s_b](const Point& p){ return op.delta()(*s_b) != op.delta()(p); });
|
||||
rho_max = op.delta()(*s_b);
|
||||
q_t_at_rho_max = q_t, q_r_at_rho_max = q_r;
|
||||
CGAL_optimisation_assertion(op.delta()(*next) < op.delta()(*s_b));
|
||||
|
|
@ -1243,14 +1231,14 @@ CGAL_3CENTER_REPEAT_CHECK:
|
|||
q_r = op.place_y_square(q_r_afap, r, op.delta()(*next));
|
||||
|
||||
// again check for covering
|
||||
boost::function1<bool,FT>
|
||||
le_delta_next = boost::bind(greater_equal<FT>(), op.delta()(*next), _1);
|
||||
std::function<bool(const FT&)>
|
||||
le_delta_next = [&op, next](const FT& v){ return op.delta()(*next) >= v; };
|
||||
b2 = partition(s_b, e,
|
||||
boost::bind(le_delta_next, boost::bind(op.distance(), q_t, _1)));
|
||||
[&op, &le_delta_next, &q_t](const Point& p){ return le_delta_next( op.distance()(q_t,p) ); });
|
||||
b1 = partition(s_b, b2,
|
||||
boost::bind(le_delta_next, boost::bind(op.distance(), q_r, _1)));
|
||||
[&op, &le_delta_next, &q_r](const Point& p){ return le_delta_next( op.distance()(q_r,p) ); });
|
||||
b3 = partition(b2, e,
|
||||
boost::bind(le_delta_next, boost::bind(op.distance(), q_r, _1)));
|
||||
[&op, &le_delta_next, &q_r](const Point& p){ return le_delta_next( op.distance()(q_r,p) ); });
|
||||
|
||||
if (b3 != e ||
|
||||
(!Q_t_empty && op.compute_x_distance(q_t, Q_t) > op.delta()(*next)) ||
|
||||
|
|
@ -1304,7 +1292,7 @@ CGAL_3CENTER_REPEAT_CHECK:
|
|||
Point q_t_afap = op.place_x_square(Q_t_empty, Q_t, r);
|
||||
Point q_r_afap = op.place_y_square(Q_r_empty, Q_r, r);
|
||||
if (s != e) {
|
||||
sort(s, e, boost::bind(less<FT>(), boost::bind(op.delta(), _1), boost::bind(op.delta(), _2)));
|
||||
sort(s, e, [&op](const Point& p1, const Point& p2){ return op.delta()(p1) < op.delta()(p2);});
|
||||
rho_max = op.delta()(*--t);
|
||||
} else
|
||||
rho_max = rho_min;
|
||||
|
|
@ -1347,16 +1335,16 @@ CGAL_3CENTER_REPEAT_CHECK:
|
|||
q_r = op.place_y_square(q_r_afap, r, try_rho);
|
||||
|
||||
// check for covering
|
||||
boost::function1<bool,FT>
|
||||
greater_rho_max = boost::bind(less<FT>(), try_rho, _1);
|
||||
std::function<bool(const FT&)>
|
||||
greater_rho_max = [&try_rho](const FT& v){ return try_rho < v; };
|
||||
if ((!Q_t_empty && op.compute_x_distance(q_t, Q_t) > try_rho) ||
|
||||
(!Q_r_empty && op.compute_y_distance(q_r, Q_r) > try_rho) ||
|
||||
e != find_if(
|
||||
t + 1,
|
||||
e,
|
||||
boost::bind(logical_and<bool>(),
|
||||
boost::bind(greater_rho_max, boost::bind(op.distance(), q_t, _1)),
|
||||
boost::bind(greater_rho_max, boost::bind(op.distance(), q_r, _1)))))
|
||||
[&greater_rho_max, &q_t, &q_r, &op](const Point& p)
|
||||
{ return greater_rho_max(op.distance()(q_t,p)) &&
|
||||
greater_rho_max(op.distance()(q_r,p)); }))
|
||||
{
|
||||
rho_min = try_rho;
|
||||
q_t_q_r_cover_at_rho_min = 0;
|
||||
|
|
@ -1393,17 +1381,16 @@ CGAL_3CENTER_REPEAT_CHECK:
|
|||
CGAL_optimisation_assertion(rho_min >= 0);
|
||||
FT rad_2 = q_t_q_r_cover_at_rho_min;
|
||||
if (s_at_rho_min != e_at_rho_min) {
|
||||
boost::function1<FT,Point>
|
||||
mydist = boost::bind(Min<FT>(),
|
||||
boost::bind(op.distance(), q_t_at_rho_min, _1),
|
||||
boost::bind(op.distance(), q_r_at_rho_min, _1));
|
||||
std::function<FT(const Point&)>
|
||||
mydist = [&q_t_at_rho_min, &q_r_at_rho_min, &op](const Point& p)
|
||||
{ return Min<FT>()( op.distance()(q_t_at_rho_min, p),
|
||||
op.distance()(q_r_at_rho_min, p)); };
|
||||
rad_2 =
|
||||
max BOOST_PREVENT_MACRO_SUBSTITUTION (
|
||||
rad_2,
|
||||
mydist(*max_element(s_at_rho_min, e_at_rho_min,
|
||||
boost::bind(less< FT >(),
|
||||
boost::bind(mydist, _1),
|
||||
boost::bind(mydist, _2)))));
|
||||
[&mydist](const Point& p1, const Point& p2)
|
||||
{ return mydist(p1) < mydist(p2); })));
|
||||
}
|
||||
CGAL_optimisation_assertion(rad_2 == 0 || rad_2 > rho_min);
|
||||
|
||||
|
|
|
|||
|
|
@ -316,7 +316,6 @@ rectangular_p_center_2_matrix_search(
|
|||
const Traits& t)
|
||||
{
|
||||
typedef typename Traits::FT FT;
|
||||
using std::minus;
|
||||
|
||||
return rectangular_p_center_2_matrix_search(
|
||||
f,
|
||||
|
|
@ -325,7 +324,9 @@ rectangular_p_center_2_matrix_search(
|
|||
r,
|
||||
pf,
|
||||
t,
|
||||
boost::bind(Max<FT>(), 0, boost::bind(minus<FT>(), _1, _2)));
|
||||
std::function<FT(const FT&, const FT&)>(
|
||||
[](const FT& a, const FT& b) { return Max<FT>()(0, std::minus<FT>()(a,b)); }
|
||||
));
|
||||
|
||||
} // Pcenter_matrix_search( ... )
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue