mirror of https://github.com/CGAL/cgal
Removed obsolete make_curve_2
This commit is contained in:
parent
5690fb11e0
commit
5192d00a68
|
|
@ -597,59 +597,6 @@ public:
|
|||
Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object() const
|
||||
{ return Construct_x_monotone_curve_2(*this); }
|
||||
|
||||
/*! This should be removed!
|
||||
* First, the optional that specify whether to duplicate the first point does not belong here;
|
||||
* that is, if the user wants to duplicate, she should do it before calling this function.
|
||||
* Secondlt, the functor Construct_curve_2 should be used instead!
|
||||
* Obtain a Curve_2 object from a range of points.
|
||||
*/
|
||||
template <typename PointRange>
|
||||
static Curve_2 make_curve_2(const PointRange& points,
|
||||
bool duplicate_first_point = false)
|
||||
{
|
||||
if (duplicate_first_point)
|
||||
return make_curve_2_impl(boost::range::join(points,
|
||||
make_single(*points.begin())));
|
||||
else
|
||||
return make_curve_2_impl(points);
|
||||
}
|
||||
|
||||
// This should be removed (see above)!
|
||||
template <typename PointRange>
|
||||
static Curve_2 make_curve_2_impl(const PointRange& points)
|
||||
{
|
||||
#if 0
|
||||
auto ctr = construct_curve_2_object();
|
||||
return ctr(points);
|
||||
#else
|
||||
using Point_iterator = typename PointRange::const_iterator;
|
||||
using Zip_iterator =
|
||||
boost::zip_iterator<boost::tuple<Point_iterator, Point_iterator> >;
|
||||
|
||||
Point_iterator begin = points.begin();
|
||||
Point_iterator begin_plus_1 = begin;
|
||||
++begin_plus_1;
|
||||
Point_iterator end = points.end();
|
||||
Point_iterator end_minus_1 = end;
|
||||
--end_minus_1;
|
||||
|
||||
auto point_pair_to_segment = [](const typename Zip_iterator::reference& t)
|
||||
-> typename Segment_traits_2::Curve_2
|
||||
{
|
||||
return typename Segment_traits_2::Curve_2(boost::get<0>(t),
|
||||
boost::get<1>(t));
|
||||
};
|
||||
|
||||
return Curve_2
|
||||
(boost::make_transform_iterator
|
||||
(boost::make_zip_iterator(boost::make_tuple(begin, begin_plus_1)),
|
||||
point_pair_to_segment),
|
||||
boost::make_transform_iterator
|
||||
(boost::make_zip_iterator(boost::make_tuple(end_minus_1, end)),
|
||||
point_pair_to_segment));
|
||||
#endif
|
||||
}
|
||||
|
||||
/*! Deprecated!
|
||||
* Obtain the segment traits.
|
||||
* \return the segment traits.
|
||||
|
|
|
|||
Loading…
Reference in New Issue