mirror of https://github.com/CGAL/cgal
replace last bind in Bounding_volume
This commit is contained in:
parent
3f10219bf4
commit
bf325bfc60
|
|
@ -258,9 +258,6 @@ private:
|
|||
typedef QP_access_by_index
|
||||
<typename std::vector<Point>::const_iterator, int> Point_by_index;
|
||||
|
||||
typedef boost::binder2nd< std::divides<int> >
|
||||
Divide;
|
||||
|
||||
typedef std::vector<int> Index_vector;
|
||||
|
||||
typedef std::vector<NT> NT_vector;
|
||||
|
|
@ -272,7 +269,7 @@ public:
|
|||
|
||||
typedef CGAL::Join_input_iterator_1<
|
||||
Basic_variable_index_iterator,
|
||||
CGAL::Unary_compose_1<Point_by_index,Divide> >
|
||||
std::function<Point(int)> >
|
||||
Support_point_iterator;
|
||||
|
||||
|
||||
|
|
@ -331,9 +328,7 @@ public:
|
|||
"support_points_begin: not enough points");
|
||||
return Support_point_iterator(
|
||||
solver->basic_original_variable_indices_begin(),
|
||||
CGAL::compose1_1(
|
||||
Point_by_index( points.begin()),
|
||||
boost::bind2nd( std::divides<int>(), 2)));
|
||||
[this](int i){ return Point_by_index(this->points.begin())(i/2); });
|
||||
}
|
||||
|
||||
Support_point_iterator
|
||||
|
|
@ -342,9 +337,7 @@ public:
|
|||
"support_points_begin: not enough points");
|
||||
return Support_point_iterator(
|
||||
solver->basic_original_variable_indices_end(),
|
||||
CGAL::compose1_1(
|
||||
Point_by_index( points.begin()),
|
||||
boost::bind2nd( std::divides<int>(), 2)));
|
||||
[this](int i){ return Point_by_index(this->points.begin())(i/2); });
|
||||
}
|
||||
|
||||
int number_of_inner_support_points() const { return static_cast<int>(inner_indices.size());}
|
||||
|
|
@ -592,9 +585,7 @@ private:
|
|||
bool
|
||||
check_dimension( std::size_t offset = 0)
|
||||
{ return ( std::find_if( points.begin()+offset, points.end(),
|
||||
CGAL::compose1_1( boost::bind2nd(
|
||||
std::not_equal_to<int>(), d),
|
||||
tco.access_dimension_d_object()))
|
||||
[this](const Point& p){ return this->d != this->tco.access_dimension_d_object()(p); })
|
||||
== points.end()); }
|
||||
|
||||
// compute smallest enclosing annulus
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(push)
|
||||
|
|
@ -235,14 +234,16 @@ struct Staircases : public Loc_domain< Traits_ > {
|
|||
do {
|
||||
brstc.push_back(*i++);
|
||||
i = find_if(i, ysort.end(),
|
||||
boost::bind(this->traits.less_x_2_object(), brstc.back(), _1));
|
||||
[this](const Point_2& p)
|
||||
{ return this->traits.less_x_2_object()(this->brstc.back(), p);});
|
||||
} while (i != ysort.end());
|
||||
// top-left
|
||||
Riterator j = ysort.rbegin();
|
||||
do {
|
||||
tlstc.push_back(*j++);
|
||||
j = find_if(j, ysort.rend(),
|
||||
boost::bind(this->traits.less_x_2_object(), _1, tlstc.back()));
|
||||
[this](const Point_2& p)
|
||||
{ return this->traits.less_x_2_object()(p, this->tlstc.back());});
|
||||
} while (j != ysort.rend());
|
||||
|
||||
// build left-bottom and right-top staircases
|
||||
|
|
@ -252,14 +253,16 @@ struct Staircases : public Loc_domain< Traits_ > {
|
|||
do {
|
||||
lbstc.push_back(*i++);
|
||||
i = find_if(i, xsort.end(),
|
||||
boost::bind(this->traits.less_y_2_object(), _1, lbstc.back()));
|
||||
[this](const Point_2& p)
|
||||
{ return this->traits.less_y_2_object()(p, this->lbstc.back());});
|
||||
} while (i != xsort.end());
|
||||
// right-top
|
||||
j = xsort.rbegin();
|
||||
do {
|
||||
rtstc.push_back(*j++);
|
||||
j = find_if(j, xsort.rend(),
|
||||
boost::bind(this->traits.less_y_2_object(), rtstc.back(), _1));
|
||||
[this](const Point_2& p)
|
||||
{ return this->traits.less_y_2_object()(this->rtstc.back(), p);});
|
||||
} while (j != xsort.rend());
|
||||
} // Staircases(b, e, t)
|
||||
|
||||
|
|
@ -300,16 +303,20 @@ struct Staircases : public Loc_domain< Traits_ > {
|
|||
min_element_if(
|
||||
this->pts.begin(), this->pts.end(),
|
||||
this->traits.less_x_2_object(),
|
||||
boost::bind(std::logical_and< bool >(),
|
||||
boost::bind(this->traits.less_x_2_object(), p, _1),
|
||||
boost::bind(this->traits.less_y_2_object(), p, _1)));
|
||||
[&p, this](const Point_2& pt)
|
||||
{
|
||||
return this->traits.less_x_2_object()(p, pt) &&
|
||||
this->traits.less_y_2_object()(p, pt);
|
||||
});
|
||||
Citerator j =
|
||||
max_element_if(
|
||||
this->pts.begin(), this->pts.end(),
|
||||
this->traits.less_x_2_object(),
|
||||
boost::bind(std::logical_and< bool >(),
|
||||
boost::bind(this->traits.less_x_2_object(), _1, q),
|
||||
boost::bind(this->traits.less_y_2_object(), q, _1)));
|
||||
[&q, this](const Point_2& pt)
|
||||
{
|
||||
return this->traits.less_x_2_object()(pt, q) &&
|
||||
this->traits.less_y_2_object()(q, pt);
|
||||
});
|
||||
return Intervall(i == this->pts.end() ? this->maxx : *i,
|
||||
j == this->pts.end() ? this->minx : *j);
|
||||
} // top_intervall()
|
||||
|
|
@ -326,16 +333,20 @@ struct Staircases : public Loc_domain< Traits_ > {
|
|||
min_element_if(
|
||||
this->pts.begin(), this->pts.end(),
|
||||
this->traits.less_x_2_object(),
|
||||
boost::bind(std::logical_and< bool >(),
|
||||
boost::bind(this->traits.less_x_2_object(), p, _1),
|
||||
boost::bind(this->traits.less_y_2_object(), _1, p)));
|
||||
[&p, this](const Point_2& pt)
|
||||
{
|
||||
return this->traits.less_x_2_object()(p, pt) &&
|
||||
this->traits.less_y_2_object()(pt, p);
|
||||
});
|
||||
Citerator j =
|
||||
max_element_if(
|
||||
this->pts.begin(), this->pts.end(),
|
||||
this->traits.less_x_2_object(),
|
||||
boost::bind(std::logical_and< bool >(),
|
||||
boost::bind(this->traits.less_x_2_object(), _1, q),
|
||||
boost::bind(this->traits.less_y_2_object(), _1, q)));
|
||||
[&q, this](const Point_2& pt)
|
||||
{
|
||||
return this->traits.less_x_2_object()(pt, q) &&
|
||||
this->traits.less_y_2_object()(pt, q);
|
||||
});
|
||||
return Intervall(i == this->pts.end() ? this->maxx : *i,
|
||||
j == this->pts.end() ? this->minx : *j);
|
||||
} // bottom_intervall()
|
||||
|
|
@ -352,16 +363,20 @@ struct Staircases : public Loc_domain< Traits_ > {
|
|||
min_element_if(
|
||||
this->pts.begin(), this->pts.end(),
|
||||
this->traits.less_y_2_object(),
|
||||
boost::bind(std::logical_and< bool >(),
|
||||
boost::bind(this->traits.less_x_2_object(), _1, p),
|
||||
boost::bind(this->traits.less_y_2_object(), p, _1)));
|
||||
[&p, this](const Point_2& pt)
|
||||
{
|
||||
return this->traits.less_x_2_object()(pt, p) &&
|
||||
this->traits.less_y_2_object()(p, pt);
|
||||
});
|
||||
Citerator j =
|
||||
max_element_if(
|
||||
this->pts.begin(), this->pts.end(),
|
||||
this->traits.less_y_2_object(),
|
||||
boost::bind(std::logical_and< bool >(),
|
||||
boost::bind(this->traits.less_x_2_object(), _1, q),
|
||||
boost::bind(this->traits.less_y_2_object(), _1, q)));
|
||||
[&q, this](const Point_2& pt)
|
||||
{
|
||||
return this->traits.less_x_2_object()(pt, q) &&
|
||||
this->traits.less_y_2_object()(pt, q);
|
||||
});
|
||||
return Intervall(i == this->pts.end() ? this->maxy : *i,
|
||||
j == this->pts.end() ? this->miny : *j);
|
||||
} // left_intervall()
|
||||
|
|
@ -378,16 +393,20 @@ struct Staircases : public Loc_domain< Traits_ > {
|
|||
min_element_if(
|
||||
this->pts.begin(), this->pts.end(),
|
||||
this->traits.less_y_2_object(),
|
||||
boost::bind(std::logical_and< bool >(),
|
||||
boost::bind(this->traits.less_x_2_object(), p, _1),
|
||||
boost::bind(this->traits.less_y_2_object(), p, _1)));
|
||||
[&p, this](const Point_2& pt)
|
||||
{
|
||||
return this->traits.less_x_2_object()(p, pt) &&
|
||||
this->traits.less_y_2_object()(p, pt);
|
||||
});
|
||||
Citerator j =
|
||||
max_element_if(
|
||||
this->pts.begin(), this->pts.end(),
|
||||
this->traits.less_y_2_object(),
|
||||
boost::bind(std::logical_and< bool >(),
|
||||
boost::bind(this->traits.less_x_2_object(), q, _1),
|
||||
boost::bind(this->traits.less_y_2_object(), _1, q)));
|
||||
[&q, this](const Point_2& pt)
|
||||
{
|
||||
return this->traits.less_x_2_object()(q, pt) &&
|
||||
this->traits.less_y_2_object()(pt, q);
|
||||
});
|
||||
return Intervall(i == this->pts.end() ? this->maxy : *i,
|
||||
j == this->pts.end() ? this->miny : *j);
|
||||
} // right_intervall()
|
||||
|
|
@ -487,6 +506,7 @@ two_cover_points(
|
|||
using std::less;
|
||||
|
||||
typedef typename Traits::FT FT;
|
||||
typedef typename Traits::Point_2 Point_2;
|
||||
typename Traits::Infinity_distance_2 dist =
|
||||
d.traits.infinity_distance_2_object();
|
||||
typename Traits::Signed_infinity_distance_2 sdist =
|
||||
|
|
@ -504,11 +524,8 @@ two_cover_points(
|
|||
if (d.end() ==
|
||||
find_if(d.begin(),
|
||||
d.end(),
|
||||
boost::bind(less<FT>(),
|
||||
d.r,
|
||||
boost::bind(Min<FT>(),
|
||||
boost::bind(dist, d[0], _1),
|
||||
boost::bind(dist, d[2], _1)))))
|
||||
[&dist,&d](const Point_2& p)
|
||||
{ return d.r < Min<FT>()(dist(d[0], p), dist(d[2],p)); }))
|
||||
{
|
||||
*o++ = d[0];
|
||||
*o++ = d[2];
|
||||
|
|
@ -520,11 +537,8 @@ two_cover_points(
|
|||
if (d.end() ==
|
||||
find_if(d.begin(),
|
||||
d.end(),
|
||||
boost::bind(less<FT>(),
|
||||
d.r,
|
||||
boost::bind(Min<FT>(),
|
||||
boost::bind(dist, d[1], _1),
|
||||
boost::bind(dist, d[3], _1)))))
|
||||
[&dist,&d](const Point_2& p)
|
||||
{ return d.r < Min<FT>()(dist(d[1], p), dist(d[3],p)); }))
|
||||
{
|
||||
*o++ = d[1];
|
||||
*o++ = d[3];
|
||||
|
|
@ -551,7 +565,6 @@ three_cover_points(
|
|||
CGAL_optimisation_precondition(!d.empty());
|
||||
|
||||
// typedefs:
|
||||
typedef typename Traits::FT FT;
|
||||
typedef typename Traits::Point_2 Point_2;
|
||||
typedef typename Loc_domain< Traits >::Iterator Iterator;
|
||||
typename Traits::Infinity_distance_2 dist =
|
||||
|
|
@ -565,7 +578,8 @@ three_cover_points(
|
|||
|
||||
// find first point not covered by the rectangle at d[k]
|
||||
Iterator i = find_if(d.begin(), d.end(),
|
||||
boost::bind(less<FT>(), d.r, boost::bind(dist, corner, _1)));
|
||||
[&d,&dist, &corner](const Point_2& p)
|
||||
{ return d.r < dist(corner, p); });
|
||||
|
||||
// are all points already covered?
|
||||
if (i == d.end()) {
|
||||
|
|
@ -608,12 +622,12 @@ three_cover_points(
|
|||
|
||||
CGAL_optimisation_expensive_assertion(
|
||||
save_end == find_if(d.end(), save_end,
|
||||
boost::bind(less<FT>(), d.r, boost::bind(dist, corner, _1))));
|
||||
[&d, &dist, &corner](const Point_2& p)
|
||||
{ return d.r < dist(corner, p); }));
|
||||
CGAL_optimisation_expensive_assertion(
|
||||
d.end() == find_if(d.begin(), d.end(),
|
||||
boost::bind(std::greater_equal<FT>(),
|
||||
d.r,
|
||||
boost::bind(dist, corner, _1))));
|
||||
[&d,&dist, &corner](const Point_2& p)
|
||||
{ return d.r >= dist(corner, p); }));
|
||||
|
||||
|
||||
two_cover_points(d, o, ok);
|
||||
|
|
@ -702,7 +716,8 @@ four_cover_points(Staircases< Traits >& d, OutputIterator o, bool& ok)
|
|||
|
||||
// find first point not covered by the rectangle at d[k]
|
||||
Iterator i = find_if(d.begin(), d.end(),
|
||||
boost::bind(less<FT>(), d.r, boost::bind(dist, corner, _1)));
|
||||
[&d,&dist,&corner](const Point_2& p)
|
||||
{ return d.r < dist(corner, p); });
|
||||
|
||||
// are all points already covered?
|
||||
if (i == d.end()) {
|
||||
|
|
@ -745,12 +760,12 @@ four_cover_points(Staircases< Traits >& d, OutputIterator o, bool& ok)
|
|||
|
||||
CGAL_optimisation_expensive_assertion(
|
||||
save_end == find_if(d.end(), save_end,
|
||||
boost::bind(less<FT>(), d.r, boost::bind(dist, corner, _1))));
|
||||
[&d,&dist,&corner](const Point_2& p)
|
||||
{ return d.r < dist(corner, p); }));
|
||||
CGAL_optimisation_expensive_assertion(
|
||||
d.end() == find_if(d.begin(), d.end(),
|
||||
boost::bind(std::greater_equal<FT>(),
|
||||
d.r,
|
||||
boost::bind(dist, corner, _1))));
|
||||
[&d,&dist,&corner](const Point_2& p)
|
||||
{ return d.r >= dist(corner, p); }));
|
||||
|
||||
|
||||
three_cover_points(d, o, ok);
|
||||
|
|
|
|||
Loading…
Reference in New Issue