From 7f3772a50bce514f3ab88112b37504568fe49077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 13 Jul 2016 12:53:22 +0200 Subject: [PATCH 1/6] replace the usage of raw pointer as property map It was deprecated in boost 1.55 http://www.boost.org/users/history/version_1_55_0.html --- .../Cone_spanners_2/dijkstra_theta.cpp | 3 +- .../Periodic_2_Delaunay_triangulation_2.h | 15 +++-- .../grid_simplify_indices.cpp | 5 +- .../jet_pointer_as_property_map.cpp | 4 +- Property_map/include/CGAL/property_map.h | 65 +++++++++++++++++-- .../include/CGAL/Segment_Delaunay_graph_2.h | 10 +-- .../sp_sort_using_property_map_3.cpp | 17 ++--- .../Constrained_Delaunay_triangulation_2.h | 13 ++-- .../include/CGAL/Delaunay_triangulation_2.h | 13 ++-- .../include/CGAL/Regular_triangulation_2.h | 13 ++-- .../CGAL/Triangulation_2/insert_constraints.h | 8 ++- .../include/CGAL/Delaunay_triangulation_3.h | 17 +++-- .../include/CGAL/Regular_triangulation_3.h | 17 +++-- .../include/CGAL/Triangulation_hierarchy_3.h | 14 ++-- 14 files changed, 149 insertions(+), 65 deletions(-) diff --git a/Cone_spanners_2/examples/Cone_spanners_2/dijkstra_theta.cpp b/Cone_spanners_2/examples/Cone_spanners_2/dijkstra_theta.cpp index 05dea7029d5..8594f3751af 100644 --- a/Cone_spanners_2/examples/Cone_spanners_2/dijkstra_theta.cpp +++ b/Cone_spanners_2/examples/Cone_spanners_2/dijkstra_theta.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -89,7 +90,7 @@ int main(int argc, char ** argv) boost::dijkstra_shortest_paths(g, v0, boost::weight_map(get(&Edge_property::euclidean_length, g)). - distance_map(&distances[0]) ); + distance_map(CGAL::make_property_map(distances)) ); std::cout << "distances are:" << std::endl; for (unsigned int i=0; i < n; ++i) { diff --git a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_Delaunay_triangulation_2.h b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_Delaunay_triangulation_2.h index d678dc0d88f..ef93464775a 100644 --- a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_Delaunay_triangulation_2.h +++ b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_Delaunay_triangulation_2.h @@ -266,10 +266,10 @@ private: { if (first == last) return 0; - std::vector indices; + std::vector indices; std::vector points; std::vector infos; - std::ptrdiff_t index = 0; + std::size_t index = 0; for (InputIterator it = first; it != last; ++it) { Tuple_or_pair value = *it; @@ -278,7 +278,8 @@ private: indices.push_back(index++); } - typedef Spatial_sort_traits_adapter_2 Search_traits; + typedef typename Pointer_property_map::type Pmap; + typedef Spatial_sort_traits_adapter_2 Search_traits; size_type n = number_of_vertices(); @@ -287,7 +288,7 @@ private: if (n != 0) is_large_point_set = false; std::set dummy_points; - typename std::vector::iterator pbegin = indices.begin(); + typename std::vector::iterator pbegin = indices.begin(); if (is_large_point_set) { @@ -320,14 +321,16 @@ private: CGAL_assertion(is_1_cover()); // Insert the points - spatial_sort(indices.begin(), indices.end(), Search_traits(&(points[0]), geom_traits())); + spatial_sort(indices.begin(), + indices.end(), + Search_traits(make_property_map(points), geom_traits())); Face_handle f; Locate_type lt; int li; Face_handle hint; - for (typename std::vector::const_iterator it = pbegin, end = indices.end(); + for (typename std::vector::const_iterator it = pbegin, end = indices.end(); it != end; ++it) { f = locate(points[*it], lt, li, f); diff --git a/Point_set_processing_3/examples/Point_set_processing_3/grid_simplify_indices.cpp b/Point_set_processing_3/examples/Point_set_processing_3/grid_simplify_indices.cpp index 5f72af062c5..c376956d38c 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/grid_simplify_indices.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/grid_simplify_indices.cpp @@ -33,7 +33,10 @@ int main(int argc, char*argv[]) // simplification by clustering using erase-remove idiom double cell_size = 0.05; std::vector::iterator end; - end = CGAL::grid_simplify_point_set(indices.begin(), indices.end(), &(points[0]),cell_size); + end = CGAL::grid_simplify_point_set(indices.begin(), + indices.end(), + CGAL::make_property_map(points), + cell_size); std::size_t k = end - indices.begin(); diff --git a/Point_set_processing_3/test/Point_set_processing_3/jet_pointer_as_property_map.cpp b/Point_set_processing_3/test/Point_set_processing_3/jet_pointer_as_property_map.cpp index ad9b93a10f2..72250387336 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/jet_pointer_as_property_map.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/jet_pointer_as_property_map.cpp @@ -37,8 +37,8 @@ int main() CGAL::jet_estimate_normals(indices.begin(), indices.end(), - &(points[0]), - &(normals[0]), + CGAL::make_property_map(points), + CGAL::make_property_map(normals), 12); diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index 25d52278d5e..93b933d28a7 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -36,12 +36,6 @@ namespace CGAL { -// VC++ does not consider put and get for plain pointers -// when identifying the best match for overloads - -using ::put; -using ::get; - /// \cond SKIP_DOXYGEN @@ -294,6 +288,65 @@ struct Property_map_to_unary_function{ } }; +/// \ingroup PkgProperty_map +/// Utility class providing shortcuts to property maps based on raw pointers +template +struct Pointer_property_map{ + typedef boost::iterator_property_map< T*, + boost::typed_identity_property_map, + T, + T&> type; ///< mutable `LvaluePropertyMap` + typedef boost::iterator_property_map< const T*, + boost::typed_identity_property_map, + T, + const T&> const_type; ///< non-mutable `LvaluePropertyMap` +}; + +/// \ingroup PkgProperty_map +/// Starting from boost 1.55, the use of raw pointers as property maps has been deprecated. +/// This function is a shortcut to the recommanded replacement: +/// `boost::make_iterator_property_map(, boost::typed_identity_property_map())` +/// Note that the property map is a mutable `LvaluePropertyMap` with `std::size_t` as key. +template +inline +typename Pointer_property_map::type +make_property_map(T* pointer) +{ + return typename Pointer_property_map::type(pointer); +} + +/// \ingroup PkgProperty_map +/// equivalent to `make_property_map(&v[0])` +/// Note that `v` must not be modified while using the property map created +template +inline +typename Pointer_property_map::type +make_property_map(std::vector& v) +{ + return make_property_map(&v[0]); +} + +/// \ingroup PkgProperty_map +/// Non-mutable version +template +inline +typename Pointer_property_map::const_type +make_property_map(const T* pointer) +{ + return typename Pointer_property_map::const_type(pointer); +} + +/// \ingroup PkgProperty_map +/// equivalent to `make_property_map(&v[0])` +/// Note that `v` must not be modified while using the property map created +template +inline +typename Pointer_property_map::const_type +make_property_map(const std::vector& v) +{ + return make_property_map(&v[0]); +} + } // namespace CGAL #endif // CGAL_POINT_SET_PROPERTY_MAP_H diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2.h index 2a3400b9227..39d88af72ee 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2.h @@ -582,18 +582,20 @@ public: IndicesIterator indices_first, IndicesIterator indices_beyond ) { - typedef std::vector Vertex_indices; + typedef std::vector Vertex_indices; typedef std::vector Vertices; Vertex_indices vertex_indices; vertex_indices.resize(points.size()); - std::copy(boost::counting_iterator(0), - boost::counting_iterator(points.size()), + std::copy(boost::counting_iterator(0), + boost::counting_iterator(points.size()), std::back_inserter(vertex_indices)); size_type n = this->number_of_vertices(); - Spatial_sort_traits_adapter_2 sort_traits(&(points[0])); + Spatial_sort_traits_adapter_2::const_type > + sort_traits(make_property_map(points)); spatial_sort(vertex_indices.begin(), vertex_indices.end(), sort_traits); diff --git a/Spatial_sorting/examples/Spatial_sorting/sp_sort_using_property_map_3.cpp b/Spatial_sorting/examples/Spatial_sorting/sp_sort_using_property_map_3.cpp index ab48feafc9f..fdda1a6daae 100644 --- a/Spatial_sorting/examples/Spatial_sorting/sp_sort_using_property_map_3.cpp +++ b/Spatial_sorting/examples/Spatial_sorting/sp_sort_using_property_map_3.cpp @@ -6,9 +6,8 @@ typedef CGAL::Simple_cartesian Kernel; typedef Kernel::Point_3 Point_3; -//using a pointer as a special property map type -typedef - CGAL::Spatial_sort_traits_adapter_3 Search_traits_3; +typedef CGAL::Spatial_sort_traits_adapter_3::type > Search_traits_3; int main() { @@ -20,16 +19,18 @@ int main() points.push_back(Point_3(744,4154,43)); points.push_back(Point_3(74,44,1)); - std::vector indices; + std::vector indices; indices.reserve(points.size()); - std::copy(boost::counting_iterator(0), - boost::counting_iterator(points.size()), + std::copy(boost::counting_iterator(0), + boost::counting_iterator(points.size()), std::back_inserter(indices)); - CGAL::spatial_sort( indices.begin(),indices.end(),Search_traits_3(&(points[0])) ); + CGAL::spatial_sort( indices.begin(), + indices.end(), + Search_traits_3(CGAL::make_property_map(points)) ); - for (std::vector::iterator it=indices.begin();it!=indices.end();++it) + for (std::vector::iterator it=indices.begin();it!=indices.end();++it) std::cout << points[*it] << "\n"; std::cout << "done" << std::endl; diff --git a/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h index 0c4a1a054e9..167393eb1a0 100644 --- a/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h @@ -305,10 +305,10 @@ private: std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last) { size_type n = this->number_of_vertices(); - std::vector indices; + std::vector indices; std::vector points; std::vector infos; - std::ptrdiff_t index=0; + std::size_t index=0; for (InputIterator it=first;it!=last;++it){ Tuple_or_pair value=*it; points.push_back( top_get_first(value) ); @@ -316,13 +316,16 @@ private: indices.push_back(index++); } - typedef Spatial_sort_traits_adapter_2 Search_traits; + typedef typename Pointer_property_map::type Pmap; + typedef Spatial_sort_traits_adapter_2 Search_traits; - spatial_sort(indices.begin(),indices.end(),Search_traits(&(points[0]),geom_traits())); + spatial_sort(indices.begin(), + indices.end(), + Search_traits(make_property_map(points),geom_traits())); Vertex_handle v_hint; Face_handle hint; - for (typename std::vector::const_iterator + for (typename std::vector::const_iterator it = indices.begin(), end = indices.end(); it != end; ++it){ v_hint = insert(points[*it], hint); diff --git a/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h b/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h index 7d1500df023..7acc27d7731 100644 --- a/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h @@ -336,10 +336,10 @@ private: std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last) { size_type n = this->number_of_vertices(); - std::vector indices; + std::vector indices; std::vector points; std::vector infos; - std::ptrdiff_t index=0; + std::size_t index=0; for (InputIterator it=first;it!=last;++it){ Tuple_or_pair value=*it; points.push_back( top_get_first(value) ); @@ -347,13 +347,16 @@ private: indices.push_back(index++); } - typedef Spatial_sort_traits_adapter_2 Search_traits; + typedef typename Pointer_property_map::type Pmap; + typedef Spatial_sort_traits_adapter_2 Search_traits; - spatial_sort(indices.begin(),indices.end(),Search_traits(&(points[0]),geom_traits())); + spatial_sort(indices.begin(), + indices.end(), + Search_traits(make_property_map(points),geom_traits())); Vertex_handle v_hint; Face_handle hint; - for (typename std::vector::const_iterator + for (typename std::vector::const_iterator it = indices.begin(), end = indices.end(); it != end; ++it){ v_hint = insert(points[*it], hint); diff --git a/Triangulation_2/include/CGAL/Regular_triangulation_2.h b/Triangulation_2/include/CGAL/Regular_triangulation_2.h index a002e01f8e0..4ecaeb9115e 100644 --- a/Triangulation_2/include/CGAL/Regular_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Regular_triangulation_2.h @@ -401,10 +401,10 @@ private: std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last) { size_type n = number_of_vertices(); - std::vector indices; + std::vector indices; std::vector points; std::vector infos; - std::ptrdiff_t index=0; + std::size_t index=0; for (InputIterator it=first;it!=last;++it){ Tuple_or_pair pair = *it; points.push_back( top_get_first(pair) ); @@ -412,13 +412,16 @@ private: indices.push_back(index++); } - typedef Spatial_sort_traits_adapter_2 Search_traits; + typedef typename Pointer_property_map::type Pmap; + typedef Spatial_sort_traits_adapter_2 Search_traits; - spatial_sort(indices.begin(),indices.end(),Search_traits(&(points[0]),geom_traits())); + spatial_sort(indices.begin(), + indices.end(), + Search_traits(make_property_map(points),geom_traits())); Face_handle hint; Vertex_handle v_hint; - for (typename std::vector::const_iterator + for (typename std::vector::const_iterator it = indices.begin(), end = indices.end(); it != end; ++it) { diff --git a/Triangulation_2/include/CGAL/Triangulation_2/insert_constraints.h b/Triangulation_2/include/CGAL/Triangulation_2/insert_constraints.h index 2f1f61461bf..7d766fb9927 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2/insert_constraints.h +++ b/Triangulation_2/include/CGAL/Triangulation_2/insert_constraints.h @@ -22,6 +22,7 @@ #define CGAL_INTERNAL_TRIANGULATION_2_IMSERT_CONSTRAINTS_H #include +#include #include #include #include @@ -41,7 +42,7 @@ namespace CGAL { typedef typename T::Face_handle Face_handle; typedef typename T::Geom_traits Geom_traits; typedef typename T::Point Point; - typedef std::vector Vertex_indices; + typedef std::vector Vertex_indices; typedef std::vector Vertices; Vertex_indices vertex_indices; @@ -52,7 +53,10 @@ namespace CGAL { std::back_inserter(vertex_indices)); typename T::size_type n = t.number_of_vertices(); - CGAL::Spatial_sort_traits_adapter_2 sort_traits(&(points[0]),t.geom_traits()); + CGAL::Spatial_sort_traits_adapter_2< + Geom_traits, + typename Pointer_property_map::const_type > + sort_traits(make_property_map(points),t.geom_traits()); spatial_sort(vertex_indices.begin(), vertex_indices.end(), sort_traits); diff --git a/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h b/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h index 2630dbd46fe..16de02cc883 100644 --- a/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h @@ -429,10 +429,10 @@ private: std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last) { size_type n = number_of_vertices(); - std::vector indices; + std::vector indices; std::vector points; std::vector infos; - std::ptrdiff_t index=0; + std::size_t index=0; for (InputIterator it=first;it!=last;++it){ Tuple_or_pair value=*it; points.push_back( top_get_first(value) ); @@ -440,9 +440,12 @@ private: indices.push_back(index++); } - typedef Spatial_sort_traits_adapter_3 Search_traits; + typedef typename Pointer_property_map::type Pmap; + typedef Spatial_sort_traits_adapter_3 Search_traits; - spatial_sort(indices.begin(),indices.end(),Search_traits(&(points[0]),geom_traits())); + spatial_sort(indices.begin(), + indices.end(), + Search_traits(make_property_map(points),geom_traits())); #ifdef CGAL_LINKED_WITH_TBB if(this->is_parallel()){ @@ -482,7 +485,7 @@ private: #endif { Vertex_handle hint; - for (typename std::vector::const_iterator + for (typename std::vector::const_iterator it = indices.begin(), end = indices.end(); it != end; ++it) { hint = insert(points[*it], hint); @@ -999,7 +1002,7 @@ protected: DT & m_dt; const std::vector & m_points; const std::vector & m_infos; - const std::vector & m_indices; + const std::vector & m_indices; tbb::enumerable_thread_specific & m_tls_hint; public: @@ -1007,7 +1010,7 @@ protected: Insert_point_with_info(DT & dt, const std::vector & points, const std::vector & infos, - const std::vector & indices, + const std::vector & indices, tbb::enumerable_thread_specific & tls_hint) : m_dt(dt), m_points(points), m_infos(infos), m_indices(indices), m_tls_hint(tls_hint) diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_3.h index 6060008e1a3..5e274bfe757 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_3.h @@ -376,10 +376,10 @@ namespace CGAL { std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last) { size_type n = number_of_vertices(); - std::vector indices; + std::vector indices; std::vector points; std::vector infos; - std::ptrdiff_t index=0; + std::size_t index=0; for (InputIterator it=first;it!=last;++it){ Tuple_or_pair pair = *it; points.push_back( top_get_first(pair) ); @@ -387,9 +387,12 @@ namespace CGAL { indices.push_back(index++); } - typedef Spatial_sort_traits_adapter_3 Search_traits; + typedef typename Pointer_property_map::type Pmap; + typedef Spatial_sort_traits_adapter_3 Search_traits; - spatial_sort( indices.begin(),indices.end(),Search_traits(&(points[0]),geom_traits()) ); + spatial_sort( indices.begin(), + indices.end(), + Search_traits(make_property_map(points),geom_traits()) ); #ifdef CGAL_LINKED_WITH_TBB if (this->is_parallel()) { @@ -438,7 +441,7 @@ namespace CGAL { #endif // CGAL_LINKED_WITH_TBB { Cell_handle hint; - for (typename std::vector::const_iterator + for (typename std::vector::const_iterator it = indices.begin(), end = indices.end(); it != end; ++it) { @@ -1307,7 +1310,7 @@ namespace CGAL { RT & m_rt; const std::vector & m_points; const std::vector & m_infos; - const std::vector & m_indices; + const std::vector & m_indices; tbb::enumerable_thread_specific & m_tls_hint; public: @@ -1315,7 +1318,7 @@ namespace CGAL { Insert_point_with_info(RT & rt, const std::vector & points, const std::vector & infos, - const std::vector & indices, + const std::vector & indices, tbb::enumerable_thread_specific & tls_hint) : m_rt(rt), m_points(points), m_infos(infos), m_indices(indices), m_tls_hint(tls_hint) diff --git a/Triangulation_3/include/CGAL/Triangulation_hierarchy_3.h b/Triangulation_3/include/CGAL/Triangulation_hierarchy_3.h index 81ba0df3afe..c96760a167f 100644 --- a/Triangulation_3/include/CGAL/Triangulation_hierarchy_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_hierarchy_3.h @@ -193,27 +193,29 @@ private: std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last) { size_type n = number_of_vertices(); - std::vector indices; + std::vector indices; std::vector points; std::vector infos; - std::ptrdiff_t index=0; + std::size_t index=0; for (InputIterator it=first;it!=last;++it){ Tuple_or_pair value=*it; points.push_back( top_get_first(value) ); infos.push_back ( top_get_second(value) ); indices.push_back(index++); } + typedef typename Pointer_property_map::type Pmap; + typedef Spatial_sort_traits_adapter_3 Search_traits; - typedef Spatial_sort_traits_adapter_3 Search_traits; - - spatial_sort(indices.begin(),indices.end(),Search_traits(&(points[0]),geom_traits())); + spatial_sort(indices.begin(), + indices.end(), + Search_traits(make_property_map(points),geom_traits())); // hints[i] is the vertex of the previously inserted point in level i. // Thanks to spatial sort, they are better hints than what the hierarchy // would give us. Vertex_handle hints[maxlevel]; - for (typename std::vector::const_iterator + for (typename std::vector::const_iterator it = indices.begin(), end = indices.end(); it != end; ++it) { From d9fb49f2dd26fed0ea2b8aa0e7a82d047cef2698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 13 Jul 2016 13:12:20 +0200 Subject: [PATCH 2/6] fix all calls to get() free function for property maps the return type of get is reference --- .../include/CGAL/IO/write_off_points.h | 10 +++------ .../include/CGAL/IO/write_ply_points.h | 5 ++--- .../include/CGAL/IO/write_xyz_points.h | 18 +++------------- .../include/CGAL/Point_with_normal_3.h | 7 +++---- .../include/CGAL/bilateral_smooth_point_set.h | 8 +++---- .../include/CGAL/compute_average_spacing.h | 5 +---- .../include/CGAL/grid_simplify_point_set.h | 5 +++-- .../CGAL/hierarchy_simplify_point_set.h | 7 +++---- .../include/CGAL/jet_estimate_normals.h | 5 +---- .../include/CGAL/jet_smooth_point_set.h | 7 ++----- .../include/CGAL/mst_orient_normals.h | 21 ++++++++++--------- .../include/CGAL/pca_estimate_normals.h | 5 +---- .../include/CGAL/radial_orient_normals.h | 8 ++++--- .../include/CGAL/remove_outliers.h | 5 +---- .../wlop_simplify_and_regularize_point_set.h | 6 +----- 15 files changed, 43 insertions(+), 79 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/IO/write_off_points.h b/Point_set_processing_3/include/CGAL/IO/write_off_points.h index f2c98e339db..3de732cf870 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_off_points.h @@ -81,9 +81,8 @@ write_off_points_and_normals( // Write positions + normals for(ForwardIterator it = first; it != beyond; it++) { - Point p = get(point_pmap, *it); - Vector n = get(normal_pmap, *it); - stream << p << " " << n << std::endl; + stream << get(point_pmap, *it) << " " + << get(normal_pmap, *it) << std::endl; } return ! stream.fail(); @@ -180,10 +179,7 @@ write_off_points( // Write positions for(ForwardIterator it = first; it != beyond; it++) - { - Point p = get(point_pmap, *it); - stream << p << std::endl; - } + stream << get(point_pmap, *it) << std::endl; return ! stream.fail(); } diff --git a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h index 07531c3baf1..01cc8dd529e 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h @@ -89,9 +89,8 @@ write_ply_points_and_normals( // Write positions + normals for(ForwardIterator it = first; it != beyond; it++) { - Point p = get(point_pmap, *it); - Vector n = get(normal_pmap, *it); - stream << p << " " << n << std::endl; + stream << get(point_pmap, *it) << " " + << get(normal_pmap, *it) << std::endl; } return ! stream.fail(); diff --git a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h index 25c6501151d..4134d8b88e0 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h @@ -61,10 +61,6 @@ write_xyz_points_and_normals( NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3. const Kernel& /*kernel*/) ///< geometric traits. { - // basic geometric types - typedef typename Kernel::Point_3 Point; - typedef typename Kernel::Vector_3 Vector; - CGAL_point_set_processing_precondition(first != beyond); if(!stream) @@ -76,9 +72,8 @@ write_xyz_points_and_normals( // Write positions + normals for(ForwardIterator it = first; it != beyond; it++) { - Point p = get(point_pmap, *it); - Vector n = get(normal_pmap, *it); - stream << p << " " << n << std::endl; + stream << get(point_pmap, *it) << " " + << get(normal_pmap, *it) << std::endl; } return ! stream.fail(); @@ -157,9 +152,6 @@ write_xyz_points( PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3. const Kernel& /*kernel*/) ///< geometric traits. { - // basic geometric types - typedef typename Kernel::Point_3 Point; - CGAL_point_set_processing_precondition(first != beyond); if(!stream) @@ -170,11 +162,7 @@ write_xyz_points( // Write positions for(ForwardIterator it = first; it != beyond; it++) - { - Point p = get(point_pmap, *it); - - stream << p << std::endl; - } + stream << get(point_pmap, *it) << std::endl; return ! stream.fail(); } diff --git a/Point_set_processing_3/include/CGAL/Point_with_normal_3.h b/Point_set_processing_3/include/CGAL/Point_with_normal_3.h index 84c1f226ee6..6738847c662 100644 --- a/Point_set_processing_3/include/CGAL/Point_with_normal_3.h +++ b/Point_set_processing_3/include/CGAL/Point_with_normal_3.h @@ -138,17 +138,16 @@ struct Normal_of_point_with_normal_pmap typedef Point_with_normal key_type; typedef Vector value_type; - typedef value_type& reference; + typedef const value_type& reference; typedef boost::lvalue_property_map_tag category; /// Access a property map element - reference operator[](key_type& pwn) const { return pwn.normal(); } + value_type& operator[](key_type& pwn) const { return pwn.normal(); } typedef Normal_of_point_with_normal_pmap Self; /// \name Put/get free functions /// @{ - friend const value_type& get(const Self&,const key_type& k) {return k.normal();} - friend reference get(const Self&, key_type& k) {return k.normal();} + friend reference get(const Self&,const key_type& k) {return k.normal();} friend void put(const Self&,key_type& k, const value_type& v) {k.normal()=v;} /// @};} }; diff --git a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h index 4acb2b2df4e..6e5487e1611 100644 --- a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h @@ -413,10 +413,8 @@ bilateral_smooth_point_set( const Kernel& /*kernel*/) ///< geometric traits. { // basic geometric types - typedef typename Kernel::Point_3 Point; typedef typename CGAL::Point_with_normal_3 Pwn; typedef typename std::vector > Pwns; - typedef typename Kernel::Vector_3 Vector; typedef typename Kernel::FT FT; CGAL_point_set_processing_precondition(first != beyond); @@ -433,8 +431,8 @@ bilateral_smooth_point_set( Pwns pwns; for(ForwardIterator it = first; it != beyond; ++it) { - const Point& p = get(point_pmap, *it); - const Vector& n = get(normal_pmap, *it); + typename boost::property_traits::reference p = get(point_pmap, *it); + typename boost::property_traits::reference n = get(normal_pmap, *it); CGAL_point_set_processing_precondition(n.squared_length() > 1e-10); pwns.push_back(Pwn(p, n)); @@ -564,7 +562,7 @@ bilateral_smooth_point_set( ForwardIterator it = first; for(unsigned int i = 0 ; it != beyond; ++it, ++i) { - const Point& p = get(point_pmap, *it); + typename boost::property_traits::reference p = get(point_pmap, *it); sum_move_error += CGAL::squared_distance(p, update_pwns[i].position()); put (point_pmap, *it, update_pwns[i].position()); put (normal_pmap, *it, update_pwns[i].normal()); diff --git a/Point_set_processing_3/include/CGAL/compute_average_spacing.h b/Point_set_processing_3/include/CGAL/compute_average_spacing.h index 4c12020ed9d..b5505745c12 100644 --- a/Point_set_processing_3/include/CGAL/compute_average_spacing.h +++ b/Point_set_processing_3/include/CGAL/compute_average_spacing.h @@ -177,10 +177,7 @@ compute_average_spacing( // Note: We have to convert each input iterator to Point_3. std::vector kd_tree_points; for(InputIterator it = first; it != beyond; it++) - { - Point point = get(point_pmap, *it); - kd_tree_points.push_back(point); - } + kd_tree_points.push_back(get(point_pmap, *it)); Tree tree(kd_tree_points.begin(), kd_tree_points.end()); // iterate over input points, compute and output normal diff --git a/Point_set_processing_3/include/CGAL/grid_simplify_point_set.h b/Point_set_processing_3/include/CGAL/grid_simplify_point_set.h index 30ed00cfa04..5b2f4b8aeda 100644 --- a/Point_set_processing_3/include/CGAL/grid_simplify_point_set.h +++ b/Point_set_processing_3/include/CGAL/grid_simplify_point_set.h @@ -63,10 +63,11 @@ public: bool operator() (const Point_3& a, const Point_3& b) const { typedef typename boost::property_traits::value_type Point; + typedef typename boost::property_traits::reference Point_ref; // Round points to multiples of m_epsilon, then compare. - Point a_n = get(point_pmap,a); - Point b_n = get(point_pmap,b); + Point_ref a_n = get(point_pmap,a); + Point_ref b_n = get(point_pmap,b); Point rounded_a(round_epsilon(a_n.x(), m_epsilon), round_epsilon(a_n.y(), m_epsilon), diff --git a/Point_set_processing_3/include/CGAL/hierarchy_simplify_point_set.h b/Point_set_processing_3/include/CGAL/hierarchy_simplify_point_set.h index 1fa42cdcd8b..c2fb82989d4 100644 --- a/Point_set_processing_3/include/CGAL/hierarchy_simplify_point_set.h +++ b/Point_set_processing_3/include/CGAL/hierarchy_simplify_point_set.h @@ -56,7 +56,8 @@ namespace CGAL { unsigned int nb_pts = 0; while(begin != end) { - const Point& point = get(point_pmap, *begin); + typename boost::property_traits::reference point = + get(point_pmap, *begin); x += point.x (); y += point.y (); z += point.z (); ++ nb_pts; ++ begin; @@ -77,15 +78,13 @@ namespace CGAL { { typedef typename std::list::iterator Iterator; typedef typename K::FT FT; - typedef typename K::Point_3 Point; FT dist_min = (std::numeric_limits::max)(); typename std::list::iterator point_min; for (Iterator it = cluster.begin (); it != cluster.end (); ++ it) { - const Point& point = get(point_pmap, *it); - FT dist = CGAL::squared_distance (point, centroid); + FT dist = CGAL::squared_distance (get(point_pmap, *it), centroid); if (dist < dist_min) { dist_min = dist; diff --git a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h index 20a6ce2f7d3..7cb52397809 100644 --- a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h @@ -211,10 +211,7 @@ jet_estimate_normals( // Note: We have to convert each input iterator to Point_3. std::vector kd_tree_points; for(it = first; it != beyond; it++) - { - Point point = get(point_pmap, *it); - kd_tree_points.push_back(point); - } + kd_tree_points.push_back(get(point_pmap, *it)); Tree tree(kd_tree_points.begin(), kd_tree_points.end()); memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20); 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 8b6c1522ef8..d36acb432ca 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 @@ -205,10 +205,7 @@ jet_smooth_point_set( // Note: We have to convert each input iterator to Point_3. std::vector kd_tree_points; for(it = first; it != beyond; it++) - { - Point point = get(point_pmap, *it); - kd_tree_points.push_back(point); - } + kd_tree_points.push_back(get(point_pmap, *it)); Tree tree(kd_tree_points.begin(), kd_tree_points.end()); // Iterates over input points and mutates them. @@ -237,7 +234,7 @@ jet_smooth_point_set( { for(it = first; it != beyond; it++) { - const Point& p = get(point_pmap, *it); + typename boost::property_traits::reference p = get(point_pmap, *it); put(point_pmap, *it , internal::jet_smooth_point( p,tree,k,degree_fitting,degree_monge) ); diff --git a/Point_set_processing_3/include/CGAL/mst_orient_normals.h b/Point_set_processing_3/include/CGAL/mst_orient_normals.h index 29257067b62..2aad9b1577b 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -149,16 +149,16 @@ struct Propagate_normal_orientation template void operator()(Edge& edge, const MST_graph& mst_graph) { - typedef typename boost::property_traits::value_type Vector; + typedef typename boost::property_traits::reference Vector_ref; typedef typename MST_graph::vertex_descriptor vertex_descriptor; // Gets source normal vertex_descriptor source_vertex = source(edge, mst_graph); - const Vector source_normal = get(mst_graph.m_normal_pmap, *(mst_graph[source_vertex].input_point) ); + Vector_ref source_normal = get(mst_graph.m_normal_pmap, *(mst_graph[source_vertex].input_point) ); const bool source_normal_is_oriented = mst_graph[source_vertex].is_oriented; // Gets target normal vertex_descriptor target_vertex = target(edge, mst_graph); - const Vector& target_normal = get( mst_graph.m_normal_pmap, *(mst_graph[target_vertex].input_point) ); + Vector_ref target_normal = get( mst_graph.m_normal_pmap, *(mst_graph[target_vertex].input_point) ); bool& target_normal_is_oriented = ((MST_graph&)mst_graph)[target_vertex].is_oriented; if ( ! target_normal_is_oriented ) { @@ -208,6 +208,7 @@ mst_find_source( // Input points types typedef typename boost::property_traits::value_type Vector; + typedef typename boost::property_traits::reference Vector_ref; // Precondition: at least one element in the container CGAL_point_set_processing_precondition(first != beyond); @@ -225,7 +226,7 @@ mst_find_source( } // Orients its normal towards +Z axis - const Vector& normal = get(normal_pmap,*top_point); + Vector_ref normal = get(normal_pmap,*top_point); const Vector Z(0, 0, 1); if (Z * normal < 0) { CGAL_TRACE(" Flip top point normal\n"); @@ -268,8 +269,8 @@ create_riemannian_graph( const Kernel& /*kernel*/) ///< geometric traits. { // Input points types - typedef typename boost::property_traits::value_type Point; - typedef typename boost::property_traits::value_type Vector; + typedef typename boost::property_traits::reference Point_ref; + typedef typename boost::property_traits::reference Vector_ref; // Types for K nearest neighbors search structure typedef Point_vertex_handle_3 Point_vertex_handle_3; @@ -302,7 +303,7 @@ create_riemannian_graph( for (ForwardIterator it = first; it != beyond; it++) { - Point point = get(point_pmap, *it); + Point_ref point = get(point_pmap, *it); Point_vertex_handle_3 point_wrapper(point.x(), point.y(), point.z(), it); kd_tree_points.push_back(point_wrapper); } @@ -334,14 +335,14 @@ create_riemannian_graph( for (ForwardIterator it = first; it != beyond; it++) { std::size_t it_index = get(index_pmap,it); - Vector it_normal_vector = get(normal_pmap,*it); + Vector_ref it_normal_vector = get(normal_pmap,*it); // Gather set of (k+1) neighboring points. // Perform k+1 queries (as in point set, the query point is // output first). Search may be aborted if k is greater // than number of input points. - Point point = get(point_pmap, *it); + Point_ref point = get(point_pmap, *it); Point_vertex_handle_3 point_wrapper(point.x(), point.y(), point.z(), it); Neighbor_search search(*tree, point_wrapper, k+1); Search_iterator search_iterator = search.begin(); @@ -366,7 +367,7 @@ create_riemannian_graph( // Computes edge weight = 1 - | normal1 * normal2 | // where normal1 and normal2 are the normal at the edge extremities. - Vector neighbor_normal_vector = get(normal_pmap,*neighbor); + Vector_ref neighbor_normal_vector = get(normal_pmap,*neighbor); double weight = 1.0 - std::abs(it_normal_vector * neighbor_normal_vector); if (weight < 0) weight = 0; // safety check diff --git a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h index 9375b4005c0..6ee08b28b20 100644 --- a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h @@ -198,10 +198,7 @@ pca_estimate_normals( // Note: We have to convert each input iterator to Point_3. std::vector kd_tree_points; for(it = first; it != beyond; it++) - { - Point point = get(point_pmap, *it); - kd_tree_points.push_back(point); - } + kd_tree_points.push_back(get(point_pmap, *it)); Tree tree(kd_tree_points.begin(), kd_tree_points.end()); memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20); diff --git a/Point_set_processing_3/include/CGAL/radial_orient_normals.h b/Point_set_processing_3/include/CGAL/radial_orient_normals.h index f821148482a..ebd1dd02d74 100644 --- a/Point_set_processing_3/include/CGAL/radial_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/radial_orient_normals.h @@ -71,6 +71,8 @@ radial_orient_normals( typedef typename std::iterator_traits::value_type Enriched_point; typedef typename boost::property_traits::value_type Point; typedef typename boost::property_traits::value_type Vector; + typedef typename boost::property_traits::reference Point_ref; + typedef typename boost::property_traits::reference Vector_ref; typedef typename Kernel::FT FT; // Precondition: at least one element in the container. @@ -83,7 +85,7 @@ radial_orient_normals( int nb_points = 0; for (ForwardIterator it = first; it != beyond; it++) { - Point point = get(point_pmap, *it); + Point_ref point = get(point_pmap, *it); sum = sum + (point - CGAL::ORIGIN); nb_points++; } @@ -94,13 +96,13 @@ radial_orient_normals( std::deque oriented_points, unoriented_points; for (ForwardIterator it = first; it != beyond; it++) { - Point point = get(point_pmap, *it); + Point_ref point = get(point_pmap, *it); // Radial vector towards exterior of the point set Vector vec1 = point - barycenter; // Point's normal - Vector vec2 = get(normal_pmap, *it); + Vector_ref vec2 = get(normal_pmap, *it); // -> -> // Orients vec2 parallel to vec1 diff --git a/Point_set_processing_3/include/CGAL/remove_outliers.h b/Point_set_processing_3/include/CGAL/remove_outliers.h index d286e10579c..20ad80173ee 100644 --- a/Point_set_processing_3/include/CGAL/remove_outliers.h +++ b/Point_set_processing_3/include/CGAL/remove_outliers.h @@ -162,10 +162,7 @@ remove_outliers( // Note: We have to convert each input iterator to Point_3. std::vector kd_tree_points; for(it = first; it != beyond; it++) - { - Point point = get(point_pmap, *it); - kd_tree_points.push_back(point); - } + kd_tree_points.push_back( get(point_pmap, *it) ); Tree tree(kd_tree_points.begin(), kd_tree_points.end()); // iterate over input points and add them to multimap sorted by distance to k diff --git a/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h b/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h index 4c6c3585c81..fd46a3996b5 100644 --- a/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h +++ b/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h @@ -512,11 +512,7 @@ wlop_simplify_and_regularize_point_set( // Initiate a KD-tree search for original points std::vector original_treeElements; for (it = first_original_iter, i=0 ; it != beyond ; ++it, ++i) - { - const Point& p0 = get(point_pmap, *it); - - original_treeElements.push_back(Kd_tree_element(p0, i)); - } + original_treeElements.push_back( Kd_tree_element(get(point_pmap, *it), i) ); Kd_Tree original_kd_tree(original_treeElements.begin(), original_treeElements.end()); From efa3e3b654ad02c11b341a315bcf8d3690480f04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 15 Jul 2016 11:54:10 +0200 Subject: [PATCH 3/6] avoid relying on reference --- .../include/CGAL/grid_simplify_point_set.h | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/grid_simplify_point_set.h b/Point_set_processing_3/include/CGAL/grid_simplify_point_set.h index 5b2f4b8aeda..2102b8bfb74 100644 --- a/Point_set_processing_3/include/CGAL/grid_simplify_point_set.h +++ b/Point_set_processing_3/include/CGAL/grid_simplify_point_set.h @@ -51,7 +51,7 @@ private: double m_epsilon; PointPMap point_pmap; - + typedef typename boost::property_traits::value_type Point; public: Less_epsilon_points_3 (double epsilon, PointPMap p_pmap) @@ -62,21 +62,9 @@ public: bool operator() (const Point_3& a, const Point_3& b) const { - typedef typename boost::property_traits::value_type Point; - typedef typename boost::property_traits::reference Point_ref; - // Round points to multiples of m_epsilon, then compare. - Point_ref a_n = get(point_pmap,a); - Point_ref b_n = get(point_pmap,b); - - Point rounded_a(round_epsilon(a_n.x(), m_epsilon), - round_epsilon(a_n.y(), m_epsilon), - round_epsilon(a_n.z(), m_epsilon)); - Point rounded_b(round_epsilon(b_n.x(), m_epsilon), - round_epsilon(b_n.y(), m_epsilon), - round_epsilon(b_n.z(), m_epsilon)); - - return (rounded_a < rounded_b); + return round_epsilon( get(point_pmap,a), m_epsilon ) < + round_epsilon( get(point_pmap,b), m_epsilon ); } private: @@ -86,6 +74,13 @@ private: { return std::floor(value/epsilon) * epsilon; } + + static inline Point round_epsilon(const Point& p, double epsilon) + { + return Point( round_epsilon(p.x(), epsilon), + round_epsilon(p.y(), epsilon), + round_epsilon(p.z(), epsilon) ); + } }; From 1c5204d0aaa2124a0afd10750a7a4ad5c4b15004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 15 Jul 2016 11:52:59 +0200 Subject: [PATCH 4/6] work around incorrect key-type in property maps --- Property_map/include/CGAL/property_map.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index 93b933d28a7..2c591bb5a87 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -281,8 +281,9 @@ struct Property_map_to_unary_function{ : map(m) {} + template result_type - operator()(const argument_type& a) const + operator()(KeyType a) const { return get(map,a); } From 5638160b85ef4cda63a039dc062d60f45025dd18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 18 Jul 2016 09:42:27 +0200 Subject: [PATCH 5/6] force using a const-ref --- Property_map/include/CGAL/property_map.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index 2c591bb5a87..a16bc2628c8 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -283,7 +283,7 @@ struct Property_map_to_unary_function{ template result_type - operator()(KeyType a) const + operator()(const KeyType& a) const { return get(map,a); } From 3e9796e1ed7262031ca06286cb1f2715e985e1a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 18 Jul 2016 10:26:23 +0200 Subject: [PATCH 6/6] remove unused types --- Point_set_processing_3/include/CGAL/IO/write_off_points.h | 7 ------- Point_set_processing_3/include/CGAL/IO/write_ply_points.h | 4 ---- 2 files changed, 11 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/IO/write_off_points.h b/Point_set_processing_3/include/CGAL/IO/write_off_points.h index 3de732cf870..ad25e86ead6 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_off_points.h @@ -61,10 +61,6 @@ write_off_points_and_normals( NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3. const Kernel& /*kernel*/) ///< geometric traits. { - // basic geometric types - typedef typename Kernel::Point_3 Point; - typedef typename Kernel::Vector_3 Vector; - CGAL_point_set_processing_precondition(first != beyond); if(!stream) @@ -161,9 +157,6 @@ write_off_points( PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3. const Kernel& ) ///< geometric traits. { - // basic geometric types - typedef typename Kernel::Point_3 Point; - CGAL_point_set_processing_precondition(first != beyond); if(!stream) diff --git a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h index 01cc8dd529e..e85bdf72867 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h @@ -60,10 +60,6 @@ write_ply_points_and_normals( NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3. const Kernel& /*kernel*/) ///< geometric traits. { - // basic geometric types - typedef typename Kernel::Point_3 Point; - typedef typename Kernel::Vector_3 Vector; - CGAL_point_set_processing_precondition(first != beyond); if(!stream)