diff --git a/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h b/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h index 474c6754ac9..b36714258cf 100644 --- a/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h @@ -192,26 +192,42 @@ jet_smooth_point_set( Point_set_processing_3::internal::Callback_wrapper callback_wrapper (callback, nb_points); + std::vector smoothed (points.size()); + + typedef boost::zip_iterator + ::iterator> > Zip_iterator; + CGAL::for_each - (points, - [&](value_type vt) + (CGAL::make_range (boost::make_zip_iterator (boost::make_tuple (points.begin(), smoothed.begin())), + boost::make_zip_iterator (boost::make_tuple (points.end(), smoothed.end()))), + [&](const typename Zip_iterator::reference& t) { if (callback_wrapper.interrupted()) return false; - put (point_map, vt, - CGAL::internal::jet_smooth_point - (get (point_map, vt), neighbor_query, - k, - neighbor_radius, - degree_fitting, - degree_monge)); + get<1>(t) = CGAL::internal::jet_smooth_point + (get (point_map, get<0>(t)), neighbor_query, + k, + neighbor_radius, + degree_fitting, + degree_monge); ++ callback_wrapper.advancement(); return true; }); callback_wrapper.join(); + + // Finally, update points + CGAL::for_each + (CGAL::make_range (boost::make_zip_iterator (boost::make_tuple (points.begin(), smoothed.begin())), + boost::make_zip_iterator (boost::make_tuple (points.end(), smoothed.end()))), + [&](const typename Zip_iterator::reference& t) + { + put (point_map, get<0>(t), get<1>(t)); + return true; + }); }