From 6b5d40387f294c612d191d2531a4e0e3e66b757a Mon Sep 17 00:00:00 2001 From: iyaz Date: Mon, 22 Apr 2013 02:59:37 +0300 Subject: [PATCH 01/63] New version of pmaps, and an example of required changes in related code (for now just read_xyz_points.h and write_xyz_points.h are changed as a representative) --- .../include/CGAL/IO/read_xyz_points.h | 21 ++- .../include/CGAL/IO/write_xyz_points.h | 23 +++- .../include/CGAL/property_map.h | 128 +++++++++++++++++- 3 files changed, 167 insertions(+), 5 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h index 7b3b0bf2b1d..c0615ed0bf0 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h @@ -108,8 +108,13 @@ read_xyz_points_and_normals( Point point(x,y,z); Vector normal(nx,ny,nz); Enriched_point pwn; + #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS put(point_pmap, &pwn, point); // point_pmap[&pwn] = point put(normal_pmap, &pwn, normal); // normal_pmap[&pwn] = normal + #else + put(point_pmap, pwn, point); // point_pmap[pwn] = point + put(normal_pmap, pwn, normal); // normal_pmap[pwn] = normal + #endif *output++ = pwn; } // ...or reads only position... @@ -118,8 +123,13 @@ read_xyz_points_and_normals( Point point(x,y,z); Vector normal = CGAL::NULL_VECTOR; Enriched_point pwn; + #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS put(point_pmap, &pwn, point); // point_pmap[&pwn] = point put(normal_pmap, &pwn, normal); // normal_pmap[&pwn] = normal + #else + put(point_pmap, pwn, point); // point_pmap[pwn] = point + put(normal_pmap, pwn, normal); // normal_pmap[pwn] = normal + #endif *output++ = pwn; } // ...or skips number of points on first line (optional) @@ -175,7 +185,11 @@ read_xyz_points_and_normals( return read_xyz_points_and_normals( stream, output, +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(output), +#else + Typed_identity_property_map_by_reference::type>(), +#endif normal_pmap); } /// @endcond @@ -251,7 +265,12 @@ read_xyz_points( return read_xyz_points( stream, output, - make_dereference_property_map(output)); +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + make_dereference_property_map(output) +#else + Typed_identity_property_map_by_reference::type>() +#endif + ); } /// @endcond 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 6e1bb1885c3..9e2b3934fda 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 @@ -83,8 +83,13 @@ write_xyz_points_and_normals( // Write positions + normals for(ForwardIterator it = first; it != beyond; it++) { + #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point p = get(point_pmap, it); Vector n = get(normal_pmap, it); + #else + Point p = get(point_pmap, *it); + Vector n = get(normal_pmap, *it); + #endif stream << p << " " << n << std::endl; } @@ -131,7 +136,11 @@ write_xyz_points_and_normals( return write_xyz_points_and_normals( stream, first, beyond, - make_dereference_property_map(first), +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + make_dereference_property_map(output), +#else + Typed_identity_property_map_by_reference::type>(), +#endif normal_pmap); } /// @endcond @@ -177,7 +186,12 @@ write_xyz_points( // Write positions for(ForwardIterator it = first; it != beyond; it++) { + #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point p = get(point_pmap, it); + #else + Point p = get(point_pmap, *it); + #endif + stream << p << std::endl; } @@ -219,7 +233,12 @@ write_xyz_points( return write_xyz_points( stream, first, beyond, - make_dereference_property_map(first)); +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + make_dereference_property_map(output) +#else + Typed_identity_property_map_by_reference::type>() +#endif + ); } /// @endcond diff --git a/Point_set_processing_3/include/CGAL/property_map.h b/Point_set_processing_3/include/CGAL/property_map.h index dd49bdc08dd..57dcf5d37aa 100644 --- a/Point_set_processing_3/include/CGAL/property_map.h +++ b/Point_set_processing_3/include/CGAL/property_map.h @@ -34,6 +34,27 @@ namespace CGAL { +/// An alternative to boost::put_get_helper for: +/// - return type of `get` function is `const Reference` +/// - `key` is passed by reference in `put` function +template +struct put_get_helper_pass_key_by_reference { }; + +template +inline const Reference +get(const put_get_helper_pass_key_by_reference& pa, const K& k) +{ + Reference v = static_cast(pa)[k]; + return v; +} + +template +inline void +put(const put_get_helper_pass_key_by_reference& pa, K& k, const V& v) +{ + static_cast(pa)[k] = v; +} + /// \ingroup PkgProperty_map /// Property map that converts a `T*` pointer (or in general an iterator @@ -67,9 +88,23 @@ make_dereference_property_map(Iter) return Dereference_property_map::type>(); } +template +struct Typed_identity_property_map_by_reference + : put_get_helper_pass_key_by_reference > +{ + typedef T key_type; + typedef T value_type; + typedef T& reference; + typedef boost::lvalue_property_map_tag category; + + reference operator[](key_type& v) const { return reference(v); } + const reference operator[](const key_type& v) const { return reference(v); } +}; + + //========================================================================= - +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS /// \ingroup PkgProperty_map /// Property map that accesses the first item of a `std::pair`. /// \tparam Pair Instance of `std::pair`. @@ -92,6 +127,34 @@ struct First_of_pair_property_map template reference operator[](Iter pair) const { return reference(pair->first); } }; +#else +/// \ingroup PkgProperty_map +/// Property map that accesses the first item of a `std::pair`. +/// \tparam Pair Instance of `std::pair`. +/// \cgalModels `LvaluePropertyMap` +/// +/// \sa `CGAL::Second_of_pair_property_map` +template +struct First_of_pair_property_map + : put_get_helper_pass_key_by_reference > +{ + typedef Pair key_type; ///< typedef to 'Pair' + typedef typename Pair::first_type value_type; ///< typedef to `Pair::first_type` + typedef value_type& reference; ///< typedef to `value_type&` + typedef boost::lvalue_property_map_tag category; ///< boost::lvalue_property_map_tag + + /// Access a property map element. + /// + /// @tparam pair a key whose first item is accessed + reference operator[](key_type& pair) const { return reference(pair.first); } + + /// Access a property map element. + /// + /// @tparam pair a key whose first item is accessed read-only + const reference operator[](const key_type& pair) const { return reference(pair.first); } +}; +#endif /// Free function to create a `First_of_pair_property_map` property map. /// @@ -104,6 +167,7 @@ make_first_of_pair_property_map(Iter) return First_of_pair_property_map::type>(); } +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS /// \ingroup PkgProperty_map /// /// Property map that accesses the second item of a `std::pair`. @@ -129,7 +193,37 @@ struct Second_of_pair_property_map template reference operator[](Iter pair) const { return reference(pair->second); } }; +#else +/// \ingroup PkgProperty_map +/// +/// Property map that accesses the second item of a `std::pair`. +/// +/// \tparam Pair Instance of `std::pair`. +/// +/// \cgalModels `LvaluePropertyMap` +/// +/// \sa `CGAL::First_of_pair_property_map` +template +struct Second_of_pair_property_map + : put_get_helper_pass_key_by_reference > +{ + typedef Pair key_type; ///< typedef to 'Pair' + typedef typename Pair::second_type value_type; ///< typedef to `Pair::first_type` + typedef value_type& reference; ///< typedef to `value_type&` + typedef boost::lvalue_property_map_tag category; ///< boost::lvalue_property_map_tag + /// Access a property map element. + /// + /// @tparam pair a key whose second item is accessed + reference operator[](key_type& pair) const { return reference(pair.second); } + + /// Access a property map element. + /// + /// @tparam pair a key whose second item is accessed read-only + const reference operator[](const key_type& pair) const { return reference(pair.second); } +}; +#endif /// Free function to create a Second_of_pair_property_map property map. /// /// \relates Second_of_pair_property_map @@ -144,7 +238,7 @@ make_second_of_pair_property_map(Iter) //========================================================================= - +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS /// \ingroup PkgProperty_map /// /// Property map that accesses the Nth item of a `boost::tuple`. @@ -169,6 +263,36 @@ struct Nth_of_tuple_property_map template reference operator[](Iter tuple) const { return (reference) tuple->template get(); } }; +#else +/// \ingroup PkgProperty_map +/// +/// Property map that accesses the Nth item of a `boost::tuple`. +/// +/// \tparam N Index of the item to access. +/// \tparam Tuple Instance of `boost::tuple`. +/// +/// \cgalModels `LvaluePropertyMap` +template +struct Nth_of_tuple_property_map + : put_get_helper_pass_key_by_reference::type&, + Nth_of_tuple_property_map > +{ + typedef Tuple key_type; ///< typedef to 'Tuple' + typedef typename boost::tuples::element::type value_type; ///< typedef to `boost::tuples::element::%type` + typedef value_type& reference; ///< typedef to `value_type&` + typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag` + + /// Access a property map element. + /// + /// @tparam tuple a key whose Nth item is accessed + reference operator[](key_type& tuple) const { return reference(tuple.template get()); } + + /// Access a property map element. + /// + /// @tparam tuple a key whose Nth item is accessed read-only + const reference operator[](const key_type& tuple) const { return reference(tuple.template get()); } +}; +#endif /// Free function to create a Nth_of_tuple_property_map property map. /// From 72a947cda4e60e5bec68aeac20a1f2ad8353a594 Mon Sep 17 00:00:00 2001 From: iyaz Date: Tue, 30 Apr 2013 00:32:46 +0300 Subject: [PATCH 02/63] Changes related to pm inside include (documentation is not updated) --- .../include/CGAL/IO/read_off_points.h | 25 +++- .../include/CGAL/IO/read_xyz_points.h | 6 +- .../include/CGAL/IO/write_off_points.h | 17 ++- .../include/CGAL/IO/write_xyz_points.h | 3 +- .../include/CGAL/Point_with_normal_3.h | 42 ++++++ .../include/CGAL/compute_average_spacing.h | 18 ++- .../include/CGAL/grid_simplify_point_set.h | 14 +- .../CGAL/improved_jet_smooth_point_set.h | 23 +++- .../improved_laplacian_smooth_point_set.h | 20 ++- .../include/CGAL/jet_estimate_normals.h | 25 +++- .../include/CGAL/jet_smooth_point_set.h | 14 ++ .../include/CGAL/mst_orient_normals.h | 49 ++++++- .../include/CGAL/pca_estimate_normals.h | 23 +++- .../include/CGAL/pca_smooth_point_set.h | 14 ++ .../include/CGAL/property_map.h | 127 ++++++++++++------ .../include/CGAL/radial_orient_normals.h | 16 ++- .../include/CGAL/random_simplify_point_set.h | 5 + .../include/CGAL/remove_outliers.h | 17 ++- ...move_outliers_wrt_median_knn_sq_distance.h | 19 ++- 19 files changed, 411 insertions(+), 66 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/IO/read_off_points.h b/Point_set_processing_3/include/CGAL/IO/read_off_points.h index 348cd2de963..087e41807a2 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_off_points.h @@ -125,8 +125,13 @@ read_off_points_and_normals( Point point(x,y,z); Vector normal(nx,ny,nz); Enriched_point pwn; +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS put(point_pmap, &pwn, point); // point_pmap[&pwn] = point put(normal_pmap, &pwn, normal); // normal_pmap[&pwn] = normal +#else + put(point_pmap, pwn, point); // point_pmap[&pwn] = point + put(normal_pmap, pwn, normal); // normal_pmap[&pwn] = normal +#endif *output++ = pwn; pointsRead++; } @@ -136,8 +141,13 @@ read_off_points_and_normals( Point point(x,y,z); Vector normal = CGAL::NULL_VECTOR; Enriched_point pwn; +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS put(point_pmap, &pwn, point); // point_pmap[&pwn] = point put(normal_pmap, &pwn, normal); // normal_pmap[&pwn] = normal +#else + put(point_pmap, pwn, point); // point_pmap[&pwn] = point + put(normal_pmap, pwn, normal); // normal_pmap[&pwn] = normal +#endif *output++ = pwn; pointsRead++; } @@ -187,7 +197,12 @@ read_off_points_and_normals( return read_off_points_and_normals( stream, output, - make_dereference_property_map(output), +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + make_dereference_property_map(first), +#else + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()), +#endif normal_pmap); } /// @endcond @@ -262,7 +277,13 @@ read_off_points( return read_off_points( stream, output, - make_dereference_property_map(output)); +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + make_dereference_property_map(first) +#else + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()) +#endif + ); } /// @endcond diff --git a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h index c0615ed0bf0..5e014b5ec0f 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h @@ -188,7 +188,8 @@ read_xyz_points_and_normals( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(output), #else - Typed_identity_property_map_by_reference::type>(), + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()), #endif normal_pmap); } @@ -268,7 +269,8 @@ read_xyz_points( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(output) #else - Typed_identity_property_map_by_reference::type>() + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()) #endif ); } 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 38f4539c2bc..2e66156fa23 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 @@ -88,8 +88,13 @@ write_off_points_and_normals( // Write positions + normals for(ForwardIterator it = first; it != beyond; it++) { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point p = get(point_pmap, it); Vector n = get(normal_pmap, it); +#else + Point p = get(point_pmap, *it); + Vector n = get(normal_pmap, *it); +#endif stream << p << " " << n << std::endl; } @@ -187,7 +192,11 @@ write_off_points( // Write positions for(ForwardIterator it = first; it != beyond; it++) { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point p = get(point_pmap, it); +#else + Point p = get(point_pmap, *it); +#endif stream << p << std::endl; } @@ -229,7 +238,13 @@ write_off_points( return write_off_points( stream, first, beyond, - make_dereference_property_map(first)); +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + make_dereference_property_map(first) +#else + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()) +#endif + ); } /// @endcond 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 9e2b3934fda..e9fb998122e 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 @@ -236,7 +236,8 @@ write_xyz_points( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(output) #else - Typed_identity_property_map_by_reference::type>() + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()) #endif ); } 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 1037c9b6a78..19a9a5ef024 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 @@ -26,6 +26,8 @@ #include #include +#include + #include #if BOOST_VERSION >= 104000 #include @@ -126,7 +128,46 @@ private: //========================================================================= +#ifndef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +/// Property map that accesses the normal vector from a Point_with_normal_3 object +/// +/// @heading Is Model for the Concepts: +/// Model of boost::LvaluePropertyMap concept. +/// +/// @heading Parameters: +/// @param Gt Geometric traits class. +template +struct Normal_of_point_with_normal_pmap + : put_get_helper_pass_key_by_reference > +{ + typedef Point_with_normal_3 Point_with_normal; ///< Position + normal + typedef typename Gt::Vector_3 Vector; /// normal + + typedef Point_with_normal key_type; + typedef Vector value_type; + typedef value_type& reference; + typedef boost::lvalue_property_map_tag category; + + /// Access a property map element. + reference operator[](key_type& pair) const { return pair.normal(); } + const value_type& operator[](const key_type& pair) const { return pair.normal(); } +}; + +/// Free function to create a Normal_of_point_with_normal_pmap property map. +/// +/// @relates Normal_of_point_with_normal_pmap + +template // Point_with_normal type +Normal_of_point_with_normal_pmap< + typename CGAL::Kernel_traits::Kernel> + make_normal_of_point_with_normal_pmap(Point_with_normal) +{ + return Normal_of_point_with_normal_pmap::Kernel>(); +} + +#else /// Property map that accesses the normal vector from a Point_with_normal_3* pointer /// (or in general an iterator over Point_with_normal_3 elements). /// @@ -169,6 +210,7 @@ make_normal_of_point_with_normal_pmap(Iter) typedef typename CGAL::Kernel_traits::Kernel Kernel; return Normal_of_point_with_normal_pmap(); } +#endif /// \endcond 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 adcc594816b..e536732649f 100644 --- a/Point_set_processing_3/include/CGAL/compute_average_spacing.h +++ b/Point_set_processing_3/include/CGAL/compute_average_spacing.h @@ -140,7 +140,11 @@ compute_average_spacing( std::vector kd_tree_points; for(InputIterator it = first; it != beyond; it++) { + #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point point = get(point_pmap, it); + #else + Point point = get(point_pmap, *it); + #endif kd_tree_points.push_back(point); } Tree tree(kd_tree_points.begin(), kd_tree_points.end()); @@ -151,7 +155,14 @@ compute_average_spacing( unsigned int nb_points = 0; for(InputIterator it = first; it != beyond; it++) { - sum_spacings += internal::compute_average_spacing(get(point_pmap,it),tree,k); + sum_spacings += internal::compute_average_spacing( + + #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + get(point_pmap,it), + #else + get(point_pmap,*it), + #endif + tree,k); nb_points++; } @@ -192,7 +203,12 @@ compute_average_spacing( { return compute_average_spacing( first,beyond, +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), +#else + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()), +#endif k); } /// @endcond 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 cfe8e151f09..493ea02822f 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 @@ -64,8 +64,13 @@ public: typedef typename boost::property_traits::value_type Point; // Round points to multiples of m_epsilon, then compare. - Point a_n = get(point_pmap,&a), - b_n = get(point_pmap,&b); + #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + Point a_n = get(point_pmap,&a); + Point b_n = get(point_pmap,&b); + #else + Point a_n = get(point_pmap,a); + Point b_n = get(point_pmap,b); + #endif Point rounded_a(round_epsilon(a_n.x(), m_epsilon), round_epsilon(a_n.y(), m_epsilon), @@ -213,7 +218,12 @@ grid_simplify_point_set( { return grid_simplify_point_set( first,beyond, +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), +#else + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()), +#endif epsilon); } /// @endcond diff --git a/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h b/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h index 912c6efb750..9eb14fe2e40 100644 --- a/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h @@ -255,15 +255,25 @@ improved_jet_smooth_point_set( std::vector treeElements; for (it = first, i=0 ; it != beyond ; ++it,++i) { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point& p0 = get(point_pmap,it); +#else + Point& p0 = get(point_pmap,*it); +#endif treeElements.push_back(KdTreeElement(p0,i)); } Tree tree(treeElements.begin(), treeElements.end()); std::vector p(nb_points); // positions at step iter_n std::vector b(nb_points); // ... - for(it = first, i=0; it != beyond; it++, ++i) - p[i] = get(point_pmap,it); + for(it = first, i=0; it != beyond; it++, ++i) { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + p[i] = get(point_pmap,it); +#else + p[i] = get(point_pmap,*it); +#endif + } + // loop until convergence for(int iter_n = 0; iter_n < iter_number ; ++iter_n) @@ -273,7 +283,11 @@ improved_jet_smooth_point_set( // Iterates over input points, computes (original) Laplacian smoothing and b[]. for(it = first, i=0; it != beyond; it++, ++i) { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point& p0 = get(point_pmap,it); +#else + Point& p0 = get(point_pmap,*it); +#endif Point np = improved_jet_smoothing_i::jet_smooth_point(p0,tree,kk); b[i] = alpha*(np - p0) + (1-alpha)*(np - p[i]); p[i] = np; @@ -339,7 +353,12 @@ improved_jet_smooth_point_set( { return improved_jet_smooth_point_set( first,beyond, +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), +#else + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()), +#endif k, iter_number, alpha, beta); diff --git a/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h b/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h index 90a6e435804..f5e3169622b 100644 --- a/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h @@ -238,15 +238,24 @@ improved_laplacian_smooth_point_set( std::vector treeElements; for (it = first, i=0 ; it != beyond ; ++it,++i) { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point& p0 = get(point_pmap,it); +#else + Point& p0 = get(point_pmap,*it); +#endif treeElements.push_back(KdTreeElement(p0,i)); } Tree tree(treeElements.begin(), treeElements.end()); std::vector p(nb_points); // positions at step iter_n std::vector b(nb_points); // ... - for(it = first, i=0; it != beyond; it++, ++i) + for(it = first, i=0; it != beyond; it++, ++i) { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS p[i] = get(point_pmap,it); +#else + p[i] = get(point_pmap,*it); +#endif + } // loop until convergence for(int iter_n = 0; iter_n < iter_number ; ++iter_n) @@ -254,7 +263,11 @@ improved_laplacian_smooth_point_set( // Iterates over input points, computes (original) Laplacian smoothing and b[]. for(it = first, i=0; it != beyond; it++, ++i) { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point& p0 = get(point_pmap,it); +#else + Point& p0 = get(point_pmap,*it); +#endif Point np = improved_laplacian_smoothing_i::laplacian_smooth_point(p0,tree,k); b[i] = alpha*(np - p0) + (1-alpha)*(np - p[i]); p[i] = np; @@ -320,7 +333,12 @@ improved_laplacian_smooth_point_set( { return improved_laplacian_smooth_point_set( first,beyond, +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), +#else + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()), +#endif k, iter_number, alpha, beta); 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 97ac19b582a..50483a54aba 100644 --- a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h @@ -168,7 +168,11 @@ jet_estimate_normals( std::vector kd_tree_points; for(it = first; it != beyond; it++) { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point point = get(point_pmap, it); +#else + Point point = get(point_pmap, *it); +#endif kd_tree_points.push_back(point); } Tree tree(kd_tree_points.begin(), kd_tree_points.end()); @@ -180,8 +184,20 @@ jet_estimate_normals( // vectors (already normalized) for(it = first; it != beyond; it++) { - Vector normal = internal::jet_estimate_normal(get(point_pmap,it), tree, k, degree_fitting); + Vector normal = internal::jet_estimate_normal( +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + get(point_pmap,it), +#else + get(point_pmap,*it), +#endif + tree, k, degree_fitting); + +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS put(normal_pmap, it, normal); // normal_pmap[it] = normal +#else + put(normal_pmap, *it, normal); // normal_pmap[it] = normal +#endif + } /*long*/ memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20); @@ -230,7 +246,12 @@ jet_estimate_normals( { jet_estimate_normals( first,beyond, - make_dereference_property_map(first), +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + make_dereference_property_map(first), +#else + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()), +#endif normal_pmap, k, degree_fitting); 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 ecb0452f95f..64f1389e3c8 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 @@ -1,3 +1,4 @@ +#define CGAL_EIGEN3_ENABLED // Copyright (c) 2007-09 INRIA Sophia-Antipolis (France). // All rights reserved. // @@ -158,7 +159,11 @@ jet_smooth_point_set( std::vector kd_tree_points; for(it = first; it != beyond; it++) { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point point = get(point_pmap, it); +#else + Point point = get(point_pmap, *it); +#endif kd_tree_points.push_back(point); } Tree tree(kd_tree_points.begin(), kd_tree_points.end()); @@ -167,7 +172,11 @@ jet_smooth_point_set( // Implementation note: the cast to Point& allows to modify only the point's position. for(it = first; it != beyond; it++) { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point& p = get(point_pmap, it); +#else + Point& p = get(point_pmap, *it); +#endif p = internal::jet_smooth_point(p,tree,k,degree_fitting,degree_monge); } } @@ -211,7 +220,12 @@ jet_smooth_point_set( { jet_smooth_point_set( first,beyond, +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), +#else + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()), +#endif 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 45f64a205fb..07bb479c780 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -158,14 +158,22 @@ struct Propagate_normal_orientation // Gets source normal vertex_descriptor source_vertex = boost::source(edge, mst_graph); +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS const Vector source_normal = mst_graph.m_normal_pmap[mst_graph[source_vertex].input_point]; const bool source_normal_is_oriented = mst_graph[source_vertex].is_oriented; - +#else + const Vector source_normal = mst_graph.m_normal_pmap[*(mst_graph[source_vertex].input_point)]; + const bool source_normal_is_oriented = mst_graph[source_vertex].is_oriented; +#endif // Gets target normal vertex_descriptor target_vertex = boost::target(edge, mst_graph); +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Vector& target_normal = mst_graph.m_normal_pmap[mst_graph[target_vertex].input_point]; bool& target_normal_is_oriented = ((MST_graph&)mst_graph)[target_vertex].is_oriented; - +#else + Vector& target_normal = mst_graph.m_normal_pmap[*(mst_graph[target_vertex].input_point)]; + bool& target_normal_is_oriented = ((MST_graph&)mst_graph)[target_vertex].is_oriented; +#endif if ( ! target_normal_is_oriented ) { // -> -> @@ -220,14 +228,25 @@ mst_find_source( ForwardIterator top_point = first; for (ForwardIterator v = ++first; v != beyond; v++) { + +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS double top_z = get(point_pmap,top_point).z(); // top_point's Z coordinate double z = get(point_pmap,v).z(); +#else + double top_z = get(point_pmap,*top_point).z(); // top_point's Z coordinate + double z = get(point_pmap,*v).z(); +#endif + if (top_z < z) top_point = v; } // Orients its normal towards +Z axis +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Vector& normal = get(normal_pmap,top_point); +#else + Vector& normal = get(normal_pmap,*top_point); +#endif const Vector Z(0, 0, 1); if (Z * normal < 0) { CGAL_TRACE(" Flip top point normal\n"); @@ -303,7 +322,12 @@ create_riemannian_graph( std::vector kd_tree_points; kd_tree_points.reserve(num_input_points); for (ForwardIterator it = first; it != beyond; it++) { + +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point point = get(point_pmap, it); +#else + Point point = get(point_pmap, *it); +#endif Point_vertex_handle_3 point_wrapper(point.x(), point.y(), point.z(), it); kd_tree_points.push_back(point_wrapper); } @@ -335,13 +359,22 @@ create_riemannian_graph( for (ForwardIterator it = first; it != beyond; it++) { std::size_t it_index = get(index_pmap,it); +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Vector it_normal_vector = get(normal_pmap,it); - +#else + Vector it_normal_vector = get(normal_pmap,*it); +#endif + // 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. + +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point point = get(point_pmap, it); +#else + Point point = get(point_pmap, *it); +#endif 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(); @@ -365,7 +398,12 @@ create_riemannian_graph( // -> -> // Computes edge weight = 1 - | normal1 * normal2 | // where normal1 and normal2 are the normal at the edge extremities. + +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Vector neighbor_normal_vector = get(normal_pmap,neighbor); +#else + Vector neighbor_normal_vector = get(normal_pmap,*neighbor); +#endif double weight = 1.0 - std::abs(it_normal_vector * neighbor_normal_vector); if (weight < 0) weight = 0; // safety check @@ -654,7 +692,12 @@ mst_orient_normals( { return mst_orient_normals( first,beyond, +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), +#else + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()), +#endif normal_pmap, k); } 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 71c6852d94f..1cebe031766 100644 --- a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h @@ -162,7 +162,11 @@ pca_estimate_normals( std::vector kd_tree_points; for(it = first; it != beyond; it++) { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point point = get(point_pmap, it); +#else + Point point = get(point_pmap, *it); +#endif kd_tree_points.push_back(point); } Tree tree(kd_tree_points.begin(), kd_tree_points.end()); @@ -174,8 +178,20 @@ pca_estimate_normals( // vectors (already normalized) for(it = first; it != beyond; it++) { - Vector normal = internal::pca_estimate_normal(get(point_pmap,it), tree, k); + Vector normal = internal::pca_estimate_normal( +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + get(point_pmap,it), +#else + get(point_pmap,*it), +#endif + tree, + k); + +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS put(normal_pmap, it, normal); // normal_pmap[it] = normal +#else + put(normal_pmap, *it, normal); // normal_pmap[it] = normal +#endif } /*long*/ memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20); @@ -221,7 +237,12 @@ pca_estimate_normals( { pca_estimate_normals( first,beyond, +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), +#else + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()), +#endif normal_pmap, k); } diff --git a/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h b/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h index 8dbad02e09a..028a50bc9af 100644 --- a/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h @@ -152,7 +152,11 @@ pca_smooth_point_set( std::vector kd_tree_points; for(it = first; it != beyond; it++) { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point point = get(point_pmap, it); +#else + Point point = get(point_pmap, *it); +#endif kd_tree_points.push_back(point); } Tree tree(kd_tree_points.begin(), kd_tree_points.end()); @@ -161,7 +165,12 @@ pca_smooth_point_set( // Implementation note: the cast to Point& allows to modify only the point's position. for(it = first; it != beyond; it++) { + +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point& p = get(point_pmap, it); +#else + Point& p = get(point_pmap, *it); +#endif p = internal::pca_smooth_point(p,tree,k); } } @@ -200,7 +209,12 @@ pca_smooth_point_set( { pca_smooth_point_set( first,beyond, +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), +#else + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()), +#endif k); } /// @endcond diff --git a/Point_set_processing_3/include/CGAL/property_map.h b/Point_set_processing_3/include/CGAL/property_map.h index 57dcf5d37aa..a0438225ba7 100644 --- a/Point_set_processing_3/include/CGAL/property_map.h +++ b/Point_set_processing_3/include/CGAL/property_map.h @@ -34,18 +34,27 @@ namespace CGAL { +#ifndef CGAL_USE_OLD_PAIR_PROPERTY_MAPS /// An alternative to boost::put_get_helper for: /// - return type of `get` function is `const Reference` /// - `key` is passed by reference in `put` function template struct put_get_helper_pass_key_by_reference { }; +// this is required since LValuePM should have get which returns reference template -inline const Reference +inline Reference +get(const put_get_helper_pass_key_by_reference& pa, K& k) +{ + return static_cast(pa)[k]; +} + +// this is also required because some of the functions pass const ref parameters +template +inline const typename PropertyMap::value_type& get(const put_get_helper_pass_key_by_reference& pa, const K& k) { - Reference v = static_cast(pa)[k]; - return v; + return static_cast(pa)[k]; } template @@ -54,8 +63,9 @@ put(const put_get_helper_pass_key_by_reference& pa, K& k { static_cast(pa)[k] = v; } +#endif - +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS /// \ingroup PkgProperty_map /// Property map that converts a `T*` pointer (or in general an iterator /// over `T` elements) to the `T` object. @@ -87,7 +97,9 @@ make_dereference_property_map(Iter) // value_type_traits is a workaround as back_insert_iterator's `value_type` is void return Dereference_property_map::type>(); } +#endif +#ifndef CGAL_USE_OLD_PAIR_PROPERTY_MAPS template struct Typed_identity_property_map_by_reference : put_get_helper_pass_key_by_reference > @@ -97,10 +109,20 @@ struct Typed_identity_property_map_by_reference typedef T& reference; typedef boost::lvalue_property_map_tag category; - reference operator[](key_type& v) const { return reference(v); } - const reference operator[](const key_type& v) const { return reference(v); } + reference operator[](key_type& v) const { return v; } + const value_type& operator[](const key_type& v) const { return v; } }; +/// Free function to create a `Typed_identity_property_map_by_reference` property map. +/// +/// \relates Typed_identity_property_map_by_reference +template // Key and value type +Typed_identity_property_map_by_reference + make_typed_identity_property_map_by_reference(T) +{ + return Typed_identity_property_map_by_reference(); +} +#endif //========================================================================= @@ -127,6 +149,17 @@ struct First_of_pair_property_map template reference operator[](Iter pair) const { return reference(pair->first); } }; + +/// Free function to create a `First_of_pair_property_map` property map. +/// +/// \relates First_of_pair_property_map +template // Type convertible to key_type +First_of_pair_property_map::type> + make_first_of_pair_property_map(Iter) +{ + // value_type_traits is a workaround as back_insert_iterator's value_type is void + return First_of_pair_property_map::type>(); +} #else /// \ingroup PkgProperty_map /// Property map that accesses the first item of a `std::pair`. @@ -147,25 +180,20 @@ struct First_of_pair_property_map /// Access a property map element. /// /// @tparam pair a key whose first item is accessed - reference operator[](key_type& pair) const { return reference(pair.first); } - - /// Access a property map element. - /// - /// @tparam pair a key whose first item is accessed read-only - const reference operator[](const key_type& pair) const { return reference(pair.first); } + reference operator[](key_type& pair) const { return pair.first; } + const value_type& operator[](const key_type& v) const { return pair.first; } }; -#endif /// Free function to create a `First_of_pair_property_map` property map. /// /// \relates First_of_pair_property_map -template // Type convertible to key_type -First_of_pair_property_map::type> -make_first_of_pair_property_map(Iter) +template // Pair type +First_of_pair_property_map + make_first_of_pair_property_map(Pair) { - // value_type_traits is a workaround as back_insert_iterator's value_type is void - return First_of_pair_property_map::type>(); + return First_of_pair_property_map(); } +#endif #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS /// \ingroup PkgProperty_map @@ -193,6 +221,17 @@ struct Second_of_pair_property_map template reference operator[](Iter pair) const { return reference(pair->second); } }; + +/// Free function to create a Second_of_pair_property_map property map. +/// +/// \relates Second_of_pair_property_map +template // Type convertible to key_type +Second_of_pair_property_map::type> + make_second_of_pair_property_map(Iter) +{ + // value_type_traits is a workaround as back_insert_iterator's value_type is void + return Second_of_pair_property_map::type>(); +} #else /// \ingroup PkgProperty_map /// @@ -216,24 +255,21 @@ struct Second_of_pair_property_map /// Access a property map element. /// /// @tparam pair a key whose second item is accessed - reference operator[](key_type& pair) const { return reference(pair.second); } - - /// Access a property map element. - /// - /// @tparam pair a key whose second item is accessed read-only - const reference operator[](const key_type& pair) const { return reference(pair.second); } + reference operator[](key_type& pair) const { return pair.second; } + const value_type& operator[](const key_type& v) const { return pair.second; } }; -#endif + /// Free function to create a Second_of_pair_property_map property map. /// /// \relates Second_of_pair_property_map -template // Type convertible to key_type -Second_of_pair_property_map::type> -make_second_of_pair_property_map(Iter) +template // Pair type +Second_of_pair_property_map + make_second_of_pair_property_map(Pair) { - // value_type_traits is a workaround as back_insert_iterator's value_type is void - return Second_of_pair_property_map::type>(); + return Second_of_pair_property_map(); } +#endif + //========================================================================= @@ -263,6 +299,17 @@ struct Nth_of_tuple_property_map template reference operator[](Iter tuple) const { return (reference) tuple->template get(); } }; + +/// Free function to create a Nth_of_tuple_property_map property map. +/// +/// \relates Nth_of_tuple_property_map +template // Type convertible to key_type +Nth_of_tuple_property_map::type> + make_nth_of_tuple_property_map(Iter) +{ + // value_type_traits is a workaround as back_insert_iterator's `value_type` is void + return Nth_of_tuple_property_map::type>(); +} #else /// \ingroup PkgProperty_map /// @@ -285,26 +332,20 @@ struct Nth_of_tuple_property_map /// Access a property map element. /// /// @tparam tuple a key whose Nth item is accessed - reference operator[](key_type& tuple) const { return reference(tuple.template get()); } - - /// Access a property map element. - /// - /// @tparam tuple a key whose Nth item is accessed read-only - const reference operator[](const key_type& tuple) const { return reference(tuple.template get()); } + reference operator[](key_type& tuple) const { return tuple.template get(); } + const value_type& operator[](const key_type& v) const { return tuple.template get(); } }; -#endif /// Free function to create a Nth_of_tuple_property_map property map. /// /// \relates Nth_of_tuple_property_map -template // Type convertible to key_type -Nth_of_tuple_property_map::type> -make_nth_of_tuple_property_map(Iter) +template // Tuple type +Nth_of_tuple_property_map + make_nth_of_tuple_property_map(Tuple) { - // value_type_traits is a workaround as back_insert_iterator's `value_type` is void - return Nth_of_tuple_property_map::type>(); + return Nth_of_tuple_property_map(); } - +#endif } // namespace CGAL 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 a897636f31c..bd6575df5c1 100644 --- a/Point_set_processing_3/include/CGAL/radial_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/radial_orient_normals.h @@ -80,7 +80,11 @@ radial_orient_normals( int nb_points = 0; for (ForwardIterator it = first; it != beyond; it++) { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point point = get(point_pmap, it); +#else + Point point = get(point_pmap, *it); +#endif sum = sum + (point - CGAL::ORIGIN); nb_points++; } @@ -91,8 +95,11 @@ radial_orient_normals( std::deque oriented_points, unoriented_points; for (ForwardIterator it = first; it != beyond; it++) { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point point = get(point_pmap, it); - +#else + Point point = get(point_pmap, *it); +#endif // Radial vector towards exterior of the point set Vector vec1 = point - barycenter; @@ -161,7 +168,12 @@ radial_orient_normals( { return radial_orient_normals( first,beyond, - make_dereference_property_map(first), +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + make_dereference_property_map(first), +#else + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()), +#endif normal_pmap); } /// @endcond diff --git a/Point_set_processing_3/include/CGAL/random_simplify_point_set.h b/Point_set_processing_3/include/CGAL/random_simplify_point_set.h index 5e0129034a5..8fd22197bdb 100644 --- a/Point_set_processing_3/include/CGAL/random_simplify_point_set.h +++ b/Point_set_processing_3/include/CGAL/random_simplify_point_set.h @@ -106,7 +106,12 @@ random_simplify_point_set( { return random_simplify_point_set( first,beyond, +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), +#else + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()), +#endif removed_percentage); } /// @endcond diff --git a/Point_set_processing_3/include/CGAL/remove_outliers.h b/Point_set_processing_3/include/CGAL/remove_outliers.h index 3b5bb3135ee..e3d2b952192 100644 --- a/Point_set_processing_3/include/CGAL/remove_outliers.h +++ b/Point_set_processing_3/include/CGAL/remove_outliers.h @@ -164,7 +164,11 @@ remove_outliers( std::vector kd_tree_points; for(it = first; it != beyond; it++) { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point point = get(point_pmap, it); +#else + Point point = get(point_pmap, *it); +#endif kd_tree_points.push_back(point); } Tree tree(kd_tree_points.begin(), kd_tree_points.end()); @@ -173,7 +177,13 @@ remove_outliers( std::multimap sorted_points; for(it = first; it != beyond; it++) { - FT sq_distance = internal::compute_avg_knn_sq_distance_3(get(point_pmap,it), tree, k); + FT sq_distance = internal::compute_avg_knn_sq_distance_3( +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + get(point_pmap,it), +#else + get(point_pmap,*it), +#endif + tree, k); sorted_points.insert( std::make_pair(sq_distance, *it) ); } @@ -232,7 +242,12 @@ remove_outliers( { return remove_outliers( first,beyond, +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), +#else + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()), +#endif k,threshold_percent); } /// @endcond diff --git a/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h b/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h index d67e4ceeef2..b9f83e4c39d 100644 --- a/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h +++ b/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h @@ -162,7 +162,11 @@ remove_outliers_wrt_median_knn_sq_distance( std::vector kd_tree_points; for(it = first; it != beyond; it++) { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point point = get(point_pmap, it); +#else + Point point = get(point_pmap, *it); +#endif kd_tree_points.push_back(point); } Tree tree(kd_tree_points.begin(), kd_tree_points.end()); @@ -171,7 +175,13 @@ remove_outliers_wrt_median_knn_sq_distance( std::multimap sorted_points; for(it = first; it != beyond; it++) { - FT sq_distance = internal::compute_median_knn_sq_distance_3(get(point_pmap,it), tree, k); + FT sq_distance = internal::compute_median_knn_sq_distance_3( +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + get(point_pmap,it), +#else + get(point_pmap,*it), +#endif + tree, k); sorted_points.insert( std::make_pair(sq_distance, *it) ); } @@ -230,7 +240,12 @@ remove_outliers_wrt_median_knn_sq_distance( { return remove_outliers_wrt_median_knn_sq_distance( first,beyond, - make_dereference_property_map(first), +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + make_dereference_property_map(first), +#else + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()), +#endif k,threshold_percent); } /// @endcond From 9d94793f77b75294cbb0ae2598eaccdbbb39228e Mon Sep 17 00:00:00 2001 From: iyaz Date: Tue, 30 Apr 2013 01:27:22 +0300 Subject: [PATCH 03/63] parameter names are corrected --- Point_set_processing_3/include/CGAL/property_map.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/property_map.h b/Point_set_processing_3/include/CGAL/property_map.h index a0438225ba7..3e0701b41c4 100644 --- a/Point_set_processing_3/include/CGAL/property_map.h +++ b/Point_set_processing_3/include/CGAL/property_map.h @@ -181,7 +181,7 @@ struct First_of_pair_property_map /// /// @tparam pair a key whose first item is accessed reference operator[](key_type& pair) const { return pair.first; } - const value_type& operator[](const key_type& v) const { return pair.first; } + const value_type& operator[](const key_type& pair) const { return pair.first; } }; /// Free function to create a `First_of_pair_property_map` property map. @@ -256,7 +256,7 @@ struct Second_of_pair_property_map /// /// @tparam pair a key whose second item is accessed reference operator[](key_type& pair) const { return pair.second; } - const value_type& operator[](const key_type& v) const { return pair.second; } + const value_type& operator[](const key_type& pair) const { return pair.second; } }; /// Free function to create a Second_of_pair_property_map property map. @@ -333,7 +333,7 @@ struct Nth_of_tuple_property_map /// /// @tparam tuple a key whose Nth item is accessed reference operator[](key_type& tuple) const { return tuple.template get(); } - const value_type& operator[](const key_type& v) const { return tuple.template get(); } + const value_type& operator[](const key_type& tuple) const { return tuple.template get(); } }; /// Free function to create a Nth_of_tuple_property_map property map. From cae70268288da8b59a9986fb0056c6bdcb68c7db Mon Sep 17 00:00:00 2001 From: iyaz Date: Tue, 30 Apr 2013 02:26:55 +0300 Subject: [PATCH 04/63] test cases updated --- .../Point_set_processing_3/analysis_test.cpp | 1 + .../normal_estimation_test.cpp | 29 +++++++++++++++++-- .../remove_outliers_test.cpp | 1 + .../Point_set_processing_3/smoothing_test.cpp | 1 + 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Point_set_processing_3/test/Point_set_processing_3/analysis_test.cpp b/Point_set_processing_3/test/Point_set_processing_3/analysis_test.cpp index 8758cee9b01..b42725c563e 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/analysis_test.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/analysis_test.cpp @@ -1,3 +1,4 @@ +//#define CGAL_USE_OLD_PAIR_PROPERTY_MAPS // analysis_test.cpp //---------------------------------------------------------- diff --git a/Point_set_processing_3/test/Point_set_processing_3/normal_estimation_test.cpp b/Point_set_processing_3/test/Point_set_processing_3/normal_estimation_test.cpp index c383b860193..e6c0406a64a 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/normal_estimation_test.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/normal_estimation_test.cpp @@ -1,3 +1,4 @@ +//#define CGAL_USE_OLD_PAIR_PROPERTY_MAPS // normal_estimation_test.cpp //---------------------------------------------------------- @@ -127,7 +128,11 @@ bool run_pca_estimate_normals(PointList& points, // input points + output normal << nb_neighbors_pca_normals << ")...\n"; CGAL::pca_estimate_normals(points.begin(), points.end(), +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS CGAL::make_normal_of_point_with_normal_pmap(points.begin()), +#else + CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()), +#endif nb_neighbors_pca_normals); long memory = CGAL::Memory_sizer().virtual_size(); @@ -151,7 +156,11 @@ bool run_jet_estimate_normals(PointList& points, // input points + output normal << nb_neighbors_jet_fitting_normals << ")...\n"; CGAL::jet_estimate_normals(points.begin(), points.end(), +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS CGAL::make_normal_of_point_with_normal_pmap(points.begin()), +#else + CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()), +#endif nb_neighbors_jet_fitting_normals); long memory = CGAL::Memory_sizer().virtual_size(); @@ -231,7 +240,11 @@ bool run_mst_orient_normals(PointList& points, // input points + input/output no PointList::iterator unoriented_points_begin = CGAL::mst_orient_normals(points.begin(), points.end(), - CGAL::make_normal_of_point_with_normal_pmap(points.begin()), +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + CGAL::make_normal_of_point_with_normal_pmap(points.begin()), +#else + CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()), +#endif nb_neighbors_mst); long memory = CGAL::Memory_sizer().virtual_size(); @@ -303,7 +316,12 @@ int main(int argc, char * argv[]) success = stream && CGAL::read_off_points_and_normals(stream, std::back_inserter(points), - CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(points))); +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(points)) +#else + CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()) +#endif + ); } // If XYZ file format else if (extension == ".xyz" || extension == ".XYZ" || @@ -313,7 +331,12 @@ int main(int argc, char * argv[]) success = stream && CGAL::read_xyz_points_and_normals(stream, std::back_inserter(points), - CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(points))); +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(points)) +#else + CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()) +#endif + ); } if (success) { diff --git a/Point_set_processing_3/test/Point_set_processing_3/remove_outliers_test.cpp b/Point_set_processing_3/test/Point_set_processing_3/remove_outliers_test.cpp index a2782229c09..b2491350918 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/remove_outliers_test.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/remove_outliers_test.cpp @@ -1,3 +1,4 @@ +//#define CGAL_USE_OLD_PAIR_PROPERTY_MAPS // remove_outliers_test.cpp //---------------------------------------------------------- diff --git a/Point_set_processing_3/test/Point_set_processing_3/smoothing_test.cpp b/Point_set_processing_3/test/Point_set_processing_3/smoothing_test.cpp index 58ed751ce88..377d4490d57 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/smoothing_test.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/smoothing_test.cpp @@ -1,3 +1,4 @@ +//#define CGAL_USE_OLD_PAIR_PROPERTY_MAPS // smoothing_test.cpp //---------------------------------------------------------- From 9cf096b92ec785a9b5610a22a347e14441e9c950 Mon Sep 17 00:00:00 2001 From: iyaz Date: Tue, 30 Apr 2013 02:27:47 +0300 Subject: [PATCH 05/63] Examples updated --- .../Point_set_processing_3/property_map.cpp | 72 ++++++++++++++----- .../remove_outliers_example.cpp | 21 ++++-- 2 files changed, 70 insertions(+), 23 deletions(-) diff --git a/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp b/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp index aa2e292ea55..57c424ad2cc 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp @@ -6,8 +6,14 @@ //---------------------------------------------------------- // Usage: no parameters +//#define CGAL_USE_OLD_PAIR_PROPERTY_MAPS +// define CGAL_USE_OLD_PAIR_PROPERTY_MAPS for using previous property-maps which accept an iterator type as key type, +// new versions accept value_type of an iterator as key type + #include #include +#include + #include #include #include @@ -42,7 +48,13 @@ struct MyLess { bool operator()(const T& t0, const T& t1) const { - return get(pmap, &t0) < get(pmap, &t1); + return +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + get(pmap, &t0) < get(pmap, &t1); +#else + get(pmap, t0) < get(pmap, t1); +#endif + } }; @@ -64,7 +76,14 @@ void process_point_set(Iterator beg, Iterator end, PointPMap pmap) template void process_point_set(Iterator beg, Iterator end) { - process_point_set(beg,end, CGAL::make_dereference_property_map(beg)); + process_point_set(beg,end, +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + CGAL::make_dereference_property_map(beg) +#else + CGAL::make_typed_identity_property_map_by_reference( + typename CGAL::value_type_traits::type()) +#endif + ); } @@ -75,13 +94,22 @@ template points; - + process_point_set(points.begin(), points.end()); } @@ -108,11 +136,11 @@ int main() for(int i = 0; i < 10; i++){ points.push_back(std::make_pair(Point_3(9-i,0,0), Vector_3(i,0,0))); } - + process_point_set(points.begin(), - points.end(), - CGAL::First_of_pair_property_map()); - + points.end(), + CGAL::First_of_pair_property_map()); + for(int i = 0; i < 10; i++){ std::cout << points[i].first << "\t" << points[i].second << std::endl; } @@ -131,11 +159,11 @@ int main() double x = (i%2)?i:-i; points.push_back(boost::make_tuple(i,Point_3(9-i,0,0), false, Vector_3(x,0,0))); } - + process_point_set(points.begin(), - points.end(), - CGAL::Nth_of_tuple_property_map<1,IndexedPointWithOrientableNormalTuple>()); - + points.end(), + CGAL::Nth_of_tuple_property_map<1,IndexedPointWithOrientableNormalTuple>()); + std::cout << boost::tuples::set_open('[') << boost::tuples::set_close(']') << boost::tuples::set_delimiter(','); for(int i = 0; i < 10; i++){ @@ -144,16 +172,22 @@ int main() //We keep the sequence in order, but determine the normal and if it is different from zero set the Boolean to true orient_normals(points.begin(), - points.end(), - CGAL::make_nth_of_tuple_property_map<1>(points.begin()), - CGAL::make_nth_of_tuple_property_map<2>(points.begin()), - CGAL::make_nth_of_tuple_property_map<3>(points.begin())); - + points.end(), +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + CGAL::make_nth_of_tuple_property_map<1>(points.begin()), + CGAL::make_nth_of_tuple_property_map<2>(points.begin()), + CGAL::make_nth_of_tuple_property_map<3>(points.begin()) +#else + CGAL::make_nth_of_tuple_property_map<1>(IndexedPointWithOrientableNormalTuple()), + CGAL::make_nth_of_tuple_property_map<2>(IndexedPointWithOrientableNormalTuple()), + CGAL::make_nth_of_tuple_property_map<3>(IndexedPointWithOrientableNormalTuple()) +#endif + ); + std::cout << "\nAfter orient_normals\n"; for(int i = 0; i < 10; i++){ std::cout << points[i] << std::endl; } } - return 0; } diff --git a/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp index 4e8fc2a53c9..bbc9ab4c6f7 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp @@ -1,3 +1,7 @@ +//#define CGAL_USE_OLD_PAIR_PROPERTY_MAPS +// define CGAL_USE_OLD_PAIR_PROPERTY_MAPS for using previous property-maps which accept an iterator type as key type, +// new versions accept value_type of an iterator as key type + #include #include #include @@ -18,7 +22,12 @@ int main(void) std::ifstream stream("data/oni.xyz"); if (!stream || !CGAL::read_xyz_points(stream, std::back_inserter(points), - CGAL::Dereference_property_map())) +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + CGAL::Dereference_property_map()) +#else + CGAL::Typed_identity_property_map_by_reference()) +#endif + ) { std::cerr << "Error: cannot read file data/oni.xyz" << std::endl; return EXIT_FAILURE; @@ -29,9 +38,13 @@ int main(void) const double removed_percentage = 5.0; // percentage of points to remove const int nb_neighbors = 24; // considers 24 nearest neighbor points points.erase(CGAL::remove_outliers(points.begin(), points.end(), - CGAL::Dereference_property_map(), - nb_neighbors, removed_percentage), - points.end()); +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + CGAL::Dereference_property_map(), +#else + CGAL::Typed_identity_property_map_by_reference(), +#endif + nb_neighbors, removed_percentage), + points.end()); // Optional: after erase(), use Scott Meyer's "swap trick" to trim excess capacity std::vector(points).swap(points); From 6b1a6ddab70f79ace33f2996196b475d87bb4073 Mon Sep 17 00:00:00 2001 From: iyaz Date: Tue, 30 Apr 2013 02:28:10 +0300 Subject: [PATCH 06/63] parameter name fixed --- Point_set_processing_3/include/CGAL/IO/read_off_points.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Point_set_processing_3/include/CGAL/IO/read_off_points.h b/Point_set_processing_3/include/CGAL/IO/read_off_points.h index 087e41807a2..e1dd5269070 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_off_points.h @@ -198,7 +198,7 @@ read_off_points_and_normals( stream, output, #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - make_dereference_property_map(first), + make_dereference_property_map(output), #else make_typed_identity_property_map_by_reference( typename value_type_traits::type()), From a994cde1fadf9d4e1ca447af3ea8c3b18af123b0 Mon Sep 17 00:00:00 2001 From: iyaz Date: Tue, 30 Apr 2013 13:23:37 +0300 Subject: [PATCH 07/63] Forgotten def removed --- Point_set_processing_3/include/CGAL/jet_smooth_point_set.h | 1 - 1 file changed, 1 deletion(-) 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 64f1389e3c8..d9dbead6ac4 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 @@ -1,4 +1,3 @@ -#define CGAL_EIGEN3_ENABLED // Copyright (c) 2007-09 INRIA Sophia-Antipolis (France). // All rights reserved. // From c3c6d435b5b8165b26faa2da14d0c942cd4241a9 Mon Sep 17 00:00:00 2001 From: iyaz Date: Tue, 30 Apr 2013 15:23:01 +0300 Subject: [PATCH 08/63] IO part documentation update --- .../include/CGAL/IO/read_off_points.h | 18 +++++++++--------- .../include/CGAL/IO/read_xyz_points.h | 18 +++++++++--------- .../include/CGAL/IO/write_off_points.h | 18 +++++++++--------- .../include/CGAL/IO/write_xyz_points.h | 18 +++++++++--------- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/IO/read_off_points.h b/Point_set_processing_3/include/CGAL/IO/read_off_points.h index e1dd5269070..c7754d8b639 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_off_points.h @@ -64,8 +64,8 @@ bool read_off_points_and_normals( std::istream& stream, ///< input stream. OutputIterator output, ///< output iterator over points. - PointPMap point_pmap, ///< property map OutputIterator -> Point_3. - NormalPMap normal_pmap, ///< property map OutputIterator -> Vector_3. + PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3. + NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3. const Kernel& /*kernel*/) ///< geometric traits. { // value_type_traits is a workaround as back_insert_iterator's value_type is void @@ -169,8 +169,8 @@ bool read_off_points_and_normals( std::istream& stream, ///< input stream. OutputIterator output, ///< output iterator over points. - PointPMap point_pmap, ///< property map OutputIterator -> Point_3. - NormalPMap normal_pmap) ///< property map OutputIterator -> Vector_3. + PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3. + NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3. { typedef typename boost::property_traits::value_type Point; typedef typename Kernel_traits::Kernel Kernel; @@ -184,7 +184,7 @@ read_off_points_and_normals( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template @@ -192,7 +192,7 @@ bool read_off_points_and_normals( std::istream& stream, ///< input stream. OutputIterator output, ///< output iterator over points. - NormalPMap normal_pmap) ///< property map OutputIterator -> Vector_3. + NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3. { return read_off_points_and_normals( stream, @@ -232,7 +232,7 @@ bool read_off_points( std::istream& stream, ///< input stream. OutputIterator output, ///< output iterator over points. - PointPMap point_pmap, ///< property map OutputIterator -> Point_3. + PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3. const Kernel& kernel) ///< geometric traits. { // Calls read_off_points_and_normals() with a normal property map = boost::dummy_property_map @@ -253,7 +253,7 @@ bool read_off_points( std::istream& stream, ///< input stream. OutputIterator output, ///< output iterator over points. - PointPMap point_pmap) ///< property map OutputIterator -> Point_3. + PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3. { typedef typename boost::property_traits::value_type Point; typedef typename Kernel_traits::Kernel Kernel; @@ -266,7 +266,7 @@ read_off_points( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template bool diff --git a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h index 5e014b5ec0f..17c0fe4fdd9 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h @@ -65,8 +65,8 @@ bool read_xyz_points_and_normals( std::istream& stream, ///< input stream. OutputIterator output, ///< output iterator over points. - PointPMap point_pmap, ///< property map OutputIterator -> Point_3. - NormalPMap normal_pmap, ///< property map OutputIterator -> Vector_3. + PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3. + NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3. const Kernel& /*kernel*/) ///< geometric traits. { // value_type_traits is a workaround as back_insert_iterator's value_type is void @@ -157,8 +157,8 @@ bool read_xyz_points_and_normals( std::istream& stream, ///< input stream. OutputIterator output, ///< output iterator over points. - PointPMap point_pmap, ///< property map OutputIterator -> Point_3. - NormalPMap normal_pmap) ///< property map OutputIterator -> Vector_3. + PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3. + NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3. { typedef typename boost::property_traits::value_type Point; typedef typename Kernel_traits::Kernel Kernel; @@ -172,7 +172,7 @@ read_xyz_points_and_normals( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template @@ -180,7 +180,7 @@ bool read_xyz_points_and_normals( std::istream& stream, ///< input stream. OutputIterator output, ///< output iterator over points. - NormalPMap normal_pmap) ///< property map OutputIterator -> Vector_3. + NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3. { return read_xyz_points_and_normals( stream, @@ -221,7 +221,7 @@ bool read_xyz_points( std::istream& stream, ///< input stream. OutputIterator output, ///< output iterator over points. - PointPMap point_pmap, ///< property map OutputIterator -> Point_3. + PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3. const Kernel& kernel) ///< geometric traits. { // Calls read_xyz_points_and_normals() with a normal property map = boost::dummy_property_map @@ -242,7 +242,7 @@ bool read_xyz_points( std::istream& stream, ///< input stream. OutputIterator output, ///< output iterator over points. - PointPMap point_pmap) ///< property map OutputIterator -> Point_3. + PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3. { typedef typename boost::property_traits::value_type Point; typedef typename Kernel_traits::Kernel Kernel; @@ -255,7 +255,7 @@ read_xyz_points( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template bool 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 2e66156fa23..39d544028d8 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 @@ -64,8 +64,8 @@ write_off_points_and_normals( std::ostream& stream, ///< output stream. ForwardIterator first, ///< iterator over the first input point. ForwardIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map ForwardIterator -> Point_3. - NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3. + PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3. + NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3. const Kernel& /*kernel*/) ///< geometric traits. { // basic geometric types @@ -112,8 +112,8 @@ write_off_points_and_normals( std::ostream& stream, ///< output stream. ForwardIterator first, ///< first input point. ForwardIterator beyond, ///< past-the-end input point. - PointPMap point_pmap, ///< property map OutputIterator -> Point_3. - NormalPMap normal_pmap) ///< property map OutputIterator -> Vector_3. + PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3. + NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3. { typedef typename boost::property_traits::value_type Point; typedef typename Kernel_traits::Kernel Kernel; @@ -127,7 +127,7 @@ write_off_points_and_normals( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template @@ -136,7 +136,7 @@ write_off_points_and_normals( std::ostream& stream, ///< output stream. ForwardIterator first, ///< first input point. ForwardIterator beyond, ///< past-the-end input point. - NormalPMap normal_pmap) ///< property map OutputIterator -> Vector_3. + NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3. { return write_off_points_and_normals( stream, @@ -170,7 +170,7 @@ write_off_points( std::ostream& stream, ///< output stream. ForwardIterator first, ///< iterator over the first input point. ForwardIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map ForwardIterator -> Point_3. + PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3. const Kernel& kernel) ///< geometric traits. { // basic geometric types @@ -213,7 +213,7 @@ write_off_points( std::ostream& stream, ///< output stream. ForwardIterator first, ///< first input point. ForwardIterator beyond, ///< past-the-end input point. - PointPMap point_pmap) ///< property map OutputIterator -> Point_3. + PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3. { typedef typename boost::property_traits::value_type Point; typedef typename Kernel_traits::Kernel Kernel; @@ -226,7 +226,7 @@ write_off_points( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template bool 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 e9fb998122e..984587b9e02 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 @@ -64,8 +64,8 @@ write_xyz_points_and_normals( std::ostream& stream, ///< output stream. ForwardIterator first, ///< iterator over the first input point. ForwardIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map ForwardIterator -> Point_3. - NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3. + PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3. + NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3. const Kernel& /*kernel*/) ///< geometric traits. { // basic geometric types @@ -107,8 +107,8 @@ write_xyz_points_and_normals( std::ostream& stream, ///< output stream. ForwardIterator first, ///< first input point. ForwardIterator beyond, ///< past-the-end input point. - PointPMap point_pmap, ///< property map OutputIterator -> Point_3. - NormalPMap normal_pmap) ///< property map OutputIterator -> Vector_3. + PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3. + NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3. { typedef typename boost::property_traits::value_type Point; typedef typename Kernel_traits::Kernel Kernel; @@ -122,7 +122,7 @@ write_xyz_points_and_normals( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template @@ -131,7 +131,7 @@ write_xyz_points_and_normals( std::ostream& stream, ///< output stream. ForwardIterator first, ///< first input point. ForwardIterator beyond, ///< past-the-end input point. - NormalPMap normal_pmap) ///< property map OutputIterator -> Vector_3. + NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3. { return write_xyz_points_and_normals( stream, @@ -169,7 +169,7 @@ write_xyz_points( std::ostream& stream, ///< output stream. ForwardIterator first, ///< iterator over the first input point. ForwardIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map ForwardIterator -> Point_3. + PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3. To use depracated version (i.e. ForwardIterator -> Point_3) define `CGAL_USE_OLD_PAIR_PROPERTY_MAPS`. const Kernel& /*kernel*/) ///< geometric traits. { // basic geometric types @@ -208,7 +208,7 @@ write_xyz_points( std::ostream& stream, ///< output stream. ForwardIterator first, ///< first input point. ForwardIterator beyond, ///< past-the-end input point. - PointPMap point_pmap) ///< property map OutputIterator -> Point_3. + PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3. { typedef typename boost::property_traits::value_type Point; typedef typename Kernel_traits::Kernel Kernel; @@ -221,7 +221,7 @@ write_xyz_points( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template bool From 35a83e09f80dd37d6c1c7a75fe83c29b61167ea6 Mon Sep 17 00:00:00 2001 From: iyaz Date: Tue, 30 Apr 2013 16:58:01 +0300 Subject: [PATCH 09/63] Removed a forgotten comment --- Point_set_processing_3/include/CGAL/IO/write_xyz_points.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 984587b9e02..5355784c38b 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 @@ -169,7 +169,7 @@ write_xyz_points( std::ostream& stream, ///< output stream. ForwardIterator first, ///< iterator over the first input point. ForwardIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3. To use depracated version (i.e. ForwardIterator -> Point_3) define `CGAL_USE_OLD_PAIR_PROPERTY_MAPS`. + PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3. const Kernel& /*kernel*/) ///< geometric traits. { // basic geometric types From cd0c4f59f72406543189af8d3cda6d9ae83c8f11 Mon Sep 17 00:00:00 2001 From: iyaz Date: Tue, 30 Apr 2013 16:59:02 +0300 Subject: [PATCH 10/63] Documentation related changes --- .../include/CGAL/compute_average_spacing.h | 6 +-- .../include/CGAL/grid_simplify_point_set.h | 6 +-- .../CGAL/improved_jet_smooth_point_set.h | 6 +-- .../improved_laplacian_smooth_point_set.h | 6 +-- .../include/CGAL/jet_estimate_normals.h | 12 ++--- .../include/CGAL/jet_smooth_point_set.h | 6 +-- .../include/CGAL/mst_orient_normals.h | 28 +++++------ .../include/CGAL/pca_estimate_normals.h | 12 ++--- .../include/CGAL/pca_smooth_point_set.h | 6 +-- .../include/CGAL/property_map.h | 50 ++++++++++++------- .../include/CGAL/radial_orient_normals.h | 12 ++--- .../include/CGAL/random_simplify_point_set.h | 6 +-- .../include/CGAL/remove_outliers.h | 6 +-- ...move_outliers_wrt_median_knn_sq_distance.h | 6 +-- 14 files changed, 90 insertions(+), 78 deletions(-) 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 e536732649f..dc4d240bc1b 100644 --- a/Point_set_processing_3/include/CGAL/compute_average_spacing.h +++ b/Point_set_processing_3/include/CGAL/compute_average_spacing.h @@ -114,7 +114,7 @@ typename Kernel::FT compute_average_spacing( InputIterator first, ///< iterator over the first input point. InputIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map InputIterator -> Point_3 + PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3 unsigned int k, ///< number of neighbors. const Kernel& /*kernel*/) ///< geometric traits. { @@ -179,7 +179,7 @@ typename Kernel_traits::value_type>:: compute_average_spacing( InputIterator first, ///< iterator over the first input point. InputIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map InputIterator -> Point_3 + PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3 unsigned int k) ///< number of neighbors { typedef typename boost::property_traits::value_type Point; @@ -193,7 +193,7 @@ compute_average_spacing( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template < typename InputIterator > typename Kernel_traits::value_type>::Kernel::FT compute_average_spacing( 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 493ea02822f..ac3b40d3884 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 @@ -155,7 +155,7 @@ template Point_3 + PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3 double epsilon, ///< tolerance value when merging 3D points. const Kernel& /*kernel*/) ///< geometric traits. { @@ -193,7 +193,7 @@ ForwardIterator grid_simplify_point_set( ForwardIterator first, ///< iterator over the first input point ForwardIterator beyond, ///< past-the-end iterator - PointPMap point_pmap, ///< property map ForwardIterator -> Point_3 + PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3 double epsilon) ///< tolerance value when merging 3D points { typedef typename boost::property_traits::value_type Point; @@ -207,7 +207,7 @@ grid_simplify_point_set( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template ForwardIterator diff --git a/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h b/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h index 9eb14fe2e40..eaf134d50a8 100644 --- a/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h @@ -219,7 +219,7 @@ void improved_jet_smooth_point_set( ForwardIterator first, ///< iterator over the first input point. ForwardIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map ForwardIterator -> Point_3. + PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3. unsigned int k, ///< number of neighbors. const unsigned int iter_number, ///< number of iterations. const Kernel& kernel, ///< geometric traits. @@ -319,7 +319,7 @@ void improved_jet_smooth_point_set( ForwardIterator first, ///< iterator over the first input point ForwardIterator beyond, ///< past-the-end iterator - PointPMap point_pmap, ///< property map ForwardIterator -> Point_3 + PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3 unsigned int k, ///< number of neighbors. const unsigned int iter_number, FT alpha, @@ -338,7 +338,7 @@ improved_jet_smooth_point_set( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template diff --git a/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h b/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h index f5e3169622b..1be1242a826 100644 --- a/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h @@ -202,7 +202,7 @@ void improved_laplacian_smooth_point_set( ForwardIterator first, ///< iterator over the first input point. ForwardIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map ForwardIterator -> Point_3. + PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3. unsigned int k, ///< number of neighbors. const unsigned int iter_number, ///< number of iterations. const Kernel& kernel, ///< geometric traits. @@ -299,7 +299,7 @@ void improved_laplacian_smooth_point_set( ForwardIterator first, ///< iterator over the first input point ForwardIterator beyond, ///< past-the-end iterator - PointPMap point_pmap, ///< property map ForwardIterator -> Point_3 + PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3 unsigned int k, ///< number of neighbors. const unsigned int iter_number, FT alpha, @@ -318,7 +318,7 @@ improved_laplacian_smooth_point_set( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template 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 50483a54aba..ceabe2ae560 100644 --- a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h @@ -131,8 +131,8 @@ void jet_estimate_normals( InputIterator first, ///< iterator over the first input point. InputIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map InputIterator -> Point_3. - NormalPMap normal_pmap, ///< property map InputIterator -> Vector_3. + PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3. + NormalPMap normal_pmap, ///< property map: value_type of InputIterator -> Vector_3. unsigned int k, ///< number of neighbors. const Kernel& /*kernel*/, ///< geometric traits. unsigned int degree_fitting = 2) ///< fitting degree @@ -214,8 +214,8 @@ void jet_estimate_normals( InputIterator first, ///< iterator over the first input point. InputIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map InputIterator -> Point_3. - NormalPMap normal_pmap, ///< property map InputIterator -> Vector_3. + PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3. + NormalPMap normal_pmap, ///< property map: value_type of InputIterator -> Vector_3. unsigned int k, ///< number of neighbors. unsigned int degree_fitting = 2) { @@ -232,7 +232,7 @@ jet_estimate_normals( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template @@ -240,7 +240,7 @@ void jet_estimate_normals( InputIterator first, ///< iterator over the first input point. InputIterator beyond, ///< past-the-end iterator over the input points. - NormalPMap normal_pmap, ///< property map InputIterator -> Vector_3. + NormalPMap normal_pmap, ///< property map: value_type of InputIterator -> Vector_3. unsigned int k, ///< number of neighbors. unsigned int degree_fitting = 2) { 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 d9dbead6ac4..133e262c614 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 @@ -129,7 +129,7 @@ void jet_smooth_point_set( InputIterator first, ///< iterator over the first input point. InputIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map InputIterator -> Point_3. + PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3. unsigned int k, ///< number of neighbors. const Kernel& /*kernel*/, ///< geometric traits. unsigned int degree_fitting = 2, ///< fitting degree @@ -189,7 +189,7 @@ void jet_smooth_point_set( InputIterator first, ///< iterator over the first input point InputIterator beyond, ///< past-the-end iterator - PointPMap point_pmap, ///< property map InputIterator -> Point_3 + PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3 unsigned int k, ///< number of neighbors. const unsigned int degree_fitting = 2, const unsigned int degree_monge = 2) @@ -206,7 +206,7 @@ jet_smooth_point_set( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template void 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 07bb479c780..955fee2a131 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -102,7 +102,7 @@ struct MST_graph_vertex_properties { bool is_oriented; ///< Is input point's normal oriented? }; template Normal + typename NormalPMap, ///< property map: value_type of ForwardIterator -> Normal typename Kernel ///< Geometric traits class > class MST_graph @@ -134,7 +134,7 @@ public: /// @tparam Kernel Geometric traits class. template Normal + typename NormalPMap, ///< property map: value_type of ForwardIterator -> Normal typename Kernel > struct Propagate_normal_orientation @@ -212,8 +212,8 @@ ForwardIterator mst_find_source( ForwardIterator first, ///< iterator over the first input point. ForwardIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map ForwardIterator -> Point_3 - NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3 + PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3 + NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3 const Kernel& /*kernel*/) ///< geometric traits. { CGAL_TRACE(" mst_find_source()\n"); @@ -282,8 +282,8 @@ Riemannian_graph create_riemannian_graph( ForwardIterator first, ///< iterator over the first input point. ForwardIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map ForwardIterator -> Point_3 - NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3 + PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3 + NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3 IndexPMap index_pmap, ///< property map ForwardIterator -> index unsigned int k, ///< number of neighbors const Kernel& /*kernel*/) ///< geometric traits. @@ -441,8 +441,8 @@ MST_graph create_mst_graph( ForwardIterator first, ///< iterator over the first input point. ForwardIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map ForwardIterator -> Point_3 - NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3 + PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3 + NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3 IndexPMap index_pmap, ///< property map ForwardIterator -> index unsigned int k, ///< number of neighbors const Kernel& kernel, ///< geometric traits. @@ -555,8 +555,8 @@ ForwardIterator mst_orient_normals( ForwardIterator first, ///< iterator over the first input point. ForwardIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map ForwardIterator -> Point_3. - NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3. + PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3. + NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3. unsigned int k, ///< number of neighbors const Kernel& kernel) ///< geometric traits. { @@ -663,8 +663,8 @@ ForwardIterator mst_orient_normals( ForwardIterator first, ///< iterator over the first input point. ForwardIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map ForwardIterator -> Point_3. - NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3. + PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3. + NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3. unsigned int k) ///< number of neighbors { typedef typename boost::property_traits::value_type Point; @@ -679,7 +679,7 @@ mst_orient_normals( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template @@ -687,7 +687,7 @@ ForwardIterator mst_orient_normals( ForwardIterator first, ///< iterator over the first input point. ForwardIterator beyond, ///< past-the-end iterator over the input points. - NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3. + NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3. unsigned int k) ///< number of neighbors { return mst_orient_normals( 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 1cebe031766..dfc315075c2 100644 --- a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h @@ -126,8 +126,8 @@ void pca_estimate_normals( InputIterator first, ///< iterator over the first input point. InputIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map InputIterator -> Point_3. - NormalPMap normal_pmap, ///< property map InputIterator -> Vector_3. + PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3. + NormalPMap normal_pmap, ///< property map: value_type of InputIterator -> Vector_3. unsigned int k, ///< number of neighbors. const Kernel& /*kernel*/) ///< geometric traits. { @@ -208,8 +208,8 @@ void pca_estimate_normals( InputIterator first, ///< iterator over the first input point. InputIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map InputIterator -> Point_3. - NormalPMap normal_pmap, ///< property map InputIterator -> Vector_3. + PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3. + NormalPMap normal_pmap, ///< property map: value_type of InputIterator -> Vector_3. unsigned int k) ///< number of neighbors. { typedef typename boost::property_traits::value_type Point; @@ -224,7 +224,7 @@ pca_estimate_normals( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template @@ -232,7 +232,7 @@ void pca_estimate_normals( InputIterator first, ///< iterator over the first input point. InputIterator beyond, ///< past-the-end iterator over the input points. - NormalPMap normal_pmap, ///< property map InputIterator -> Vector_3. + NormalPMap normal_pmap, ///< property map: value_type of InputIterator -> Vector_3. unsigned int k) ///< number of neighbors. { pca_estimate_normals( diff --git a/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h b/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h index 028a50bc9af..098722c2cd0 100644 --- a/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h @@ -125,7 +125,7 @@ void pca_smooth_point_set( InputIterator first, ///< iterator over the first input point. InputIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map InputIterator -> Point_3. + PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3. unsigned int k, ///< number of neighbors. const Kernel& kernel) ///< geometric traits. { @@ -184,7 +184,7 @@ void pca_smooth_point_set( InputIterator first, ///< iterator over the first input point InputIterator beyond, ///< past-the-end iterator - PointPMap point_pmap, ///< property map InputIterator -> Point_3 + PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3 unsigned int k) ///< number of neighbors. { typedef typename boost::property_traits::value_type Point; @@ -198,7 +198,7 @@ pca_smooth_point_set( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template void diff --git a/Point_set_processing_3/include/CGAL/property_map.h b/Point_set_processing_3/include/CGAL/property_map.h index 3e0701b41c4..2a27dbe5960 100644 --- a/Point_set_processing_3/include/CGAL/property_map.h +++ b/Point_set_processing_3/include/CGAL/property_map.h @@ -35,8 +35,12 @@ namespace CGAL { #ifndef CGAL_USE_OLD_PAIR_PROPERTY_MAPS -/// An alternative to boost::put_get_helper for: -/// - return type of `get` function is `const Reference` +/// \cond SKIP_IN_MANUAL + +/// An alternative to boost::put_get_helper for pmaps where key itself or a part of it returned as mapped value. +/// - Two `get` functions exist. +/// + One of them passes key by reference and returns mapped value as reference +/// + The other passes key by const reference, and returns mapped value as const reference /// - `key` is passed by reference in `put` function template struct put_get_helper_pass_key_by_reference { }; @@ -63,6 +67,7 @@ put(const put_get_helper_pass_key_by_reference& pa, K& k { static_cast(pa)[k] = v; } +/// \endcond #endif #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS @@ -100,16 +105,23 @@ make_dereference_property_map(Iter) #endif #ifndef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +/// \ingroup PkgProperty_map +/// Property map that maps a key to itself. +/// +/// \cgalModels `LvaluePropertyMap` template struct Typed_identity_property_map_by_reference : put_get_helper_pass_key_by_reference > { - typedef T key_type; - typedef T value_type; - typedef T& reference; - typedef boost::lvalue_property_map_tag category; - + typedef T key_type; ///< typedef to `T` + typedef T value_type; ///< typedef to `T` + typedef T& reference; ///< typedef to `T&` + typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag` + + /// Access a property map element. + /// @param v a key which is returned as mapped value. reference operator[](key_type& v) const { return v; } + /// Const version. const value_type& operator[](const key_type& v) const { return v; } }; @@ -138,7 +150,7 @@ struct First_of_pair_property_map : public boost::put_get_helper > { - typedef Pair* key_type; ///< typedef to 'Pair*' + typedef Pair* key_type; ///< typedef to `Pair*` typedef typename Pair::first_type value_type; ///< typedef to `Pair::first_type` typedef value_type& reference; ///< typedef to `value_type&` typedef boost::lvalue_property_map_tag category; ///< boost::lvalue_property_map_tag @@ -172,15 +184,15 @@ struct First_of_pair_property_map : put_get_helper_pass_key_by_reference > { - typedef Pair key_type; ///< typedef to 'Pair' + typedef Pair key_type; ///< typedef to `Pair` typedef typename Pair::first_type value_type; ///< typedef to `Pair::first_type` typedef value_type& reference; ///< typedef to `value_type&` typedef boost::lvalue_property_map_tag category; ///< boost::lvalue_property_map_tag /// Access a property map element. - /// - /// @tparam pair a key whose first item is accessed + /// @param pair a key whose first item is accessed reference operator[](key_type& pair) const { return pair.first; } + /// Const version. const value_type& operator[](const key_type& pair) const { return pair.first; } }; @@ -210,7 +222,7 @@ struct Second_of_pair_property_map : public boost::put_get_helper > { - typedef Pair* key_type; ///< typedef to 'Pair*' + typedef Pair* key_type; ///< typedef to `Pair*` typedef typename Pair::second_type value_type; ///< typedef to `Pair::second_type` typedef value_type& reference; ///< typedef to `value_type&` typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag` @@ -247,15 +259,15 @@ struct Second_of_pair_property_map : put_get_helper_pass_key_by_reference > { - typedef Pair key_type; ///< typedef to 'Pair' + typedef Pair key_type; ///< typedef to `Pair` typedef typename Pair::second_type value_type; ///< typedef to `Pair::first_type` typedef value_type& reference; ///< typedef to `value_type&` typedef boost::lvalue_property_map_tag category; ///< boost::lvalue_property_map_tag /// Access a property map element. - /// - /// @tparam pair a key whose second item is accessed + /// @param pair a key whose second item is accessed reference operator[](key_type& pair) const { return pair.second; } + /// Const version. const value_type& operator[](const key_type& pair) const { return pair.second; } }; @@ -288,7 +300,7 @@ struct Nth_of_tuple_property_map : public boost::put_get_helper::type&, Nth_of_tuple_property_map > { - typedef Tuple* key_type; ///< typedef to 'Tuple*' + typedef Tuple* key_type; ///< typedef to `Tuple*` typedef typename boost::tuples::element::type value_type; ///< typedef to `boost::tuples::element::%type` typedef value_type& reference; ///< typedef to `value_type&` typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag` @@ -324,15 +336,15 @@ struct Nth_of_tuple_property_map : put_get_helper_pass_key_by_reference::type&, Nth_of_tuple_property_map > { - typedef Tuple key_type; ///< typedef to 'Tuple' + typedef Tuple key_type; ///< typedef to `Tuple` typedef typename boost::tuples::element::type value_type; ///< typedef to `boost::tuples::element::%type` typedef value_type& reference; ///< typedef to `value_type&` typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag` /// Access a property map element. - /// - /// @tparam tuple a key whose Nth item is accessed + /// @param tuple a key whose Nth item is accessed reference operator[](key_type& tuple) const { return tuple.template get(); } + /// Const version. const value_type& operator[](const key_type& tuple) const { return tuple.template get(); } }; 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 bd6575df5c1..c98fccd0278 100644 --- a/Point_set_processing_3/include/CGAL/radial_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/radial_orient_normals.h @@ -58,8 +58,8 @@ ForwardIterator radial_orient_normals( ForwardIterator first, ///< iterator over the first input point. ForwardIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map ForwardIterator -> Point_3. - NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3. + PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3. + NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3. const Kernel& kernel) ///< geometric traits. { CGAL_TRACE("Calls radial_orient_normals()\n"); @@ -143,8 +143,8 @@ ForwardIterator radial_orient_normals( ForwardIterator first, ///< iterator over the first input point. ForwardIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map ForwardIterator -> Point_3. - NormalPMap normal_pmap) ///< property map ForwardIterator -> Vector_3. + PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3. + NormalPMap normal_pmap) ///< property map: value_type of ForwardIterator -> Vector_3. { typedef typename boost::property_traits::value_type Point; typedef typename Kernel_traits::Kernel Kernel; @@ -156,7 +156,7 @@ radial_orient_normals( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template @@ -164,7 +164,7 @@ ForwardIterator radial_orient_normals( ForwardIterator first, ///< iterator over the first input point. ForwardIterator beyond, ///< past-the-end iterator over the input points. - NormalPMap normal_pmap) ///< property map ForwardIterator -> Vector_3. + NormalPMap normal_pmap) ///< property map: value_type of ForwardIterator -> Vector_3. { return radial_orient_normals( first,beyond, diff --git a/Point_set_processing_3/include/CGAL/random_simplify_point_set.h b/Point_set_processing_3/include/CGAL/random_simplify_point_set.h index 8fd22197bdb..70d91d5c58e 100644 --- a/Point_set_processing_3/include/CGAL/random_simplify_point_set.h +++ b/Point_set_processing_3/include/CGAL/random_simplify_point_set.h @@ -54,7 +54,7 @@ ForwardIterator random_simplify_point_set( ForwardIterator first, ///< iterator over the first input point. ForwardIterator beyond, ///< past-the-end iterator over the input points. - PointPMap /*point_pmap*/, ///< property map ForwardIterator -> Point_3 + PointPMap /*point_pmap*/, ///< property map: value_type of ForwardIterator -> Point_3 double removed_percentage, ///< percentage of points to remove. const Kernel& /*kernel*/) ///< geometric traits. { @@ -81,7 +81,7 @@ ForwardIterator random_simplify_point_set( ForwardIterator first, ///< iterator over the first input point ForwardIterator beyond, ///< past-the-end iterator - PointPMap point_pmap, ///< property map ForwardIterator -> Point_3 + PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3 double removed_percentage) ///< percentage of points to remove { typedef typename boost::property_traits::value_type Point; @@ -95,7 +95,7 @@ random_simplify_point_set( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template ForwardIterator diff --git a/Point_set_processing_3/include/CGAL/remove_outliers.h b/Point_set_processing_3/include/CGAL/remove_outliers.h index e3d2b952192..9cb3c97c283 100644 --- a/Point_set_processing_3/include/CGAL/remove_outliers.h +++ b/Point_set_processing_3/include/CGAL/remove_outliers.h @@ -128,7 +128,7 @@ InputIterator remove_outliers( InputIterator first, ///< iterator over the first input point. InputIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map InputIterator -> Point_3 + PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3 unsigned int k, ///< number of neighbors. double threshold_percent, ///< percentage of points to remove. const Kernel& /*kernel*/) ///< geometric traits. @@ -215,7 +215,7 @@ InputIterator remove_outliers( InputIterator first, ///< iterator over the first input point InputIterator beyond, ///< past-the-end iterator - PointPMap point_pmap, ///< property map InputIterator -> Point_3 + PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3 unsigned int k, ///< number of neighbors. double threshold_percent) ///< percentage of points to remove { @@ -230,7 +230,7 @@ remove_outliers( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template InputIterator diff --git a/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h b/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h index b9f83e4c39d..3bfbb9b4970 100644 --- a/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h +++ b/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h @@ -125,7 +125,7 @@ InputIterator remove_outliers_wrt_median_knn_sq_distance( InputIterator first, ///< iterator over the first input point. InputIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map InputIterator -> Point_3 + PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3 unsigned int k, ///< number of neighbors. double threshold_percent, ///< percentage of points to remove. const Kernel& kernel) ///< geometric traits. @@ -213,7 +213,7 @@ InputIterator remove_outliers_wrt_median_knn_sq_distance( InputIterator first, ///< iterator over the first input point InputIterator beyond, ///< past-the-end iterator - PointPMap point_pmap, ///< property map InputIterator -> Point_3 + PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3 unsigned int k, ///< number of neighbors. double threshold_percent) ///< percentage of points to remove { @@ -228,7 +228,7 @@ remove_outliers_wrt_median_knn_sq_distance( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Dereference_property_map. +// This variant creates a default point property map = Typed_identity_property_map_by_reference. template InputIterator From 0af007775789e8d465322f5e84cbc29a47823c74 Mon Sep 17 00:00:00 2001 From: iyaz Date: Tue, 30 Apr 2013 17:14:44 +0300 Subject: [PATCH 11/63] Update examples: remove CGAL_USE_OLD_PAIR_PROPERTY_MAPS related parts --- .../Point_set_processing_3/property_map.cpp | 51 ++++--------------- .../remove_outliers_example.cpp | 31 ++++------- 2 files changed, 19 insertions(+), 63 deletions(-) diff --git a/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp b/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp index 57c424ad2cc..d965d06ecaa 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp @@ -6,10 +6,6 @@ //---------------------------------------------------------- // Usage: no parameters -//#define CGAL_USE_OLD_PAIR_PROPERTY_MAPS -// define CGAL_USE_OLD_PAIR_PROPERTY_MAPS for using previous property-maps which accept an iterator type as key type, -// new versions accept value_type of an iterator as key type - #include #include #include @@ -48,13 +44,7 @@ struct MyLess { bool operator()(const T& t0, const T& t1) const { - return -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - get(pmap, &t0) < get(pmap, &t1); -#else - get(pmap, t0) < get(pmap, t1); -#endif - + return get(pmap, t0) < get(pmap, t1); } }; @@ -77,12 +67,8 @@ template void process_point_set(Iterator beg, Iterator end) { process_point_set(beg,end, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - CGAL::make_dereference_property_map(beg) -#else CGAL::make_typed_identity_property_map_by_reference( - typename CGAL::value_type_traits::type()) -#endif + typename CGAL::value_type_traits::type()) ); } @@ -94,22 +80,12 @@ template ()); + points.end(), + CGAL::First_of_pair_property_map()); for(int i = 0; i < 10; i++){ std::cout << points[i].first << "\t" << points[i].second << std::endl; @@ -161,8 +137,8 @@ int main() } process_point_set(points.begin(), - points.end(), - CGAL::Nth_of_tuple_property_map<1,IndexedPointWithOrientableNormalTuple>()); + points.end(), + CGAL::Nth_of_tuple_property_map<1,IndexedPointWithOrientableNormalTuple>()); std::cout << boost::tuples::set_open('[') << boost::tuples::set_close(']') << boost::tuples::set_delimiter(','); @@ -172,17 +148,10 @@ int main() //We keep the sequence in order, but determine the normal and if it is different from zero set the Boolean to true orient_normals(points.begin(), - points.end(), -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - CGAL::make_nth_of_tuple_property_map<1>(points.begin()), - CGAL::make_nth_of_tuple_property_map<2>(points.begin()), - CGAL::make_nth_of_tuple_property_map<3>(points.begin()) -#else - CGAL::make_nth_of_tuple_property_map<1>(IndexedPointWithOrientableNormalTuple()), - CGAL::make_nth_of_tuple_property_map<2>(IndexedPointWithOrientableNormalTuple()), - CGAL::make_nth_of_tuple_property_map<3>(IndexedPointWithOrientableNormalTuple()) -#endif - ); + points.end(), + CGAL::make_nth_of_tuple_property_map<1>(IndexedPointWithOrientableNormalTuple()), + CGAL::make_nth_of_tuple_property_map<2>(IndexedPointWithOrientableNormalTuple()), + CGAL::make_nth_of_tuple_property_map<3>(IndexedPointWithOrientableNormalTuple())); std::cout << "\nAfter orient_normals\n"; for(int i = 0; i < 10; i++){ diff --git a/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp index bbc9ab4c6f7..4cbe7360cd2 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp @@ -1,7 +1,3 @@ -//#define CGAL_USE_OLD_PAIR_PROPERTY_MAPS -// define CGAL_USE_OLD_PAIR_PROPERTY_MAPS for using previous property-maps which accept an iterator type as key type, -// new versions accept value_type of an iterator as key type - #include #include #include @@ -17,38 +13,29 @@ typedef Kernel::Point_3 Point; int main(void) { // Reads a .xyz point set file in points[]. - // The Dereference_property_map property map can be omitted here as it is the default value. + // The Typed_identity_property_map_by_reference property map can be omitted here as it is the default value. std::vector points; std::ifstream stream("data/oni.xyz"); if (!stream || - !CGAL::read_xyz_points(stream, std::back_inserter(points), -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - CGAL::Dereference_property_map()) -#else - CGAL::Typed_identity_property_map_by_reference()) -#endif - ) + !CGAL::read_xyz_points(stream, std::back_inserter(points), + CGAL::Typed_identity_property_map_by_reference()) + ) { std::cerr << "Error: cannot read file data/oni.xyz" << std::endl; return EXIT_FAILURE; } // Removes outliers using erase-remove idiom. - // The Dereference_property_map property map can be omitted here as it is the default value. + // The Typed_identity_property_map_by_reference property map can be omitted here as it is the default value. const double removed_percentage = 5.0; // percentage of points to remove const int nb_neighbors = 24; // considers 24 nearest neighbor points points.erase(CGAL::remove_outliers(points.begin(), points.end(), -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - CGAL::Dereference_property_map(), -#else - CGAL::Typed_identity_property_map_by_reference(), -#endif - nb_neighbors, removed_percentage), - points.end()); + CGAL::Typed_identity_property_map_by_reference(), + nb_neighbors, removed_percentage), + points.end()); // Optional: after erase(), use Scott Meyer's "swap trick" to trim excess capacity std::vector(points).swap(points); return EXIT_SUCCESS; -} - +} \ No newline at end of file From 30a63a57c67a52eedf8851abe91a7a3bd43d390a Mon Sep 17 00:00:00 2001 From: iyaz Date: Tue, 30 Apr 2013 18:28:13 +0300 Subject: [PATCH 12/63] User manual updates --- .../doc/Point_set_processing_3/Point_set_processing_3.txt | 6 +++--- Point_set_processing_3/doc/Property_map/Property_map.txt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt b/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt index fb3fb5f0210..84909e1bcc9 100644 --- a/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt +++ b/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt @@ -61,11 +61,11 @@ The following classes described in Chapter \ref chapterProperty_map provide property maps for the implementations of points with normals listed above: -- `Dereference_property_map` +- `Typed_identity_property_map_by_reference` - `First_of_pair_property_map` and `Second_of_pair_property_map` - `Nth_of_tuple_property_map` -`Dereference_property_map` is the default value of the +`Typed_identity_property_map_by_reference` is the default value of the position property map expected by all functions in this component. See below examples using pair and tuple property maps. @@ -128,7 +128,7 @@ input points in increasing order of average squared distances to their \subsection Point_set_processing_3Example_2 Example The following example reads a point set and removes 5% of the -points. It uses the `Dereference_property_map` property +points. It uses the `Typed_identity_property_map_by_reference` property map (optional as it is the default position property map of all functions in this component.) \cgalExample{Point_set_processing_3/remove_outliers_example.cpp} diff --git a/Point_set_processing_3/doc/Property_map/Property_map.txt b/Point_set_processing_3/doc/Property_map/Property_map.txt index 876c71a58c3..9324fb514c2 100644 --- a/Point_set_processing_3/doc/Property_map/Property_map.txt +++ b/Point_set_processing_3/doc/Property_map/Property_map.txt @@ -35,15 +35,15 @@ or as a `boost::tuple<..,Point_3, ..., Vector_3 >`. This component provides property maps to support these cases: -`Dereference_property_map` +`Typed_identity_property_map_by_reference` `First_of_pair_property_map` and `Second_of_pair_property_map` `Nth_of_tuple_property_map` -\subsection Property_mapExamplewithDereferencepropertymap Example with Dereference_property_map +\subsection Property_mapExamplewithIdentity Example with Typed_identity_property_map_by_reference -The following example reads a point set and removes 5% of the points. It uses `Dereference_property_map` as position property map. +The following example reads a point set and removes 5% of the points. It uses `Typed_identity_property_map_by_reference` as position property map. \cgalExample{Point_set_processing_3/remove_outliers_example.cpp} \subsection Property_mapExamplewithPairs Example with Pairs From 041d702089e394b2d5ab54b03b28035ad40fb6b1 Mon Sep 17 00:00:00 2001 From: iyaz Date: Tue, 30 Apr 2013 18:28:39 +0300 Subject: [PATCH 13/63] Fix indentation --- .../average_spacing_example.cpp | 6 +++--- .../remove_outliers_example.cpp | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Point_set_processing_3/examples/Point_set_processing_3/average_spacing_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/average_spacing_example.cpp index fd2c681e7e2..3fba6dc804d 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/average_spacing_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/average_spacing_example.cpp @@ -47,9 +47,9 @@ int main(void) // Computes average spacing. const unsigned int nb_neighbors = 6; // 1 ring FT average_spacing = CGAL::compute_average_spacing( - points.begin(), points.end(), - CGAL::Nth_of_tuple_property_map<1,IndexedPointWithColorTuple>(), - nb_neighbors); + points.begin(), points.end(), + CGAL::Nth_of_tuple_property_map<1,IndexedPointWithColorTuple>(), + nb_neighbors); std::cout << "Average spacing: " << average_spacing << std::endl; return EXIT_SUCCESS; diff --git a/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp index 4cbe7360cd2..07a5febe322 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp @@ -17,9 +17,8 @@ int main(void) std::vector points; std::ifstream stream("data/oni.xyz"); if (!stream || - !CGAL::read_xyz_points(stream, std::back_inserter(points), - CGAL::Typed_identity_property_map_by_reference()) - ) + !CGAL::read_xyz_points(stream, std::back_inserter(points), + CGAL::Typed_identity_property_map_by_reference())) { std::cerr << "Error: cannot read file data/oni.xyz" << std::endl; return EXIT_FAILURE; @@ -30,9 +29,9 @@ int main(void) const double removed_percentage = 5.0; // percentage of points to remove const int nb_neighbors = 24; // considers 24 nearest neighbor points points.erase(CGAL::remove_outliers(points.begin(), points.end(), - CGAL::Typed_identity_property_map_by_reference(), - nb_neighbors, removed_percentage), - points.end()); + CGAL::Typed_identity_property_map_by_reference(), + nb_neighbors, removed_percentage), + points.end()); // Optional: after erase(), use Scott Meyer's "swap trick" to trim excess capacity std::vector(points).swap(points); From f8f922acca254a79e18f6e49dde607f78ea26340 Mon Sep 17 00:00:00 2001 From: iyaz Date: Wed, 1 May 2013 02:26:58 +0300 Subject: [PATCH 14/63] include changes for pmap --- .../CGAL/Poisson_reconstruction_function.h | 21 ++++++++++++------- .../CGAL/Reconstruction_triangulation_3.h | 21 +++++++++++++------ 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/Surface_reconstruction_points_3/include/CGAL/Poisson_reconstruction_function.h b/Surface_reconstruction_points_3/include/CGAL/Poisson_reconstruction_function.h index 8740b4b0cdc..998b9b165d9 100644 --- a/Surface_reconstruction_points_3/include/CGAL/Poisson_reconstruction_function.h +++ b/Surface_reconstruction_points_3/include/CGAL/Poisson_reconstruction_function.h @@ -295,8 +295,8 @@ public: Poisson_reconstruction_function( InputIterator first, ///< iterator over the first input point. InputIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map to access the position of an input point. - NormalPMap normal_pmap ///< property map to access the *oriented* normal of an input point. + PointPMap point_pmap, ///< property map: `value_type of InputIterator` -> `Point` (the position of an input point). + NormalPMap normal_pmap ///< property map: `value_type of InputIterator` -> `Vector` (the *oriented* normal of an input point). ) : m_tr(new Triangulation), m_Bary(new std::vector > ) , average_spacing(CGAL::compute_average_spacing(first, beyond, 6)) @@ -313,8 +313,8 @@ public: Poisson_reconstruction_function( InputIterator first, ///< iterator over the first input point. InputIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map to access the position of an input point. - NormalPMap normal_pmap, ///< property map to access the *oriented* normal of an input point. + PointPMap point_pmap, ///< property map: `value_type of InputIterator` -> `Point` (the position of an input point). + NormalPMap normal_pmap, ///< property map: `value_type of InputIterator` -> `Vector` (the *oriented* normal of an input point). Visitor visitor) : m_tr(new Triangulation), m_Bary(new std::vector > ) , average_spacing(CGAL::compute_average_spacing(first, beyond, 6)) @@ -322,14 +322,14 @@ public: forward_constructor(first, beyond, point_pmap, normal_pmap, visitor); } - // This variant creates a default point property map = Dereference_property_map and Visitor=Poisson_visitor + // This variant creates a default point property map = Typed_identity_property_map_by_reference and Visitor=Poisson_visitor template Poisson_reconstruction_function( InputIterator first, ///< iterator over the first input point. InputIterator beyond, ///< past-the-end iterator over the input points. - NormalPMap normal_pmap, ///< property map to access the *oriented* normal of an input point. + NormalPMap normal_pmap, ///< property map: `value_type of InputIterator` -> `Vector` (the *oriented* normal of an input point). typename boost::enable_if< boost::is_convertible >::type* = 0 @@ -337,7 +337,14 @@ public: : m_tr(new Triangulation), m_Bary(new std::vector > ) , average_spacing(CGAL::compute_average_spacing(first, beyond, 6)) { - forward_constructor(first, beyond, make_dereference_property_map(first), normal_pmap, Poisson_visitor()); + forward_constructor(first, beyond, +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + make_dereference_property_map(first), +#else + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()), +#endif + normal_pmap, Poisson_visitor()); CGAL::Timer task_timer; task_timer.start(); } /// \endcond diff --git a/Surface_reconstruction_points_3/include/CGAL/Reconstruction_triangulation_3.h b/Surface_reconstruction_points_3/include/CGAL/Reconstruction_triangulation_3.h index 843ed208729..aceccf952db 100644 --- a/Surface_reconstruction_points_3/include/CGAL/Reconstruction_triangulation_3.h +++ b/Surface_reconstruction_points_3/include/CGAL/Reconstruction_triangulation_3.h @@ -372,8 +372,8 @@ public: int insert( InputIterator first, ///< iterator over the first input point. InputIterator beyond, ///< past-the-end iterator over the input points. - PointPMap point_pmap, ///< property map to access the position of an input point. - NormalPMap normal_pmap, ///< property map to access the *oriented* normal of an input point. + PointPMap point_pmap, ///< property map: `value_type of InputIterator` -> `Point_3` (the position of an input point). + NormalPMap normal_pmap, ///< property map: `value_type of InputIterator` -> `Vector_3` (the *oriented* normal of an input point). Visitor visitor) { if(! points.empty()){ @@ -383,8 +383,12 @@ public: //std::vector points; for (InputIterator it = first; it != beyond; ++it) { - Point_with_normal pwn(get(point_pmap,it), get(normal_pmap,it)); - points.push_back(pwn); +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + Point_with_normal pwn(get(point_pmap,it), get(normal_pmap,it)); +#else + Point_with_normal pwn(get(point_pmap,*it), get(normal_pmap,*it)); +#endif + points.push_back(pwn); } int n = points.size(); @@ -435,7 +439,7 @@ public: } /// \cond SKIP_IN_MANUAL - // This variant creates a default point property map = Dereference_property_map. + // This variant creates a default point property map = Typed_identity_property_map_by_reference. template `Vector_3` (the *oriented* normal of an input point). Visitor visitor) { return insert( first,beyond, +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), +#else + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()), +#endif normal_pmap, visitor); } From 69a9ccbe534f65fed59553d79ba3b404007e5e5e Mon Sep 17 00:00:00 2001 From: iyaz Date: Wed, 1 May 2013 02:28:16 +0300 Subject: [PATCH 15/63] test changes for pmap --- .../poisson_reconstruction_test.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Surface_reconstruction_points_3/test/Surface_reconstruction_points_3/poisson_reconstruction_test.cpp b/Surface_reconstruction_points_3/test/Surface_reconstruction_points_3/poisson_reconstruction_test.cpp index d685c3cce4b..a026a2b68c8 100644 --- a/Surface_reconstruction_points_3/test/Surface_reconstruction_points_3/poisson_reconstruction_test.cpp +++ b/Surface_reconstruction_points_3/test/Surface_reconstruction_points_3/poisson_reconstruction_test.cpp @@ -1,3 +1,4 @@ +//#define CGAL_USE_OLD_PAIR_PROPERTY_MAPS // poisson_reconstruction_test.cpp //---------------------------------------------------------- @@ -145,7 +146,12 @@ int main(int argc, char * argv[]) !CGAL::read_xyz_points_and_normals( stream, std::back_inserter(points), - CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(points)))) +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(points)) +#else + CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()) +#endif + )) { std::cerr << "Error: cannot read file " << input_filename << std::endl; accumulated_fatal_err = EXIT_FAILURE; @@ -201,7 +207,12 @@ int main(int argc, char * argv[]) // The position property map can be omitted here as we use iterators over Point_3 elements. Poisson_reconstruction_function function( points.begin(), points.end(), - CGAL::make_normal_of_point_with_normal_pmap(points.begin()) ); +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + CGAL::make_normal_of_point_with_normal_pmap(points.begin()) +#else + CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()) +#endif + ); // Computes the Poisson indicator function f() // at each vertex of the triangulation. From 1a70a5121fcaea5d36b27b4e743605edd1056185 Mon Sep 17 00:00:00 2001 From: iyaz Date: Wed, 1 May 2013 02:29:11 +0300 Subject: [PATCH 16/63] example changes for pmap --- .../poisson_reconstruction.cpp | 6 +++--- .../poisson_reconstruction_example.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Surface_reconstruction_points_3/examples/Surface_reconstruction_points_3/poisson_reconstruction.cpp b/Surface_reconstruction_points_3/examples/Surface_reconstruction_points_3/poisson_reconstruction.cpp index 1c09392c928..4975fa69f9e 100644 --- a/Surface_reconstruction_points_3/examples/Surface_reconstruction_points_3/poisson_reconstruction.cpp +++ b/Surface_reconstruction_points_3/examples/Surface_reconstruction_points_3/poisson_reconstruction.cpp @@ -214,7 +214,7 @@ int main(int argc, char * argv[]) !CGAL::read_xyz_points_and_normals( stream, std::back_inserter(points), - CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(points)))) + CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()))) { std::cerr << "Error: cannot read file " << input_filename << std::endl; return EXIT_FAILURE; @@ -269,8 +269,8 @@ int main(int argc, char * argv[]) // The position property map can be omitted here as we use iterators over Point_3 elements. Poisson_reconstruction_function function( points.begin(), points.end(), - CGAL::make_dereference_property_map(points.begin()), - CGAL::make_normal_of_point_with_normal_pmap(points.begin()), + CGAL::make_typed_identity_property_map_by_reference(PointList::value_type()), + CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()), visitor); #ifdef CGAL_TAUCS_ENABLED diff --git a/Surface_reconstruction_points_3/examples/Surface_reconstruction_points_3/poisson_reconstruction_example.cpp b/Surface_reconstruction_points_3/examples/Surface_reconstruction_points_3/poisson_reconstruction_example.cpp index a892132a5f8..4746f3bdd60 100644 --- a/Surface_reconstruction_points_3/examples/Surface_reconstruction_points_3/poisson_reconstruction_example.cpp +++ b/Surface_reconstruction_points_3/examples/Surface_reconstruction_points_3/poisson_reconstruction_example.cpp @@ -45,7 +45,7 @@ int main(void) !CGAL::read_xyz_points_and_normals( stream, std::back_inserter(points), - CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(points)))) + CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()))) { std::cerr << "Error: cannot read file data/kitten.xyz" << std::endl; return EXIT_FAILURE; @@ -57,7 +57,7 @@ int main(void) // + property maps to access each point's position and normal. // The position property map can be omitted here as we use iterators over Point_3 elements. Poisson_reconstruction_function function(points.begin(), points.end(), - CGAL::make_normal_of_point_with_normal_pmap(points.begin()) ); + CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()) ); // Computes the Poisson indicator function f() // at each vertex of the triangulation. From 8b575f179e2b1525757a3c2e173db62c740cbd29 Mon Sep 17 00:00:00 2001 From: iyaz Date: Wed, 1 May 2013 02:40:42 +0300 Subject: [PATCH 17/63] one more get function is added for handling key types which are not "key_type" but convertible --- .../include/CGAL/property_map.h | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/property_map.h b/Point_set_processing_3/include/CGAL/property_map.h index 2a27dbe5960..2948b355dfa 100644 --- a/Point_set_processing_3/include/CGAL/property_map.h +++ b/Point_set_processing_3/include/CGAL/property_map.h @@ -46,20 +46,33 @@ template struct put_get_helper_pass_key_by_reference { }; // this is required since LValuePM should have get which returns reference -template +template inline Reference +get(const put_get_helper_pass_key_by_reference& pa, + typename PropertyMap::key_type& k) +{ + return Reference(static_cast(pa)[k]); +} + +// this is also required because some of the functions pass const ref parameters +template +inline const typename PropertyMap::value_type& +get(const put_get_helper_pass_key_by_reference& pa, + const typename PropertyMap::key_type& k) +{ + return static_cast(pa)[k]; +} + +// this is also required to support key types different then key_type (i.e. key types that are convertible to key_type) +// return type can not be non-const since a temp is constructed +template +inline const typename PropertyMap::value_type& get(const put_get_helper_pass_key_by_reference& pa, K& k) { return static_cast(pa)[k]; } -// this is also required because some of the functions pass const ref parameters -template -inline const typename PropertyMap::value_type& -get(const put_get_helper_pass_key_by_reference& pa, const K& k) -{ - return static_cast(pa)[k]; -} + template inline void From 07bf1ef8d2e7b1e296557326d58f46b391c18d7a Mon Sep 17 00:00:00 2001 From: iyaz Date: Wed, 1 May 2013 03:08:40 +0300 Subject: [PATCH 18/63] forgotten cast removed --- Point_set_processing_3/include/CGAL/property_map.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Point_set_processing_3/include/CGAL/property_map.h b/Point_set_processing_3/include/CGAL/property_map.h index 2948b355dfa..1541b6eb87e 100644 --- a/Point_set_processing_3/include/CGAL/property_map.h +++ b/Point_set_processing_3/include/CGAL/property_map.h @@ -51,7 +51,7 @@ inline Reference get(const put_get_helper_pass_key_by_reference& pa, typename PropertyMap::key_type& k) { - return Reference(static_cast(pa)[k]); + return static_cast(pa)[k]; } // this is also required because some of the functions pass const ref parameters From 8e38300002a041f92f4f8554a0b8db1d8ae55473 Mon Sep 17 00:00:00 2001 From: iyaz Date: Wed, 1 May 2013 04:06:33 +0300 Subject: [PATCH 19/63] Change of mind: to keep helper simpler I removed an extra get function added for supporting key types which are not actually key_type ( We only need that functionality inside Normal_of_point_with_normal_pmap, so made required changes in there) --- .../include/CGAL/Point_with_normal_3.h | 8 ++++++-- .../include/CGAL/property_map.h | 19 ++++--------------- 2 files changed, 10 insertions(+), 17 deletions(-) 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 19a9a5ef024..873a4236959 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 @@ -151,8 +151,12 @@ struct Normal_of_point_with_normal_pmap typedef boost::lvalue_property_map_tag category; /// Access a property map element. - reference operator[](key_type& pair) const { return pair.normal(); } - const value_type& operator[](const key_type& pair) const { return pair.normal(); } + /// Key types are need to be templated for backward compatibility (i.e. keys which are not type of key_type need to be accepted) + template + reference operator[](K& pair) const { return pair.normal(); } + template + const value_type& operator[](const K& pair) const { return pair.normal(); } + }; /// Free function to create a Normal_of_point_with_normal_pmap property map. diff --git a/Point_set_processing_3/include/CGAL/property_map.h b/Point_set_processing_3/include/CGAL/property_map.h index 1541b6eb87e..2e5daca4e17 100644 --- a/Point_set_processing_3/include/CGAL/property_map.h +++ b/Point_set_processing_3/include/CGAL/property_map.h @@ -46,34 +46,23 @@ template struct put_get_helper_pass_key_by_reference { }; // this is required since LValuePM should have get which returns reference -template +template inline Reference get(const put_get_helper_pass_key_by_reference& pa, - typename PropertyMap::key_type& k) + K& k) { return static_cast(pa)[k]; } // this is also required because some of the functions pass const ref parameters -template -inline const typename PropertyMap::value_type& -get(const put_get_helper_pass_key_by_reference& pa, - const typename PropertyMap::key_type& k) -{ - return static_cast(pa)[k]; -} - -// this is also required to support key types different then key_type (i.e. key types that are convertible to key_type) -// return type can not be non-const since a temp is constructed template inline const typename PropertyMap::value_type& -get(const put_get_helper_pass_key_by_reference& pa, K& k) +get(const put_get_helper_pass_key_by_reference& pa, + const K& k) { return static_cast(pa)[k]; } - - template inline void put(const put_get_helper_pass_key_by_reference& pa, K& k, const V& v) From f8f57d865310b4dda3e655ceec0cd60495eaa33f Mon Sep 17 00:00:00 2001 From: iyaz Date: Thu, 2 May 2013 15:40:25 +0300 Subject: [PATCH 20/63] Spatial_sorting example updated to use First_of_pair_property_map --- .../sp_sort_using_property_map_2.cpp | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/Spatial_sorting/examples/Spatial_sorting/sp_sort_using_property_map_2.cpp b/Spatial_sorting/examples/Spatial_sorting/sp_sort_using_property_map_2.cpp index cffcfd2f980..ebc176f3df5 100644 --- a/Spatial_sorting/examples/Spatial_sorting/sp_sort_using_property_map_2.cpp +++ b/Spatial_sorting/examples/Spatial_sorting/sp_sort_using_property_map_2.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include typedef CGAL::Simple_cartesian Kernel; @@ -8,21 +9,9 @@ typedef Kernel::Point_2 Point_2; typedef std::pair Point_with_info; typedef std::vector< Point_with_info > Data_vector; -//property map -struct First_of_pair{ - //classical typedefs - typedef Point_with_info key_type; - typedef Point_2 value_type; - typedef const Point_2& reference; - typedef boost::readable_property_map_tag category; -}; -//get function for property map -First_of_pair::reference -get(const First_of_pair&, const First_of_pair::key_type& k) { - return k.first; -} - -typedef CGAL::Spatial_sort_traits_adapter_2 Search_traits_2; +typedef CGAL::Spatial_sort_traits_adapter_2 +> Search_traits_2; int main() { From d480e2544e60b4705378a4e876199fc716dafa3a Mon Sep 17 00:00:00 2001 From: iyaz Date: Thu, 2 May 2013 15:59:36 +0300 Subject: [PATCH 21/63] change in example, use Nth_of_tuple_property_map --- .../searching_with_point_with_info.cpp | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/Spatial_searching/examples/Spatial_searching/searching_with_point_with_info.cpp b/Spatial_searching/examples/Spatial_searching/searching_with_point_with_info.cpp index 0438c70c459..40925cd6beb 100644 --- a/Spatial_searching/examples/Spatial_searching/searching_with_point_with_info.cpp +++ b/Spatial_searching/examples/Spatial_searching/searching_with_point_with_info.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -11,23 +12,11 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef Kernel::Point_3 Point_3; typedef boost::tuple Point_and_int; -//definition of the property map -struct My_point_property_map{ - typedef Point_3 value_type; - typedef const value_type& reference; - typedef const Point_and_int& key_type; - typedef boost::readable_property_map_tag category; -}; - -//get function for the property map -My_point_property_map::reference -get(My_point_property_map,My_point_property_map::key_type p) -{return boost::get<0>(p);} - - typedef CGAL::Random_points_in_cube_3 Random_points_iterator; typedef CGAL::Search_traits_3 Traits_base; -typedef CGAL::Search_traits_adapter Traits; +typedef CGAL::Search_traits_adapter, + Traits_base> Traits; typedef CGAL::Orthogonal_k_neighbor_search K_neighbor_search; From 19098f786c08987d639195a8cda1803d97004312 Mon Sep 17 00:00:00 2001 From: iyaz Date: Thu, 2 May 2013 16:51:41 +0300 Subject: [PATCH 22/63] List Dereference_property_map in Property_map user manual (note that we do not have an example for that) --- Point_set_processing_3/doc/Property_map/Property_map.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Point_set_processing_3/doc/Property_map/Property_map.txt b/Point_set_processing_3/doc/Property_map/Property_map.txt index 9324fb514c2..d03bd57f933 100644 --- a/Point_set_processing_3/doc/Property_map/Property_map.txt +++ b/Point_set_processing_3/doc/Property_map/Property_map.txt @@ -41,6 +41,8 @@ This component provides property maps to support these cases: `Nth_of_tuple_property_map` +`Dereference_property_map` + \subsection Property_mapExamplewithIdentity Example with Typed_identity_property_map_by_reference The following example reads a point set and removes 5% of the points. It uses `Typed_identity_property_map_by_reference` as position property map. From 85899e5e27f89037f477d5adc1048706d3e25bfb Mon Sep 17 00:00:00 2001 From: iyaz Date: Thu, 2 May 2013 16:53:22 +0300 Subject: [PATCH 23/63] Do not remove Dereference_property_map (previously deactivated with a macro) --- Point_set_processing_3/include/CGAL/property_map.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/property_map.h b/Point_set_processing_3/include/CGAL/property_map.h index 2e5daca4e17..c00967bef90 100644 --- a/Point_set_processing_3/include/CGAL/property_map.h +++ b/Point_set_processing_3/include/CGAL/property_map.h @@ -34,7 +34,6 @@ namespace CGAL { -#ifndef CGAL_USE_OLD_PAIR_PROPERTY_MAPS /// \cond SKIP_IN_MANUAL /// An alternative to boost::put_get_helper for pmaps where key itself or a part of it returned as mapped value. @@ -70,9 +69,7 @@ put(const put_get_helper_pass_key_by_reference& pa, K& k static_cast(pa)[k] = v; } /// \endcond -#endif -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS /// \ingroup PkgProperty_map /// Property map that converts a `T*` pointer (or in general an iterator /// over `T` elements) to the `T` object. @@ -104,9 +101,7 @@ make_dereference_property_map(Iter) // value_type_traits is a workaround as back_insert_iterator's `value_type` is void return Dereference_property_map::type>(); } -#endif -#ifndef CGAL_USE_OLD_PAIR_PROPERTY_MAPS /// \ingroup PkgProperty_map /// Property map that maps a key to itself. /// @@ -136,7 +131,6 @@ Typed_identity_property_map_by_reference { return Typed_identity_property_map_by_reference(); } -#endif //========================================================================= From 47084771afe195182617636515468717c84ddfc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 3 May 2013 09:36:08 +0200 Subject: [PATCH 24/63] remove put_get_helper_pass_key_by_reference, using friend put/get functions it is more clear to see what is going on --- .../include/CGAL/Point_with_normal_3.h | 13 +--- .../include/CGAL/property_map.h | 75 +++++-------------- 2 files changed, 22 insertions(+), 66 deletions(-) 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 873a4236959..da27cad942e 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 @@ -139,8 +139,6 @@ private: template struct Normal_of_point_with_normal_pmap - : put_get_helper_pass_key_by_reference > { typedef Point_with_normal_3 Point_with_normal; ///< Position + normal typedef typename Gt::Vector_3 Vector; /// normal @@ -150,13 +148,10 @@ struct Normal_of_point_with_normal_pmap typedef value_type& reference; typedef boost::lvalue_property_map_tag category; - /// Access a property map element. - /// Key types are need to be templated for backward compatibility (i.e. keys which are not type of key_type need to be accepted) - template - reference operator[](K& pair) const { return pair.normal(); } - template - const value_type& operator[](const K& pair) const { return pair.normal(); } - + /// put/get free functions + typedef Normal_of_point_with_normal_pmap Self; + friend const value_type& 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;} }; /// Free function to create a Normal_of_point_with_normal_pmap property map. diff --git a/Point_set_processing_3/include/CGAL/property_map.h b/Point_set_processing_3/include/CGAL/property_map.h index c00967bef90..4956ec2ebba 100644 --- a/Point_set_processing_3/include/CGAL/property_map.h +++ b/Point_set_processing_3/include/CGAL/property_map.h @@ -36,40 +36,6 @@ namespace CGAL { /// \cond SKIP_IN_MANUAL -/// An alternative to boost::put_get_helper for pmaps where key itself or a part of it returned as mapped value. -/// - Two `get` functions exist. -/// + One of them passes key by reference and returns mapped value as reference -/// + The other passes key by const reference, and returns mapped value as const reference -/// - `key` is passed by reference in `put` function -template -struct put_get_helper_pass_key_by_reference { }; - -// this is required since LValuePM should have get which returns reference -template -inline Reference -get(const put_get_helper_pass_key_by_reference& pa, - K& k) -{ - return static_cast(pa)[k]; -} - -// this is also required because some of the functions pass const ref parameters -template -inline const typename PropertyMap::value_type& -get(const put_get_helper_pass_key_by_reference& pa, - const K& k) -{ - return static_cast(pa)[k]; -} - -template -inline void -put(const put_get_helper_pass_key_by_reference& pa, K& k, const V& v) -{ - static_cast(pa)[k] = v; -} -/// \endcond - /// \ingroup PkgProperty_map /// Property map that converts a `T*` pointer (or in general an iterator /// over `T` elements) to the `T` object. @@ -108,18 +74,16 @@ make_dereference_property_map(Iter) /// \cgalModels `LvaluePropertyMap` template struct Typed_identity_property_map_by_reference - : put_get_helper_pass_key_by_reference > { typedef T key_type; ///< typedef to `T` typedef T value_type; ///< typedef to `T` typedef T& reference; ///< typedef to `T&` typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag` - - /// Access a property map element. - /// @param v a key which is returned as mapped value. - reference operator[](key_type& v) const { return v; } - /// Const version. - const value_type& operator[](const key_type& v) const { return v; } + + /// put/get free functions + typedef Typed_identity_property_map_by_reference Self; + friend const value_type& get(const Self&,const key_type& k) {return k;} + friend void put(const Self&,key_type& k, const value_type& v) {k=v;} }; /// Free function to create a `Typed_identity_property_map_by_reference` property map. @@ -177,8 +141,6 @@ First_of_pair_property_map::type> /// \sa `CGAL::Second_of_pair_property_map` template struct First_of_pair_property_map - : put_get_helper_pass_key_by_reference > { typedef Pair key_type; ///< typedef to `Pair` typedef typename Pair::first_type value_type; ///< typedef to `Pair::first_type` @@ -190,6 +152,11 @@ struct First_of_pair_property_map reference operator[](key_type& pair) const { return pair.first; } /// Const version. const value_type& operator[](const key_type& pair) const { return pair.first; } + + /// put/get free functions + typedef First_of_pair_property_map Self; + friend const value_type& get(const Self&,const key_type& k) {return k.first;} + friend void put(const Self&,key_type& k, const value_type& v) {k.first=v;} }; /// Free function to create a `First_of_pair_property_map` property map. @@ -252,19 +219,16 @@ Second_of_pair_property_map::type> /// \sa `CGAL::First_of_pair_property_map` template struct Second_of_pair_property_map - : put_get_helper_pass_key_by_reference > { typedef Pair key_type; ///< typedef to `Pair` typedef typename Pair::second_type value_type; ///< typedef to `Pair::first_type` typedef value_type& reference; ///< typedef to `value_type&` typedef boost::lvalue_property_map_tag category; ///< boost::lvalue_property_map_tag - /// Access a property map element. - /// @param pair a key whose second item is accessed - reference operator[](key_type& pair) const { return pair.second; } - /// Const version. - const value_type& operator[](const key_type& pair) const { return pair.second; } + /// put/get free functions + typedef Second_of_pair_property_map Self; + friend const value_type& get(const Self&,const key_type& k) {return k.second;} + friend void put(const Self&,key_type& k, const value_type& v) {k.second=v;} }; /// Free function to create a Second_of_pair_property_map property map. @@ -329,19 +293,16 @@ Nth_of_tuple_property_map::type> /// \cgalModels `LvaluePropertyMap` template struct Nth_of_tuple_property_map - : put_get_helper_pass_key_by_reference::type&, - Nth_of_tuple_property_map > { typedef Tuple key_type; ///< typedef to `Tuple` typedef typename boost::tuples::element::type value_type; ///< typedef to `boost::tuples::element::%type` typedef value_type& reference; ///< typedef to `value_type&` typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag` - /// Access a property map element. - /// @param tuple a key whose Nth item is accessed - reference operator[](key_type& tuple) const { return tuple.template get(); } - /// Const version. - const value_type& operator[](const key_type& tuple) const { return tuple.template get(); } + /// put/get free functions + typedef Nth_of_tuple_property_map Self; + friend const value_type& get(const Self&,const key_type& k) {return get(k);} + friend void put(const Self&, key_type& k, const value_type& v) {get(k)=v;} }; /// Free function to create a Nth_of_tuple_property_map property map. From 1284566438176b5739e07ae3f3a6f2620be6c076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 3 May 2013 09:43:20 +0200 Subject: [PATCH 25/63] Bug-fix: a get is not guarantee to return a reference. put should be used ... ... for overwritting the value --- .../Point_set_processing_3/property_map.cpp | 7 ++-- .../include/CGAL/IO/write_xyz_points.h | 4 +-- .../include/CGAL/jet_smooth_point_set.h | 9 +++-- .../include/CGAL/mst_orient_normals.h | 34 ++++++++++++------- 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp b/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp index d965d06ecaa..9f0fdf0a1dd 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp @@ -77,15 +77,14 @@ void process_point_set(Iterator beg, Iterator end) // Here comes a function that changes the orientation and the normal template -void orient_normals(Iterator beg, Iterator end, PointPMap point_pmap, OrientationPMap orient_pmap, NormalPMap normal_pmap) +void orient_normals(Iterator beg, Iterator end, PointPMap, OrientationPMap orient_pmap, NormalPMap normal_pmap) { for(;beg!= end;++beg){ - Vector_3& v = get(normal_pmap, *beg); + const Vector_3& v = get(normal_pmap, *beg); put(orient_pmap, *beg, (v == CGAL::NULL_VECTOR)); if(v.x() < 0){ - v = -v; - put(normal_pmap,*beg, v); + put(normal_pmap,*beg, -v); } } } 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 5355784c38b..52072d10c7c 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 @@ -131,7 +131,7 @@ write_xyz_points_and_normals( std::ostream& stream, ///< output stream. ForwardIterator first, ///< first input point. ForwardIterator beyond, ///< past-the-end input point. - NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3. + NormalPMap normal_pmap) ///< property map: value_type of ForwardIterator -> Vector_3. { return write_xyz_points_and_normals( stream, @@ -139,7 +139,7 @@ write_xyz_points_and_normals( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(output), #else - Typed_identity_property_map_by_reference::type>(), + Typed_identity_property_map_by_reference::type>(), #endif normal_pmap); } 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 133e262c614..13536e743c1 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 @@ -172,11 +172,14 @@ jet_smooth_point_set( for(it = first; it != beyond; it++) { #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - Point& p = get(point_pmap, it); + const Point& p = get(point_pmap, it); + put(point_pmap, it , + internal::jet_smooth_point(p,tree,k,degree_fitting,degree_monge) ); #else - Point& p = get(point_pmap, *it); + const Point& p = get(point_pmap, *it); + put(point_pmap, *it , + internal::jet_smooth_point(p,tree,k,degree_fitting,degree_monge) ); #endif - p = 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 955fee2a131..c9f0a394110 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -159,28 +159,32 @@ struct Propagate_normal_orientation // Gets source normal vertex_descriptor source_vertex = boost::source(edge, mst_graph); #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - const Vector source_normal = mst_graph.m_normal_pmap[mst_graph[source_vertex].input_point]; - const bool source_normal_is_oriented = mst_graph[source_vertex].is_oriented; + const Vector source_normal = get(mst_graph.m_normal_pmap, mst_graph[source_vertex].input_point); #else - const Vector source_normal = mst_graph.m_normal_pmap[*(mst_graph[source_vertex].input_point)]; - const bool source_normal_is_oriented = mst_graph[source_vertex].is_oriented; + const Vector source_normal = get(mst_graph.m_normal_pmap, *(mst_graph[source_vertex].input_point) ); #endif + const bool source_normal_is_oriented = mst_graph[source_vertex].is_oriented; // Gets target normal vertex_descriptor target_vertex = boost::target(edge, mst_graph); #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - Vector& target_normal = mst_graph.m_normal_pmap[mst_graph[target_vertex].input_point]; - bool& target_normal_is_oriented = ((MST_graph&)mst_graph)[target_vertex].is_oriented; + const Vector& target_normal = get( mst_graph.m_normal_pmap, mst_graph[target_vertex].input_point); #else - Vector& target_normal = mst_graph.m_normal_pmap[*(mst_graph[target_vertex].input_point)]; - bool& target_normal_is_oriented = ((MST_graph&)mst_graph)[target_vertex].is_oriented; + const Vector& target_normal = get( mst_graph.m_normal_pmap, *(mst_graph[target_vertex].input_point) ); #endif + bool& target_normal_is_oriented = ((MST_graph&)mst_graph)[target_vertex].is_oriented; if ( ! target_normal_is_oriented ) { // -> -> // Orients target_normal parallel to source_normal double normals_dot = source_normal * target_normal; if (normals_dot < 0) - target_normal = -target_normal; + { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + put( mst_graph.m_normal_pmap, mst_graph[target_vertex].input_point, -target_normal); +#else + put( mst_graph.m_normal_pmap, *(mst_graph[target_vertex].input_point), -target_normal ); +#endif + } // Is orientation robust? target_normal_is_oriented @@ -243,14 +247,18 @@ mst_find_source( // Orients its normal towards +Z axis #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - Vector& normal = get(normal_pmap,top_point); + const Vector& normal = get(normal_pmap,top_point); #else - Vector& normal = get(normal_pmap,*top_point); -#endif + const Vector& normal = get(normal_pmap,*top_point); +#endif const Vector Z(0, 0, 1); if (Z * normal < 0) { CGAL_TRACE(" Flip top point normal\n"); - normal = -normal; +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + put(normal_pmap,top_point, -normal); +#else + put(normal_pmap,*top_point, -normal); +#endif } return top_point; From fb6dafd656cd29202b1098232e800c9657453bea Mon Sep 17 00:00:00 2001 From: iyaz Date: Fri, 3 May 2013 17:58:15 +0300 Subject: [PATCH 26/63] Propery maps (making Lvalue) --- .../include/CGAL/Point_with_normal_3.h | 8 ++++- .../include/CGAL/property_map.h | 36 ++++++++++++++----- 2 files changed, 34 insertions(+), 10 deletions(-) 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 da27cad942e..403cb18f3cb 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 @@ -148,10 +148,16 @@ struct Normal_of_point_with_normal_pmap typedef value_type& reference; typedef boost::lvalue_property_map_tag category; - /// put/get free functions + /// Access a property map element + reference 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 void put(const Self&,key_type& k, const value_type& v) {k.normal()=v;} + /// @};} }; /// Free function to create a Normal_of_point_with_normal_pmap property map. diff --git a/Point_set_processing_3/include/CGAL/property_map.h b/Point_set_processing_3/include/CGAL/property_map.h index 4956ec2ebba..d98984bbde2 100644 --- a/Point_set_processing_3/include/CGAL/property_map.h +++ b/Point_set_processing_3/include/CGAL/property_map.h @@ -34,8 +34,6 @@ namespace CGAL { -/// \cond SKIP_IN_MANUAL - /// \ingroup PkgProperty_map /// Property map that converts a `T*` pointer (or in general an iterator /// over `T` elements) to the `T` object. @@ -79,11 +77,17 @@ struct Typed_identity_property_map_by_reference typedef T value_type; ///< typedef to `T` typedef T& reference; ///< typedef to `T&` typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag` + /// Access a property map element. + /// @param v a key which is returned as mapped value. + reference operator[](key_type& k) const { return k; } - /// put/get free functions typedef Typed_identity_property_map_by_reference Self; + /// \name Put/get free functions + /// @{ friend const value_type& get(const Self&,const key_type& k) {return k;} + friend reference get(const Self&, key_type& k) {return k;} friend void put(const Self&,key_type& k, const value_type& v) {k=v;} + /// @} }; /// Free function to create a `Typed_identity_property_map_by_reference` property map. @@ -150,13 +154,14 @@ struct First_of_pair_property_map /// Access a property map element. /// @param pair a key whose first item is accessed reference operator[](key_type& pair) const { return pair.first; } - /// Const version. - const value_type& operator[](const key_type& pair) const { return pair.first; } - /// put/get free functions typedef First_of_pair_property_map Self; + /// \name Put/get free functions + /// @{ friend const value_type& get(const Self&,const key_type& k) {return k.first;} + friend reference get(const Self&, key_type& k) {return k.first;} friend void put(const Self&,key_type& k, const value_type& v) {k.first=v;} + /// @} }; /// Free function to create a `First_of_pair_property_map` property map. @@ -225,10 +230,17 @@ struct Second_of_pair_property_map typedef value_type& reference; ///< typedef to `value_type&` typedef boost::lvalue_property_map_tag category; ///< boost::lvalue_property_map_tag - /// put/get free functions + /// Access a property map element. + /// @param pair a key whose second item is accessed + reference operator[](key_type& pair) const { return pair.second; } + typedef Second_of_pair_property_map Self; + /// \name Put/get free functions + /// @{ friend const value_type& get(const Self&,const key_type& k) {return k.second;} + friend reference get(const Self&, key_type& k) {return k.second;} friend void put(const Self&,key_type& k, const value_type& v) {k.second=v;} + /// @} }; /// Free function to create a Second_of_pair_property_map property map. @@ -298,11 +310,17 @@ struct Nth_of_tuple_property_map typedef typename boost::tuples::element::type value_type; ///< typedef to `boost::tuples::element::%type` typedef value_type& reference; ///< typedef to `value_type&` typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag` + /// Access a property map element. + /// @param tuple a key whose Nth item is accessed + reference operator[](key_type& tuple) const { return get(tuple); } - /// put/get free functions typedef Nth_of_tuple_property_map Self; + /// \name Put/get free functions + /// @{ friend const value_type& get(const Self&,const key_type& k) {return get(k);} - friend void put(const Self&, key_type& k, const value_type& v) {get(k)=v;} + friend reference get(const Self&, key_type& k) {return get(k);} + friend void put(const Self&,key_type& k, const value_type& v) {get(k)=v;} + /// @} }; /// Free function to create a Nth_of_tuple_property_map property map. From db31047a13fd4c59af0eacb91a51cffc9fcec8bc Mon Sep 17 00:00:00 2001 From: iyaz Date: Fri, 3 May 2013 18:24:10 +0300 Subject: [PATCH 27/63] Documentation changes in Point_set / include: change all documentation references to boost pmaps to proxy CGAL concepts --- .../include/CGAL/IO/read_off_points.h | 6 ++--- .../include/CGAL/IO/read_xyz_points.h | 6 ++--- .../include/CGAL/IO/write_off_points.h | 6 ++--- .../include/CGAL/IO/write_xyz_points.h | 6 ++--- .../include/CGAL/Index_property_map.h | 2 +- .../include/CGAL/Point_with_normal_3.h | 4 ++-- .../include/CGAL/compute_average_spacing.h | 2 +- .../include/CGAL/grid_simplify_point_set.h | 2 +- .../CGAL/improved_jet_smooth_point_set.h | 2 +- .../improved_laplacian_smooth_point_set.h | 2 +- .../include/CGAL/jet_estimate_normals.h | 4 ++-- .../include/CGAL/jet_smooth_point_set.h | 2 +- .../include/CGAL/mst_orient_normals.h | 22 +++++++++---------- .../include/CGAL/pca_estimate_normals.h | 4 ++-- .../include/CGAL/pca_smooth_point_set.h | 2 +- .../include/CGAL/radial_orient_normals.h | 4 ++-- .../include/CGAL/random_simplify_point_set.h | 2 +- .../include/CGAL/remove_outliers.h | 2 +- ...move_outliers_wrt_median_knn_sq_distance.h | 2 +- 19 files changed, 41 insertions(+), 41 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/IO/read_off_points.h b/Point_set_processing_3/include/CGAL/IO/read_off_points.h index c7754d8b639..d79529af62c 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_off_points.h @@ -46,9 +46,9 @@ namespace CGAL { /// Faces are ignored. /// /// @tparam OutputIterator iterator over output points. -/// @tparam PointPMap is a model of boost::WritablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `WritablePropertyMap` with a value_type = Point_3. /// It can be omitted if OutputIterator value_type is convertible to Point_3. -/// @tparam NormalPMap is a model of boost::WritablePropertyMap with a value_type = Vector_3. +/// @tparam NormalPMap is a model of `WritablePropertyMap` with a value_type = Vector_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. /// @@ -216,7 +216,7 @@ read_off_points_and_normals( /// Faces are ignored. /// /// @tparam OutputIterator iterator over output points. -/// @tparam PointPMap is a model of boost::WritablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `WritablePropertyMap` with a value_type = Point_3. /// It can be omitted if OutputIterator value_type is convertible to Point_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. diff --git a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h index 17c0fe4fdd9..0644b28d37b 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h @@ -47,9 +47,9 @@ namespace CGAL { /// Empty lines and comments starting by # character are allowed. /// /// @tparam OutputIterator iterator over output points. -/// @tparam PointPMap is a model of boost::WritablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `WritablePropertyMap` with a value_type = Point_3. /// It can be omitted if OutputIterator value_type is convertible to Point_3. -/// @tparam NormalPMap is a model of boost::WritablePropertyMap with a value_type = Vector_3. +/// @tparam NormalPMap is a model of `WritablePropertyMap` with a value_type = Vector_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. /// @@ -205,7 +205,7 @@ read_xyz_points_and_normals( /// Empty lines and comments starting by # character are allowed. /// /// @tparam OutputIterator iterator over output points. -/// @tparam PointPMap is a model of boost::WritablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `WritablePropertyMap` with a value_type = Point_3. /// It can be omitted if OutputIterator value_type is convertible to Point_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. 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 39d544028d8..9c97f298fb3 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 @@ -45,9 +45,9 @@ namespace CGAL { /// \pre normals must be unit vectors /// /// @tparam ForwardIterator iterator over input points. -/// @tparam PointPMap is a model of boost::ReadablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. /// It can be omitted if ForwardIterator value_type is convertible to Point_3. -/// @tparam NormalPMap is a model of boost::WritablePropertyMap with a value_type = Vector_3. +/// @tparam NormalPMap is a model of `WritablePropertyMap` with a value_type = Vector_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. /// @@ -153,7 +153,7 @@ write_off_points_and_normals( /// The function writes for each point a line with the x y z position. /// /// @tparam ForwardIterator iterator over input points. -/// @tparam PointPMap is a model of boost::ReadablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. /// It can be omitted if ForwardIterator value_type is convertible to Point_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. 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 52072d10c7c..fb9968316a8 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 @@ -45,9 +45,9 @@ namespace CGAL { /// \pre normals must be unit vectors /// /// @tparam ForwardIterator iterator over input points. -/// @tparam PointPMap is a model of boost::ReadablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. /// It can be omitted if ForwardIterator value_type is convertible to Point_3. -/// @tparam NormalPMap is a model of boost::WritablePropertyMap with a value_type = Vector_3. +/// @tparam NormalPMap is a model of `WritablePropertyMap` with a value_type = Vector_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. /// @@ -152,7 +152,7 @@ write_xyz_points_and_normals( /// The function writes for each point a line with the x y z position. /// /// @tparam ForwardIterator iterator over input points. -/// @tparam PointPMap is a model of boost::ReadablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. /// It can be omitted if ForwardIterator value_type is convertible to Point_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. diff --git a/Point_set_processing_3/include/CGAL/Index_property_map.h b/Point_set_processing_3/include/CGAL/Index_property_map.h index 61b2f284f54..58028e9557e 100644 --- a/Point_set_processing_3/include/CGAL/Index_property_map.h +++ b/Point_set_processing_3/include/CGAL/Index_property_map.h @@ -71,7 +71,7 @@ struct Compare_iterator_address /// and get() requires a lookup in the map. /// /// @heading Is Model for the Concepts: -/// Model of the boost::ReadablePropertyMap concept. +/// Model of the `ReadablePropertyMap` concept. /// /// @heading Parameters: /// @param Iter iterator over input elements. 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 403cb18f3cb..96339310fdc 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 @@ -132,7 +132,7 @@ private: /// Property map that accesses the normal vector from a Point_with_normal_3 object /// /// @heading Is Model for the Concepts: -/// Model of boost::LvaluePropertyMap concept. +/// \cgalModels `LvaluePropertyMap` /// /// @heading Parameters: /// @param Gt Geometric traits class. @@ -177,7 +177,7 @@ Normal_of_point_with_normal_pmap< /// (or in general an iterator over Point_with_normal_3 elements). /// /// @heading Is Model for the Concepts: -/// Model of boost::LvaluePropertyMap concept. +/// \cgalModels `LvaluePropertyMap` /// /// @heading Parameters: /// @param Gt Geometric traits class. 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 dc4d240bc1b..d481f155235 100644 --- a/Point_set_processing_3/include/CGAL/compute_average_spacing.h +++ b/Point_set_processing_3/include/CGAL/compute_average_spacing.h @@ -98,7 +98,7 @@ compute_average_spacing(const typename Kernel::Point_3& query, ///< 3D point who /// \pre `k >= 2.` /// /// @tparam InputIterator iterator over input points. -/// @tparam PointPMap is a model of boost::ReadablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. /// It can be omitted if InputIterator value_type is convertible to Point_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. 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 ac3b40d3884..e744c209a79 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 @@ -141,7 +141,7 @@ public: /// \pre `epsilon > 0` /// /// @tparam ForwardIterator iterator over input points. -/// @tparam PointPMap is a model of boost::ReadablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. /// It can be omitted if ForwardIterator value_type is convertible to Point_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. diff --git a/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h b/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h index eaf134d50a8..b4a1fb07ee6 100644 --- a/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h @@ -205,7 +205,7 @@ improved_jet_smooth_point( /// \pre `k >= 2` /// /// @tparam ForwardIterator iterator over input points. -/// @tparam PointPMap is a model of boost::ReadablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. /// It can be omitted if ForwardIterator value_type is convertible to Point_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. diff --git a/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h b/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h index 1be1242a826..6e2b8eef1b9 100644 --- a/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h @@ -188,7 +188,7 @@ improved_laplacian_smooth_point( /// \pre `k >= 2` /// /// @tparam ForwardIterator iterator over input points. -/// @tparam PointPMap is a model of boost::ReadablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. /// It can be omitted if ForwardIterator value_type is convertible to Point_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. 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 ceabe2ae560..9966e2ff8fc 100644 --- a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h @@ -115,9 +115,9 @@ jet_estimate_normal(const typename Kernel::Point_3& query, ///< point to compute /// \pre `k >= 2` /// /// @tparam InputIterator iterator over input points. -/// @tparam PointPMap is a model of boost::ReadablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. /// It can be omitted if InputIterator value_type is convertible to Point_3. -/// @tparam NormalPMap is a model of boost::WritablePropertyMap with a value_type = Vector_3. +/// @tparam NormalPMap is a model of `WritablePropertyMap` with a value_type = Vector_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. 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 13536e743c1..94ae083d226 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 @@ -115,7 +115,7 @@ jet_smooth_point( /// \pre `k >= 2` /// /// @tparam InputIterator iterator over input points. -/// @tparam PointPMap is a model of boost::ReadablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. /// It can be omitted if InputIterator value_type is convertible to Point_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. 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 c9f0a394110..5f504a46230 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -130,7 +130,7 @@ public: /// \pre `0 < angle_max <= PI/2` /// /// @tparam ForwardIterator iterator over input points. -/// @tparam NormalPMap is a model of boost::ReadWritePropertyMap. +/// @tparam NormalPMap is a model of `ReadWritePropertyMap`. /// @tparam Kernel Geometric traits class. template boost::ReadablePropertyMap with a value_type = Point_3. -/// @tparam NormalPMap is a model of boost::ReadWritePropertyMap with a value_type = Vector_3. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. +/// @tparam NormalPMap is a model of `ReadWritePropertyMap` with a value_type = Vector_3. /// @tparam Kernel Geometric traits class. /// /// @return iterator over the top point. @@ -274,9 +274,9 @@ mst_find_source( /// \pre `k >= 2` /// /// @tparam ForwardIterator iterator over input points. -/// @tparam IndexPMap is a model of boost::ReadablePropertyMap with an integral value_type. -/// @tparam PointPMap is a model of boost::ReadablePropertyMap with a value_type = Point_3. -/// @tparam NormalPMap is a model of boost::ReadWritePropertyMap with a value_type = Vector_3. +/// @tparam IndexPMap is a model of `ReadablePropertyMap` with an integral value_type. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. +/// @tparam NormalPMap is a model of `ReadWritePropertyMap` with a value_type = Vector_3. /// @tparam Kernel Geometric traits class. /// /// @return the Riemannian graph @@ -433,9 +433,9 @@ create_riemannian_graph( /// \pre Normals must be unit vectors. /// /// @tparam ForwardIterator iterator over input points. -/// @tparam IndexPMap is a model of boost::ReadablePropertyMap with an integral value_type. -/// @tparam PointPMap is a model of boost::ReadablePropertyMap with a value_type = Point_3. -/// @tparam NormalPMap is a model of boost::ReadWritePropertyMap with a value_type = Vector_3. +/// @tparam IndexPMap is a model of `ReadablePropertyMap` with an integral value_type. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. +/// @tparam NormalPMap is a model of `ReadWritePropertyMap` with a value_type = Vector_3. /// @tparam Kernel Geometric traits class. /// /// @return the MST graph. @@ -545,9 +545,9 @@ create_mst_graph( /// \pre `k >= 2` /// /// @tparam ForwardIterator iterator over input points. -/// @tparam PointPMap is a model of boost::ReadablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. /// It can be omitted if ForwardIterator value_type is convertible to Point_3. -/// @tparam NormalPMap is a model of boost::ReadWritePropertyMap with a value_type = Vector_3. +/// @tparam NormalPMap is a model of `ReadWritePropertyMap` with a value_type = Vector_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. /// 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 dfc315075c2..7128e01bc48 100644 --- a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h @@ -110,9 +110,9 @@ pca_estimate_normal(const typename Kernel::Point_3& query, ///< point to compute /// \pre `k >= 2` /// /// @tparam InputIterator iterator over input points. -/// @tparam PointPMap is a model of boost::ReadablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. /// It can be omitted if InputIterator value_type is convertible to Point_3. -/// @tparam NormalPMap is a model of boost::WritablePropertyMap with a value_type = Vector_3. +/// @tparam NormalPMap is a model of `WritablePropertyMap` with a value_type = Vector_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. diff --git a/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h b/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h index 098722c2cd0..fb3a2a60b2a 100644 --- a/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h @@ -111,7 +111,7 @@ pca_smooth_point( /// \pre `k >= 2` /// /// @tparam InputIterator iterator over input points. -/// @tparam PointPMap is a model of boost::ReadablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. /// It can be omitted if InputIterator value_type is convertible to Point_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. 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 c98fccd0278..77cba20ef82 100644 --- a/Point_set_processing_3/include/CGAL/radial_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/radial_orient_normals.h @@ -40,9 +40,9 @@ namespace CGAL { /// \pre normals must be unit vectors /// /// @tparam ForwardIterator iterator over input points. -/// @tparam PointPMap is a model of boost::ReadablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. /// It can be omitted if ForwardIterator value_type is convertible to Point_3. -/// @tparam NormalPMap is a model of boost::ReadWritePropertyMap with a value_type = Vector_3. +/// @tparam NormalPMap is a model of `ReadWritePropertyMap` with a value_type = Vector_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. /// diff --git a/Point_set_processing_3/include/CGAL/random_simplify_point_set.h b/Point_set_processing_3/include/CGAL/random_simplify_point_set.h index 70d91d5c58e..4f7a36937bc 100644 --- a/Point_set_processing_3/include/CGAL/random_simplify_point_set.h +++ b/Point_set_processing_3/include/CGAL/random_simplify_point_set.h @@ -38,7 +38,7 @@ namespace CGAL { /// For this reason it should not be called on sorted containers. /// /// @tparam ForwardIterator iterator over input points. -/// @tparam PointPMap is a model of boost::ReadablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. /// It can be omitted if ForwardIterator value_type is convertible to Point_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. diff --git a/Point_set_processing_3/include/CGAL/remove_outliers.h b/Point_set_processing_3/include/CGAL/remove_outliers.h index 9cb3c97c283..e44e278f237 100644 --- a/Point_set_processing_3/include/CGAL/remove_outliers.h +++ b/Point_set_processing_3/include/CGAL/remove_outliers.h @@ -112,7 +112,7 @@ compute_avg_knn_sq_distance_3( /// \pre `k >= 2` /// /// @tparam InputIterator iterator over input points. -/// @tparam PointPMap is a model of boost::ReadablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. /// It can be omitted if InputIterator value_type is convertible to Point_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. diff --git a/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h b/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h index 3bfbb9b4970..a40a667b1cd 100644 --- a/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h +++ b/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h @@ -109,7 +109,7 @@ compute_median_knn_sq_distance_3( /// \pre `k >= 2` /// /// @tparam InputIterator iterator over input points. -/// @tparam PointPMap is a model of boost::ReadablePropertyMap with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. /// It can be omitted if InputIterator value_type is convertible to Point_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. From f7d331ec22cbf1840941d1b89d89fee2d7ca9a04 Mon Sep 17 00:00:00 2001 From: iyaz Date: Sat, 4 May 2013 01:50:02 +0300 Subject: [PATCH 28/63] changed improved_jet_smooth_point_set PointPMap requirement to ReadWritePropertyMap which was ReadablePropertyMap (which was not OK since pmap is also subject to change inside the function) --- .../include/CGAL/improved_jet_smooth_point_set.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h b/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h index b4a1fb07ee6..5332c56664f 100644 --- a/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h @@ -205,7 +205,7 @@ improved_jet_smooth_point( /// \pre `k >= 2` /// /// @tparam ForwardIterator iterator over input points. -/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadWritePropertyMap` with a value_type = Point_3. /// It can be omitted if ForwardIterator value_type is convertible to Point_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. @@ -258,7 +258,8 @@ improved_jet_smooth_point_set( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point& p0 = get(point_pmap,it); #else - Point& p0 = get(point_pmap,*it); + // changed to const Point& + const Point& p0 = get(point_pmap,*it); #endif treeElements.push_back(KdTreeElement(p0,i)); } @@ -286,7 +287,8 @@ improved_jet_smooth_point_set( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point& p0 = get(point_pmap,it); #else - Point& p0 = get(point_pmap,*it); + // changed to const Point& + const Point& p0 = get(point_pmap,*it); #endif Point np = improved_jet_smoothing_i::jet_smooth_point(p0,tree,kk); b[i] = alpha*(np - p0) + (1-alpha)*(np - p[i]); @@ -304,8 +306,12 @@ improved_jet_smooth_point_set( // Implementation note: the cast to Point& allows to modify only the point's position. for(it = first, i=0; it != beyond; it++, ++i) { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point& p0 = get(point_pmap,it); p0 = p[i]; +#else + put(point_pmap, *it, p[i]); +#endif } } From c67eb609b348bf7234757440484bfdfea3beaffc Mon Sep 17 00:00:00 2001 From: iyaz Date: Sun, 5 May 2013 16:11:43 +0300 Subject: [PATCH 29/63] improved_laplacian_smooth_point_set ReadablePropertyMap -> ReadWritePropertyMap --- .../include/CGAL/improved_laplacian_smooth_point_set.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h b/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h index 6e2b8eef1b9..c7dbb43f202 100644 --- a/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h @@ -188,7 +188,7 @@ improved_laplacian_smooth_point( /// \pre `k >= 2` /// /// @tparam ForwardIterator iterator over input points. -/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadWritePropertyMap` with a value_type = Point_3. /// It can be omitted if ForwardIterator value_type is convertible to Point_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. @@ -241,7 +241,7 @@ improved_laplacian_smooth_point_set( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point& p0 = get(point_pmap,it); #else - Point& p0 = get(point_pmap,*it); + const Point& p0 = get(point_pmap,*it); #endif treeElements.push_back(KdTreeElement(p0,i)); } @@ -266,7 +266,7 @@ improved_laplacian_smooth_point_set( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point& p0 = get(point_pmap,it); #else - Point& p0 = get(point_pmap,*it); + const Point& p0 = get(point_pmap,*it); #endif Point np = improved_laplacian_smoothing_i::laplacian_smooth_point(p0,tree,k); b[i] = alpha*(np - p0) + (1-alpha)*(np - p[i]); @@ -284,8 +284,12 @@ improved_laplacian_smooth_point_set( // Implementation note: the cast to Point& allows to modify only the point's position. for(it = first, i=0; it != beyond; it++, ++i) { +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS Point& p0 = get(point_pmap,it); p0 = p[i]; +#else + put(point_pmap, *it, p[i]); +#endif } } From a1454a975dbb6c2f6ebe83b3c272e712887b64b6 Mon Sep 17 00:00:00 2001 From: iyaz Date: Sun, 5 May 2013 16:13:28 +0300 Subject: [PATCH 30/63] jet_smooth_point_set ReadablePropertyMap -> ReadWritePropertyMap --- Point_set_processing_3/include/CGAL/jet_smooth_point_set.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 94ae083d226..e69c1053525 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 @@ -115,7 +115,7 @@ jet_smooth_point( /// \pre `k >= 2` /// /// @tparam InputIterator iterator over input points. -/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadWritePropertyMap` with a value_type = Point_3. /// It can be omitted if InputIterator value_type is convertible to Point_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. From fb37011c14d50a83e09d7a682900cdcdd07cb1fc Mon Sep 17 00:00:00 2001 From: iyaz Date: Sun, 5 May 2013 17:08:55 +0300 Subject: [PATCH 31/63] pmap related changes, note that previous version has a bug, where a normal is accessed directly (should be accessed via pmap) --- .../include/CGAL/radial_orient_normals.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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 77cba20ef82..9d998d81b68 100644 --- a/Point_set_processing_3/include/CGAL/radial_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/radial_orient_normals.h @@ -104,15 +104,23 @@ radial_orient_normals( Vector vec1 = point - barycenter; // Point's normal - Vector vec2 = normal_pmap[it]; - +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + Vector vec2 = normal_pmap[it]; +#else + Vector vec2 = get(normal_pmap, *it); +#endif + // -> -> // Orients vec2 parallel to vec1 double dot = vec1 * vec2; if (dot < 0) vec2 = -vec2; - it->normal() = vec2; +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + it->normal() = vec2; +#else + put(normal_pmap, *it, vec2); +#endif // Is orientation robust? bool oriented = (std::abs(dot) > std::cos(80.*CGAL_PI/180.)); // robust iff angle < 80 degrees From d7385a19749354681c8032ff80d4ab41d9530fab Mon Sep 17 00:00:00 2001 From: iyaz Date: Sun, 5 May 2013 18:11:14 +0300 Subject: [PATCH 32/63] Also changed code in prev version (i.e. macro activated code) which was previously buggy (buggy in a way of using pmaps) --- .../include/CGAL/improved_jet_smooth_point_set.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h b/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h index 5332c56664f..5bd2544576b 100644 --- a/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h @@ -256,9 +256,8 @@ improved_jet_smooth_point_set( for (it = first, i=0 ; it != beyond ; ++it,++i) { #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - Point& p0 = get(point_pmap,it); + const Point& p0 = get(point_pmap,it); #else - // changed to const Point& const Point& p0 = get(point_pmap,*it); #endif treeElements.push_back(KdTreeElement(p0,i)); @@ -285,9 +284,8 @@ improved_jet_smooth_point_set( for(it = first, i=0; it != beyond; it++, ++i) { #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - Point& p0 = get(point_pmap,it); + const Point& p0 = get(point_pmap,it); #else - // changed to const Point& const Point& p0 = get(point_pmap,*it); #endif Point np = improved_jet_smoothing_i::jet_smooth_point(p0,tree,kk); @@ -307,8 +305,7 @@ improved_jet_smooth_point_set( for(it = first, i=0; it != beyond; it++, ++i) { #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - Point& p0 = get(point_pmap,it); - p0 = p[i]; + put(point_pmap, it, p[i]); #else put(point_pmap, *it, p[i]); #endif From 0a7322b3bca1b42d8d69a061c61f72a0e36d6ad3 Mon Sep 17 00:00:00 2001 From: iyaz Date: Sun, 5 May 2013 18:15:45 +0300 Subject: [PATCH 33/63] Also changed code in prev version (i.e. macro activated code) which was previously buggy (buggy in a way of using pmaps) --- .../include/CGAL/improved_laplacian_smooth_point_set.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h b/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h index c7dbb43f202..39f00b4dc05 100644 --- a/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h @@ -239,7 +239,7 @@ improved_laplacian_smooth_point_set( for (it = first, i=0 ; it != beyond ; ++it,++i) { #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - Point& p0 = get(point_pmap,it); + const Point& p0 = get(point_pmap,it); #else const Point& p0 = get(point_pmap,*it); #endif @@ -264,7 +264,7 @@ improved_laplacian_smooth_point_set( for(it = first, i=0; it != beyond; it++, ++i) { #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - Point& p0 = get(point_pmap,it); + const Point& p0 = get(point_pmap,it); #else const Point& p0 = get(point_pmap,*it); #endif @@ -285,8 +285,7 @@ improved_laplacian_smooth_point_set( for(it = first, i=0; it != beyond; it++, ++i) { #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - Point& p0 = get(point_pmap,it); - p0 = p[i]; + put(point_pmap, it, p[i]); #else put(point_pmap, *it, p[i]); #endif From f09426d1c5f4d1770ad8a62c554dda3d0375beb2 Mon Sep 17 00:00:00 2001 From: iyaz Date: Sun, 5 May 2013 18:51:24 +0300 Subject: [PATCH 34/63] write_off_points_and_normals NormalPMap requirement WritablePropertyMap -> ReadablePropertyMap write_xyz_points_and_normals NormalPMap requirement WritablePropertyMap -> ReadablePropertyMap --- Point_set_processing_3/include/CGAL/IO/write_off_points.h | 2 +- Point_set_processing_3/include/CGAL/IO/write_xyz_points.h | 2 +- 2 files changed, 2 insertions(+), 2 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 9c97f298fb3..55607e55a52 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 @@ -47,7 +47,7 @@ namespace CGAL { /// @tparam ForwardIterator iterator over input points. /// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. /// It can be omitted if ForwardIterator value_type is convertible to Point_3. -/// @tparam NormalPMap is a model of `WritablePropertyMap` with a value_type = Vector_3. +/// @tparam NormalPMap is a model of `ReadablePropertyMap` with a value_type = Vector_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. /// 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 fb9968316a8..e6930de5309 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 @@ -47,7 +47,7 @@ namespace CGAL { /// @tparam ForwardIterator iterator over input points. /// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. /// It can be omitted if ForwardIterator value_type is convertible to Point_3. -/// @tparam NormalPMap is a model of `WritablePropertyMap` with a value_type = Vector_3. +/// @tparam NormalPMap is a model of `ReadablePropertyMap` with a value_type = Vector_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. /// From d8bd97e662d1e3efca77dacb5c984667c95ec8fe Mon Sep 17 00:00:00 2001 From: iyaz Date: Sun, 5 May 2013 19:13:41 +0300 Subject: [PATCH 35/63] documentation related parameter name fix --- Point_set_processing_3/include/CGAL/property_map.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Point_set_processing_3/include/CGAL/property_map.h b/Point_set_processing_3/include/CGAL/property_map.h index d98984bbde2..49986513842 100644 --- a/Point_set_processing_3/include/CGAL/property_map.h +++ b/Point_set_processing_3/include/CGAL/property_map.h @@ -78,7 +78,7 @@ struct Typed_identity_property_map_by_reference typedef T& reference; ///< typedef to `T&` typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag` /// Access a property map element. - /// @param v a key which is returned as mapped value. + /// @param k a key which is returned as mapped value. reference operator[](key_type& k) const { return k; } typedef Typed_identity_property_map_by_reference Self; From cc16c15fb2330595edcf32c754bfe9ec51b07c09 Mon Sep 17 00:00:00 2001 From: iyaz Date: Sun, 5 May 2013 19:33:06 +0300 Subject: [PATCH 36/63] Also changed code in prev version (i.e. macro activated code) which was previously buggy (buggy in a way of using pmaps) --- Point_set_processing_3/include/CGAL/radial_orient_normals.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 9d998d81b68..48325128c79 100644 --- a/Point_set_processing_3/include/CGAL/radial_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/radial_orient_normals.h @@ -105,7 +105,7 @@ radial_orient_normals( // Point's normal #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - Vector vec2 = normal_pmap[it]; + Vector vec2 = get(normal_pmap, it); #else Vector vec2 = get(normal_pmap, *it); #endif @@ -117,7 +117,7 @@ radial_orient_normals( vec2 = -vec2; #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - it->normal() = vec2; + put(normal_pmap, it, vec2); #else put(normal_pmap, *it, vec2); #endif From 0ca7f319e04a9037ede3842d53f1b2672fcc5f3d Mon Sep 17 00:00:00 2001 From: iyaz Date: Sun, 5 May 2013 22:07:41 +0300 Subject: [PATCH 37/63] use helper function for typed_identity pmap, remove forgotten dereference pmap --- Point_set_processing_3/include/CGAL/IO/write_off_points.h | 5 +++++ Point_set_processing_3/include/CGAL/IO/write_xyz_points.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) 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 55607e55a52..9cce4221f36 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 @@ -141,7 +141,12 @@ write_off_points_and_normals( return write_off_points_and_normals( stream, first, beyond, +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), +#else + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()), +#endif normal_pmap); } /// @endcond 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 e6930de5309..f01c9531278 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 @@ -139,7 +139,8 @@ write_xyz_points_and_normals( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(output), #else - Typed_identity_property_map_by_reference::type>(), + make_typed_identity_property_map_by_reference( + typename value_type_traits::type()), #endif normal_pmap); } From d72b7d20a60e7794dbfac33a55e23b0bfa0de061 Mon Sep 17 00:00:00 2001 From: iyaz Date: Sun, 5 May 2013 22:28:09 +0300 Subject: [PATCH 38/63] changes in Demo --- .../PS_demo_normal_estimation_plugin.cpp | 19 +++++++++-- .../PS_demo_poisson_plugin_cgal_code.cpp | 9 +++-- .../Point_set_scene_item.cpp | 34 +++++++++++++++---- 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/PS_demo_normal_estimation_plugin.cpp b/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/PS_demo_normal_estimation_plugin.cpp index 075af85b1e4..e5f166ceb02 100644 --- a/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/PS_demo_normal_estimation_plugin.cpp +++ b/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/PS_demo_normal_estimation_plugin.cpp @@ -127,7 +127,12 @@ void PS_demo_normal_estimation_plugin::on_actionNormalEstimation_triggered() // Estimates normals direction. CGAL::pca_estimate_normals(points->begin(), points->end(), - CGAL::make_normal_of_point_with_normal_pmap(points->begin()), +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + CGAL::make_normal_of_point_with_normal_pmap(points->begin()), +#else + CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()), +#endif + dialog.directionNbNeighbors()); // Mark all normals as unoriented @@ -145,7 +150,11 @@ void PS_demo_normal_estimation_plugin::on_actionNormalEstimation_triggered() // Estimates normals direction. CGAL::jet_estimate_normals(points->begin(), points->end(), - CGAL::make_normal_of_point_with_normal_pmap(points->begin()), +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + CGAL::make_normal_of_point_with_normal_pmap(points->begin()), +#else + CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()), +#endif dialog.directionNbNeighbors()); // Mark all normals as unoriented @@ -167,7 +176,11 @@ void PS_demo_normal_estimation_plugin::on_actionNormalEstimation_triggered() // Tries to orient normals first_unoriented_point = CGAL::mst_orient_normals(points->begin(), points->end(), - CGAL::make_normal_of_point_with_normal_pmap(points->begin()), +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + CGAL::make_normal_of_point_with_normal_pmap(points->begin()), +#else + CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()), +#endif dialog.orientationNbNeighbors()); int nb_unoriented_normals = std::distance(first_unoriented_point, points->end()); diff --git a/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/PS_demo_poisson_plugin_cgal_code.cpp b/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/PS_demo_poisson_plugin_cgal_code.cpp index 751af7822cc..26f58658ce5 100644 --- a/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/PS_demo_poisson_plugin_cgal_code.cpp +++ b/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/PS_demo_poisson_plugin_cgal_code.cpp @@ -89,8 +89,13 @@ Polyhedron* poisson_reconstruct(const Point_set& points, // + property maps to access each point's position and normal. // The position property map can be omitted here as we use iterators over Point_3 elements. Poisson_reconstruction_function function( - points.begin(), points.end(), - CGAL::make_normal_of_point_with_normal_pmap(points.begin()) ); + points.begin(), points.end(), +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + CGAL::make_normal_of_point_with_normal_pmap(points.begin()) +#else + CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()) +#endif + ); bool ok = false; #ifdef CGAL_TAUCS_ENABLED diff --git a/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/Point_set_scene_item.cpp b/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/Point_set_scene_item.cpp index 3865f3d2219..4a5b370f433 100644 --- a/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/Point_set_scene_item.cpp +++ b/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/Point_set_scene_item.cpp @@ -102,8 +102,13 @@ bool Point_set_scene_item::read_off_point_set(std::istream& stream) m_points->clear(); bool ok = stream && CGAL::read_off_points_and_normals(stream, - std::back_inserter(*m_points), - CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(*m_points))) && + std::back_inserter(*m_points), +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(*m_points)) +#else + CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()) +#endif + ) && !isEmpty(); return ok; @@ -116,8 +121,13 @@ bool Point_set_scene_item::write_off_point_set(std::ostream& stream) const return stream && CGAL::write_off_points_and_normals(stream, - m_points->begin(), m_points->end(), - CGAL::make_normal_of_point_with_normal_pmap(m_points->begin())); + m_points->begin(), m_points->end(), +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + CGAL::make_normal_of_point_with_normal_pmap(m_points->begin()) +#else + CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()) +#endif + ); } // Loads point set from .XYZ file @@ -129,7 +139,12 @@ bool Point_set_scene_item::read_xyz_point_set(std::istream& stream) bool ok = stream && CGAL::read_xyz_points_and_normals(stream, std::back_inserter(*m_points), - CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(*m_points))) && +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(*m_points)) +#else + CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()) +#endif + ) && !isEmpty(); return ok; @@ -142,8 +157,13 @@ bool Point_set_scene_item::write_xyz_point_set(std::ostream& stream) const return stream && CGAL::write_xyz_points_and_normals(stream, - m_points->begin(), m_points->end(), - CGAL::make_normal_of_point_with_normal_pmap(m_points->begin())); + m_points->begin(), m_points->end(), +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + CGAL::make_normal_of_point_with_normal_pmap(m_points->begin()) +#else + CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()) +#endif + ); } QString From b97fcda8dd5a613b0a690e4d6b45391dc312614e Mon Sep 17 00:00:00 2001 From: iyaz Date: Mon, 6 May 2013 12:05:35 +0300 Subject: [PATCH 39/63] pca_smooth_point_set PointPMap Readable -> ReadWrite, make it undocumented --- .../include/CGAL/pca_smooth_point_set.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h b/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h index fb3a2a60b2a..124facabc0e 100644 --- a/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h @@ -97,11 +97,11 @@ pca_smooth_point( } /* namespace internal */ - // ---------------------------------------------------------------------------- // Public section // ---------------------------------------------------------------------------- +/// \cond SKIP_IN_MANUAL /// \ingroup PkgPointSetProcessing /// Smoothes the `[first, beyond)` range of points using pca on the k /// nearest neighbors and reprojection onto the plane. @@ -111,7 +111,7 @@ pca_smooth_point( /// \pre `k >= 2` /// /// @tparam InputIterator iterator over input points. -/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3. +/// @tparam PointPMap is a model of `ReadWritePropertyMap` with a value_type = Point_3. /// It can be omitted if InputIterator value_type is convertible to Point_3. /// @tparam Kernel Geometric traits class. /// It can be omitted and deduced automatically from PointPMap value_type. @@ -165,15 +165,16 @@ pca_smooth_point_set( // Implementation note: the cast to Point& allows to modify only the point's position. for(it = first; it != beyond; it++) { - #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - Point& p = get(point_pmap, it); + const Point& p = get(point_pmap, it); + put(point_pmap, it, internal::pca_smooth_point(p,tree,k) ); #else - Point& p = get(point_pmap, *it); + const Point& p = get(point_pmap, *it); + put(point_pmap, *it, internal::pca_smooth_point(p,tree,k) ); #endif - p = internal::pca_smooth_point(p,tree,k); } } +/// @endcond /// @cond SKIP_IN_MANUAL // This variant deduces the kernel from the point property map. From 9cb22fdd0ea63b97189560647727fd7d1c0fc6ed Mon Sep 17 00:00:00 2001 From: iyaz Date: Mon, 6 May 2013 18:08:33 +0300 Subject: [PATCH 40/63] InputIterator -> ForwardIterator --- Point_set_processing_3/include/CGAL/jet_estimate_normals.h | 2 +- Point_set_processing_3/include/CGAL/pca_estimate_normals.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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 65190234a3c..17dedc70098 100644 --- a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h @@ -251,7 +251,7 @@ jet_estimate_normals( make_dereference_property_map(first), #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), + typename value_type_traits::type()), #endif normal_pmap, k, 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 b295dd5970d..371d832dedf 100644 --- a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h @@ -232,7 +232,7 @@ void pca_estimate_normals( ForwardIterator first, ///< iterator over the first input point. ForwardIterator beyond, ///< past-the-end iterator over the input points. - NormalPMap normal_pmap, ///< property map: value_type of InputIterator -> Vector_3. + NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3. unsigned int k) ///< number of neighbors. { pca_estimate_normals( @@ -241,7 +241,7 @@ pca_estimate_normals( make_dereference_property_map(first), #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), + typename value_type_traits::type()), #endif normal_pmap, k); From c9a1b71c43b937c6e35a20c34d69d4ebf29255fe Mon Sep 17 00:00:00 2001 From: iyaz Date: Tue, 7 May 2013 18:53:14 +0300 Subject: [PATCH 41/63] do not use value_type_traits when iterator_traits suffices --- Point_set_processing_3/include/CGAL/IO/write_off_points.h | 4 ++-- Point_set_processing_3/include/CGAL/IO/write_xyz_points.h | 4 ++-- Point_set_processing_3/include/CGAL/compute_average_spacing.h | 2 +- Point_set_processing_3/include/CGAL/grid_simplify_point_set.h | 2 +- .../include/CGAL/improved_jet_smooth_point_set.h | 2 +- .../include/CGAL/improved_laplacian_smooth_point_set.h | 2 +- Point_set_processing_3/include/CGAL/jet_estimate_normals.h | 2 +- Point_set_processing_3/include/CGAL/jet_smooth_point_set.h | 2 +- Point_set_processing_3/include/CGAL/mst_orient_normals.h | 2 +- Point_set_processing_3/include/CGAL/pca_estimate_normals.h | 2 +- Point_set_processing_3/include/CGAL/pca_smooth_point_set.h | 2 +- Point_set_processing_3/include/CGAL/radial_orient_normals.h | 2 +- .../include/CGAL/random_simplify_point_set.h | 2 +- Point_set_processing_3/include/CGAL/remove_outliers.h | 2 +- .../include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h | 2 +- .../include/CGAL/Poisson_reconstruction_function.h | 3 ++- .../include/CGAL/Reconstruction_triangulation_3.h | 3 ++- 17 files changed, 21 insertions(+), 19 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 1d4b90337c2..50125b1bd26 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 @@ -145,7 +145,7 @@ write_off_points_and_normals( make_dereference_property_map(first), #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), + typename std::input_iterator::value_type()), #endif normal_pmap); } @@ -247,7 +247,7 @@ write_off_points( make_dereference_property_map(first) #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()) + typename std::iterator_traits::value_type()) #endif ); } 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 f01c9531278..7533b746e9b 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 @@ -140,7 +140,7 @@ write_xyz_points_and_normals( make_dereference_property_map(output), #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), + typename std::iterator_traits::value_type()), #endif normal_pmap); } @@ -238,7 +238,7 @@ write_xyz_points( make_dereference_property_map(output) #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()) + typename std::iterator_traits::value_type()) #endif ); } 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 d481f155235..49dc48ecb51 100644 --- a/Point_set_processing_3/include/CGAL/compute_average_spacing.h +++ b/Point_set_processing_3/include/CGAL/compute_average_spacing.h @@ -207,7 +207,7 @@ compute_average_spacing( make_dereference_property_map(first), #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), + typename std::iterator_traits::value_type()), #endif k); } 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 e744c209a79..3d973a0c541 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 @@ -222,7 +222,7 @@ grid_simplify_point_set( make_dereference_property_map(first), #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), + typename std::iterator_traits::value_type()), #endif epsilon); } diff --git a/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h b/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h index 5bd2544576b..a421bb6a45b 100644 --- a/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h @@ -360,7 +360,7 @@ improved_jet_smooth_point_set( make_dereference_property_map(first), #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), + typename std::iterator_traits::value_type()), #endif k, iter_number, diff --git a/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h b/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h index 39f00b4dc05..90cb9874784 100644 --- a/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h @@ -340,7 +340,7 @@ improved_laplacian_smooth_point_set( make_dereference_property_map(first), #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), + typename std::iterator_traits::value_type()), #endif k, iter_number, 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 17dedc70098..b7320fe18a9 100644 --- a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h @@ -251,7 +251,7 @@ jet_estimate_normals( make_dereference_property_map(first), #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), + typename std::iterator_traits::value_type()), #endif normal_pmap, k, 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 e69c1053525..1592c1a729f 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 @@ -226,7 +226,7 @@ jet_smooth_point_set( make_dereference_property_map(first), #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), + typename std::iterator_traits::value_type()), #endif 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 04fe41261ca..f60806e709c 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -704,7 +704,7 @@ mst_orient_normals( make_dereference_property_map(first), #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), + typename std::iterator_traits::value_type()), #endif normal_pmap, k); 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 371d832dedf..76dd71d718d 100644 --- a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h @@ -241,7 +241,7 @@ pca_estimate_normals( make_dereference_property_map(first), #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), + typename std::iterator_traits::value_type()), #endif normal_pmap, k); diff --git a/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h b/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h index 124facabc0e..b42f3a007ff 100644 --- a/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h @@ -214,7 +214,7 @@ pca_smooth_point_set( make_dereference_property_map(first), #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), + typename std::iterator_traits::value_type()), #endif k); } 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 48325128c79..4ad59f117f2 100644 --- a/Point_set_processing_3/include/CGAL/radial_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/radial_orient_normals.h @@ -180,7 +180,7 @@ radial_orient_normals( make_dereference_property_map(first), #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), + typename std::iterator_traits::value_type()), #endif normal_pmap); } diff --git a/Point_set_processing_3/include/CGAL/random_simplify_point_set.h b/Point_set_processing_3/include/CGAL/random_simplify_point_set.h index 4f7a36937bc..30c7ef1ca43 100644 --- a/Point_set_processing_3/include/CGAL/random_simplify_point_set.h +++ b/Point_set_processing_3/include/CGAL/random_simplify_point_set.h @@ -110,7 +110,7 @@ random_simplify_point_set( make_dereference_property_map(first), #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), + typename std::iterator_traits::value_type()), #endif removed_percentage); } diff --git a/Point_set_processing_3/include/CGAL/remove_outliers.h b/Point_set_processing_3/include/CGAL/remove_outliers.h index e44e278f237..41bc4bfd9b9 100644 --- a/Point_set_processing_3/include/CGAL/remove_outliers.h +++ b/Point_set_processing_3/include/CGAL/remove_outliers.h @@ -246,7 +246,7 @@ remove_outliers( make_dereference_property_map(first), #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), + typename std::iterator_traits::value_type()), #endif k,threshold_percent); } diff --git a/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h b/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h index a40a667b1cd..cae10a356fd 100644 --- a/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h +++ b/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h @@ -244,7 +244,7 @@ remove_outliers_wrt_median_knn_sq_distance( make_dereference_property_map(first), #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), + typename std::iterator_traits::value_type()), #endif k,threshold_percent); } diff --git a/Surface_reconstruction_points_3/include/CGAL/Poisson_reconstruction_function.h b/Surface_reconstruction_points_3/include/CGAL/Poisson_reconstruction_function.h index 79526afca24..d6e53b1ac3b 100644 --- a/Surface_reconstruction_points_3/include/CGAL/Poisson_reconstruction_function.h +++ b/Surface_reconstruction_points_3/include/CGAL/Poisson_reconstruction_function.h @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -344,7 +345,7 @@ public: make_dereference_property_map(first), #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), + typename std::iterator_traits::value_type()), #endif normal_pmap, Poisson_visitor()); CGAL::Timer task_timer; task_timer.start(); diff --git a/Surface_reconstruction_points_3/include/CGAL/Reconstruction_triangulation_3.h b/Surface_reconstruction_points_3/include/CGAL/Reconstruction_triangulation_3.h index edb1deba2fd..b246e593f24 100644 --- a/Surface_reconstruction_points_3/include/CGAL/Reconstruction_triangulation_3.h +++ b/Surface_reconstruction_points_3/include/CGAL/Reconstruction_triangulation_3.h @@ -37,6 +37,7 @@ #include #include +#include namespace CGAL { @@ -456,7 +457,7 @@ public: make_dereference_property_map(first), #else make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), + typename std::iterator_traits::value_type()), #endif normal_pmap, visitor); From c951a2f509a0f959ec70ba5ec65606c01d622678 Mon Sep 17 00:00:00 2001 From: iyaz Date: Wed, 8 May 2013 10:33:32 +0300 Subject: [PATCH 42/63] wrong parameter name - fixed --- Point_set_processing_3/include/CGAL/IO/read_off_points.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Point_set_processing_3/include/CGAL/IO/read_off_points.h b/Point_set_processing_3/include/CGAL/IO/read_off_points.h index fb96637e878..0cedf2f91e1 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_off_points.h @@ -274,7 +274,7 @@ read_off_points( stream, output, #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - make_dereference_property_map(first) + make_dereference_property_map(output) #else make_typed_identity_property_map_by_reference( typename value_type_traits::type()) From cd0163b95c7ba86ead969b16d7fa25ad0016f52d Mon Sep 17 00:00:00 2001 From: iyaz Date: Wed, 8 May 2013 15:43:53 +0300 Subject: [PATCH 43/63] should be iterator_traits - fixed --- Point_set_processing_3/include/CGAL/IO/write_off_points.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 50125b1bd26..f944be8b9d2 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 @@ -145,7 +145,7 @@ write_off_points_and_normals( make_dereference_property_map(first), #else make_typed_identity_property_map_by_reference( - typename std::input_iterator::value_type()), + typename std::iterator_traits::value_type()), #endif normal_pmap); } From 8807ec30e195cc44cf8cebfa4a6562b2c897e385 Mon Sep 17 00:00:00 2001 From: iyaz Date: Wed, 8 May 2013 23:21:22 +0300 Subject: [PATCH 44/63] document value_type_traits, add specializations for inserter_iterator and front_inserter_iterator add another template parameters for OtuputIterator value type in read functions which rely on vaue_type_traits --- .../include/CGAL/IO/read_off_points.h | 216 +++++++++++++++--- .../include/CGAL/IO/read_xyz_points.h | 203 +++++++++++++--- .../include/CGAL/value_type_traits.h | 27 ++- 3 files changed, 371 insertions(+), 75 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/IO/read_off_points.h b/Point_set_processing_3/include/CGAL/IO/read_off_points.h index 0cedf2f91e1..e5c588bbdec 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_off_points.h @@ -45,6 +45,8 @@ namespace CGAL { /// optionally followed by the nx ny nz normal. /// Faces are ignored. /// +/// @tparam OutputIteratorValueType value_type of OutputIterator. +/// It is default to value_type_traits::type, and can be omitted when the default is fine. /// @tparam OutputIterator iterator over output points. /// @tparam PointPMap is a model of `WritablePropertyMap` with a value_type = Point_3. /// It can be omitted if OutputIterator value_type is convertible to Point_3. @@ -55,21 +57,24 @@ namespace CGAL { /// @return true on success. // This variant requires all parameters. -template bool read_off_points_and_normals( - std::istream& stream, ///< input stream. - OutputIterator output, ///< output iterator over points. - PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3. - NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3. - const Kernel& /*kernel*/) ///< geometric traits. + std::istream& stream, ///< input stream. + OutputIterator output, ///< output iterator over points. + PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3. + NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3. + const Kernel& /*kernel*/) ///< geometric traits. { // value_type_traits is a workaround as back_insert_iterator's value_type is void - typedef typename value_type_traits::type Enriched_point; + // typedef typename value_type_traits::type Enriched_point; + typedef OutputIteratorValueType Enriched_point; typedef typename Kernel::Point_3 Point; typedef typename Kernel::Vector_3 Vector; @@ -127,15 +132,15 @@ read_off_points_and_normals( Vector normal = CGAL::NULL_VECTOR; // ... + normal... if (iss >> nx) - { - // In case we could read one number, we expect that there are two more - if(iss >> ny >> nz){ - normal = Vector(nx,ny,nz); - } else { - std::cerr << "Error line " << lineNumber << " of file" << std::endl; - return false; - } + { + // In case we could read one number, we expect that there are two more + if(iss >> ny >> nz){ + normal = Vector(nx,ny,nz); + } else { + std::cerr << "Error line " << lineNumber << " of file" << std::endl; + return false; } + } Enriched_point pwn; #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS put(point_pmap, &pwn, point); // point_pmap[&pwn] = point @@ -156,8 +161,36 @@ read_off_points_and_normals( } /// @cond SKIP_IN_MANUAL -// This variant deduces the kernel from the point property map. template +bool +read_off_points_and_normals( + std::istream& stream, ///< input stream. + OutputIterator output, ///< output iterator over points. + PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3. + NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3. + const Kernel& kernel) ///< geometric traits. +{ + // just deduce value_type of OutputIterator + return read_off_points_and_normals + ::type>( + stream, + output, + point_pmap, + normal_pmap, + kernel); +} +//----------------------------------------------------------------------------------- +/// @endcond + +/// @cond SKIP_IN_MANUAL +// This variant deduces the kernel from the point property map. +//----------------------------------------------------------------------------------- +template @@ -170,17 +203,62 @@ read_off_points_and_normals( { typedef typename boost::property_traits::value_type Point; typedef typename Kernel_traits::Kernel Kernel; - return read_off_points_and_normals( + return read_off_points_and_normals + ( stream, output, point_pmap, normal_pmap, Kernel()); } + +template +bool +read_off_points_and_normals( + std::istream& stream, ///< input stream. + OutputIterator output, ///< output iterator over points. + PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3. + NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3. +{ + // just deduce value_type of OutputIterator + return read_off_points_and_normals + ::type>( + stream, + output, + point_pmap, + normal_pmap); +} +//----------------------------------------------------------------------------------- /// @endcond /// @cond SKIP_IN_MANUAL // This variant creates a default point property map = Typed_identity_property_map_by_reference. +//----------------------------------------------------------------------------------- +template +bool +read_off_points_and_normals( + std::istream& stream, ///< input stream. + OutputIterator output, ///< output iterator over points. + NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3. +{ + return read_off_points_and_normals + ( + stream, + output, +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + make_dereference_property_map(output), +#else + make_typed_identity_property_map_by_reference(OutputIteratorValueType()), +#endif + normal_pmap); +} + template @@ -190,17 +268,14 @@ read_off_points_and_normals( OutputIterator output, ///< output iterator over points. NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3. { - return read_off_points_and_normals( + // just deduce value_type of OutputIterator + return read_off_points_and_normals + ::type>( stream, output, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - make_dereference_property_map(output), -#else - make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), -#endif normal_pmap); } +//----------------------------------------------------------------------------------- /// @endcond @@ -211,6 +286,8 @@ read_off_points_and_normals( /// If the position is followed by the nx ny nz normal, then the normal will be ignored. /// Faces are ignored. /// +/// @tparam OutputIteratorValueType value_type of OutputIterator. +/// It is default to value_type_traits::type, and can be omitted when the default is fine. /// @tparam OutputIterator iterator over output points. /// @tparam PointPMap is a model of `WritablePropertyMap` with a value_type = Point_3. /// It can be omitted if OutputIterator value_type is convertible to Point_3. @@ -220,7 +297,9 @@ read_off_points_and_normals( /// @return true on success. // This variant requires all parameters. -template @@ -232,7 +311,8 @@ read_off_points( const Kernel& kernel) ///< geometric traits. { // Calls read_off_points_and_normals() with a normal property map = boost::dummy_property_map - return read_off_points_and_normals( + return read_off_points_and_normals + ( stream, output, point_pmap, @@ -241,8 +321,33 @@ read_off_points( } /// @cond SKIP_IN_MANUAL -// This variant deduces the kernel from the point property map. template +bool +read_off_points( + std::istream& stream, ///< input stream. + OutputIterator output, ///< output iterator over points. + PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3. + const Kernel& kernel) ///< geometric traits. +{ + // just deduce value_type of OutputIterator + return read_off_points + ::type>( + stream, + output, + point_pmap, + kernel); +} +//----------------------------------------------------------------------------------- +/// @endcond + +/// @cond SKIP_IN_MANUAL +// This variant deduces the kernel from the point property map. +//----------------------------------------------------------------------------------- +template bool @@ -253,16 +358,56 @@ read_off_points( { typedef typename boost::property_traits::value_type Point; typedef typename Kernel_traits::Kernel Kernel; - return read_off_points( + return read_off_points + ( stream, output, point_pmap, Kernel()); } + +template +bool +read_off_points( + std::istream& stream, ///< input stream. + OutputIterator output, ///< output iterator over points. + PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3. +{ + // just deduce value_type of OutputIterator + return read_off_points + ::type>( + stream, + output, + point_pmap); +} +//----------------------------------------------------------------------------------- /// @endcond /// @cond SKIP_IN_MANUAL // This variant creates a default point property map = Typed_identity_property_map_by_reference. +//----------------------------------------------------------------------------------- +template +bool +read_off_points( + std::istream& stream, ///< input stream. + OutputIterator output) ///< output iterator over points. +{ + return read_off_points + ( + stream, + output, +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + make_dereference_property_map(output) +#else + make_typed_identity_property_map_by_reference(OutputIteratorValueType()) +#endif + ); +} + template bool @@ -270,17 +415,14 @@ read_off_points( std::istream& stream, ///< input stream. OutputIterator output) ///< output iterator over points. { - return read_off_points( + // just deduce value_type of OutputIterator + return read_off_points + ::type>( stream, - output, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - make_dereference_property_map(output) -#else - make_typed_identity_property_map_by_reference( - typename value_type_traits::type()) -#endif - ); + output); } +//----------------------------------------------------------------------------------- + /// @endcond diff --git a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h index 5dec8c20517..cc88ca22097 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h @@ -46,6 +46,8 @@ namespace CGAL { /// The first line may contain the number of points in the file. /// Empty lines and comments starting by # character are allowed. /// +/// @tparam OutputIteratorValueType value_type of OutputIterator. +/// It is default to value_type_traits::type, and can be omitted when the default is fine. /// @tparam OutputIterator iterator over output points. /// @tparam PointPMap is a model of `WritablePropertyMap` with a value_type = Point_3. /// It can be omitted if OutputIterator value_type is convertible to Point_3. @@ -56,7 +58,9 @@ namespace CGAL { /// @return true on success. // This variant requires all parameters. -template ::type Enriched_point; + //typedef typename value_type_traits::type Enriched_point; + typedef OutputIteratorValueType Enriched_point; typedef typename Kernel::Point_3 Point; typedef typename Kernel::Vector_3 Vector; @@ -124,13 +129,13 @@ read_xyz_points_and_normals( } } Enriched_point pwn; - #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - put(point_pmap, &pwn, point); // point_pmap[&pwn] = point - put(normal_pmap, &pwn, normal); // normal_pmap[&pwn] = normal - #else - put(point_pmap, pwn, point); // point_pmap[pwn] = point - put(normal_pmap, pwn, normal); // normal_pmap[pwn] = normal - #endif + #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + put(point_pmap, &pwn, point); // point_pmap[&pwn] = point + put(normal_pmap, &pwn, normal); // normal_pmap[&pwn] = normal + #else + put(point_pmap, pwn, point); // point_pmap[pwn] = point + put(normal_pmap, pwn, normal); // normal_pmap[pwn] = normal + #endif *output++ = pwn; continue; } @@ -152,8 +157,36 @@ read_xyz_points_and_normals( } /// @cond SKIP_IN_MANUAL -// This variant deduces the kernel from the point property map. template +bool +read_xyz_points_and_normals( + std::istream& stream, ///< input stream. + OutputIterator output, ///< output iterator over points. + PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3. + NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3. + const Kernel& kernel) ///< geometric traits. +{ + // just deduce value_type of OutputIterator + return read_xyz_points_and_normals + ::type>( + stream, + output, + point_pmap, + normal_pmap, + kernel); +} +//----------------------------------------------------------------------------------- +/// @endcond + +/// @cond SKIP_IN_MANUAL +// This variant deduces the kernel from the point property map. +//----------------------------------------------------------------------------------- +template @@ -166,17 +199,62 @@ read_xyz_points_and_normals( { typedef typename boost::property_traits::value_type Point; typedef typename Kernel_traits::Kernel Kernel; - return read_xyz_points_and_normals( + return read_xyz_points_and_normals + ( stream, output, point_pmap, normal_pmap, Kernel()); } + +template +bool +read_xyz_points_and_normals( + std::istream& stream, ///< input stream. + OutputIterator output, ///< output iterator over points. + PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3. + NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3. +{ + // just deduce value_type of OutputIterator + return read_xyz_points_and_normals + ::type>( + stream, + output, + point_pmap, + normal_pmap); +} +//----------------------------------------------------------------------------------- /// @endcond /// @cond SKIP_IN_MANUAL // This variant creates a default point property map = Typed_identity_property_map_by_reference. +//----------------------------------------------------------------------------------- +template +bool +read_xyz_points_and_normals( + std::istream& stream, ///< input stream. + OutputIterator output, ///< output iterator over points. + NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3. +{ + return read_xyz_points_and_normals + ( + stream, + output, +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + make_dereference_property_map(output), +#else + make_typed_identity_property_map_by_reference(OutputIteratorValueType()), +#endif + normal_pmap); +} + template @@ -186,17 +264,14 @@ read_xyz_points_and_normals( OutputIterator output, ///< output iterator over points. NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3. { - return read_xyz_points_and_normals( + // just deduce value_type of OutputIterator + return read_xyz_points_and_normals + ::type>( stream, output, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - make_dereference_property_map(output), -#else - make_typed_identity_property_map_by_reference( - typename value_type_traits::type()), -#endif normal_pmap); } +//----------------------------------------------------------------------------------- /// @endcond @@ -208,6 +283,8 @@ read_xyz_points_and_normals( /// The first line may contain the number of points in the file. /// Empty lines and comments starting by # character are allowed. /// +/// @tparam OutputIteratorValueType value_type of OutputIterator. +/// It is default to value_type_traits::type, and can be omitted when the default is fine. /// @tparam OutputIterator iterator over output points. /// @tparam PointPMap is a model of `WritablePropertyMap` with a value_type = Point_3. /// It can be omitted if OutputIterator value_type is convertible to Point_3. @@ -217,7 +294,9 @@ read_xyz_points_and_normals( /// @return true on success. // This variant requires all parameters. -template @@ -229,7 +308,8 @@ read_xyz_points( const Kernel& kernel) ///< geometric traits. { // Calls read_xyz_points_and_normals() with a normal property map = boost::dummy_property_map - return read_xyz_points_and_normals( + return read_xyz_points_and_normals + ( stream, output, point_pmap, @@ -238,8 +318,33 @@ read_xyz_points( } /// @cond SKIP_IN_MANUAL -// This variant deduces the kernel from the point property map. template +bool +read_xyz_points( + std::istream& stream, ///< input stream. + OutputIterator output, ///< output iterator over points. + PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3. + const Kernel& kernel) ///< geometric traits. +{ + // just deduce value_type of OutputIterator + return read_xyz_points + ::type>( + stream, + output, + point_pmap, + kernel); +} +/// @endcond +//----------------------------------------------------------------------------------- + +/// @cond SKIP_IN_MANUAL +// This variant deduces the kernel from the point property map. +//----------------------------------------------------------------------------------- +template bool @@ -250,16 +355,56 @@ read_xyz_points( { typedef typename boost::property_traits::value_type Point; typedef typename Kernel_traits::Kernel Kernel; - return read_xyz_points( + return read_xyz_points + ( stream, output, point_pmap, Kernel()); } + +template +bool +read_xyz_points( + std::istream& stream, ///< input stream. + OutputIterator output, ///< output iterator over points. + PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3. +{ + // just deduce value_type of OutputIterator + return read_xyz_points + ::type>( + stream, + output, + point_pmap); +} +//----------------------------------------------------------------------------------- /// @endcond /// @cond SKIP_IN_MANUAL // This variant creates a default point property map = Typed_identity_property_map_by_reference. +//----------------------------------------------------------------------------------- +template +bool +read_xyz_points( + std::istream& stream, ///< input stream. + OutputIterator output) ///< output iterator over points. +{ + return read_xyz_points + ( + stream, + output, +#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + make_dereference_property_map(output) +#else + make_typed_identity_property_map_by_reference(OutputIteratorValueType()) +#endif + ); +} + template bool @@ -267,17 +412,13 @@ read_xyz_points( std::istream& stream, ///< input stream. OutputIterator output) ///< output iterator over points. { - return read_xyz_points( + // just deduce value_type of OutputIterator + return read_xyz_points + ::type>( stream, - output, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS - make_dereference_property_map(output) -#else - make_typed_identity_property_map_by_reference( - typename value_type_traits::type()) -#endif - ); + output); } +//----------------------------------------------------------------------------------- /// @endcond diff --git a/Point_set_processing_3/include/CGAL/value_type_traits.h b/Point_set_processing_3/include/CGAL/value_type_traits.h index bc77ccdec02..872fae9ab2c 100644 --- a/Point_set_processing_3/include/CGAL/value_type_traits.h +++ b/Point_set_processing_3/include/CGAL/value_type_traits.h @@ -24,16 +24,19 @@ namespace CGAL { -/// \cond SKIP_IN_MANUAL - /// Traits class to get the value type of any iterator, /// including an output iterator. -/// Based on code posted by Alberto Ganesh Barbati at -/// http://www.adras.com/Why-no-std-back-insert-iterator-value-type.t2639-153-3.html /// /// Usage is: -/// typedef typename value_type_traits::type value_type; - +/// \code +/// typedef typename value_type_traits::type value_type; +/// \endcode +/// +/// There are specializations for the following iterators to use value_type of a container: +/// - insert_iterator +/// - back_insert_iterator +/// - front_insert_iterator +/// template struct value_type_traits { @@ -46,7 +49,17 @@ struct value_type_traits > typedef typename T::value_type type; }; -/// \endcond +template +struct value_type_traits > +{ + typedef typename T::value_type type; +}; + +template +struct value_type_traits > +{ + typedef typename T::value_type type; +}; } //namespace CGAL From 93d89405f9b2d6a98086ddd7bdefe88b4737db56 Mon Sep 17 00:00:00 2001 From: iyaz Date: Wed, 8 May 2013 23:24:21 +0300 Subject: [PATCH 45/63] Add another test file for testing read functions with custom pmaps and output iterator type (also helpful to detect compilation problems) --- .../Point_set_processing_3/CMakeLists.txt | 1 + .../data/read_test/simple.off | 5 + .../data/read_test/simple.xyz | 3 + .../read_test_with_different_pmaps.cpp | 270 ++++++++++++++++++ 4 files changed, 279 insertions(+) create mode 100644 Point_set_processing_3/test/Point_set_processing_3/data/read_test/simple.off create mode 100644 Point_set_processing_3/test/Point_set_processing_3/data/read_test/simple.xyz create mode 100644 Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp diff --git a/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt b/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt index 59efc4dc9ed..a04095be37f 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt +++ b/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt @@ -50,6 +50,7 @@ if ( CGAL_FOUND ) # Executables that do *not* require LAPACK create_single_source_cgal_program( "read_test.cpp" ) + create_single_source_cgal_program( "read_test_with_different_pmaps.cpp" ) create_single_source_cgal_program( "analysis_test.cpp" ) create_single_source_cgal_program( "remove_outliers_test.cpp" ) diff --git a/Point_set_processing_3/test/Point_set_processing_3/data/read_test/simple.off b/Point_set_processing_3/test/Point_set_processing_3/data/read_test/simple.off new file mode 100644 index 00000000000..71f3a1ccc32 --- /dev/null +++ b/Point_set_processing_3/test/Point_set_processing_3/data/read_test/simple.off @@ -0,0 +1,5 @@ +OFF +3 0 0 +1 1 1 2 2 2 +3 3 3 4 4 4 +5 5 5 6 6 6 \ No newline at end of file diff --git a/Point_set_processing_3/test/Point_set_processing_3/data/read_test/simple.xyz b/Point_set_processing_3/test/Point_set_processing_3/data/read_test/simple.xyz new file mode 100644 index 00000000000..cdb89589b5a --- /dev/null +++ b/Point_set_processing_3/test/Point_set_processing_3/data/read_test/simple.xyz @@ -0,0 +1,3 @@ +1 1 1 2 2 2 +3 3 3 4 4 4 +5 5 5 6 6 6 \ No newline at end of file diff --git a/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp b/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp new file mode 100644 index 00000000000..385e7576941 --- /dev/null +++ b/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp @@ -0,0 +1,270 @@ +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +typedef CGAL::Simple_cartesian Kernel; +typedef Kernel::Point_3 Point_3; +typedef Kernel::Vector_3 Vector_3; +typedef std::pair PointVectorPair; + +// this is going to be custom OutputIterator value_type +struct dummy_counter { + static std::size_t counter; + + dummy_counter() { ++counter; } + operator std::size_t() { return counter-1; } +}; +std::size_t dummy_counter::counter = 0; + +bool check_points_and_vectors( + const boost::vector_property_map& points, + const boost::vector_property_map& normals, + const std::vector& pv_pairs, + const std::vector& indices) +{ + if(pv_pairs.size() != indices.size()) { + std::cerr << "Error: inconsistency between point / normal size." << std::endl; + return false; + } + + for(std::size_t i = 0; i < pv_pairs.size(); ++i ) { + if(pv_pairs[i].first != points[i]) { + std::cerr << "Error: points are not equal." << std::endl; + return false; + } + if(pv_pairs[i].second != normals[i]) { + std::cerr << "Error: normals are not equal." << std::endl; + return false; + } + } + return true; +} + +bool check_points( + const boost::vector_property_map& points_1, + const std::vector& points_2, + const std::vector& indices) +{ + if(points_2.size() != indices.size()) { + std::cerr << "Error: inconsistency between point / normal size." << std::endl; + return false; + } + + for(std::size_t i = 0; i < points_2.size(); ++i ) { + if(points_2[i] != points_1[i]) { + std::cerr << "Error: points are not equal." << std::endl; + return false; + } + } +} + +bool test_no_deduction_points_and_normals_xyz(const char* file_name) +{ + boost::vector_property_map points; + boost::vector_property_map normals; + std::vector indices; + + std::vector pv_pairs; + + // read with custom output iterator type + dummy_counter::counter = 0; + CGAL::read_xyz_points_and_normals( + std::ifstream(file_name), back_inserter(indices), points, normals, Kernel()); + + // read with ordinary pmaps + CGAL::read_xyz_points_and_normals( + std::ifstream(file_name), back_inserter(pv_pairs), + CGAL::First_of_pair_property_map(), + CGAL::Second_of_pair_property_map(), + Kernel()); + + return check_points_and_vectors(points, normals, pv_pairs, indices); +} + +bool test_no_deduction_points_and_normals_off(const char* file_name) +{ + boost::vector_property_map points; + boost::vector_property_map normals; + std::vector indices; + + std::vector pv_pairs; + + // read with custom output iterator type + dummy_counter::counter = 0; + CGAL::read_off_points_and_normals( + std::ifstream(file_name), back_inserter(indices), points, normals, Kernel()); + + // read with ordinary pmaps + CGAL::read_off_points_and_normals( + std::ifstream(file_name), back_inserter(pv_pairs), + CGAL::First_of_pair_property_map(), + CGAL::Second_of_pair_property_map(), + Kernel()); + + return check_points_and_vectors(points, normals, pv_pairs, indices); +} + +bool test_no_deduction_points_xyz(const char* file_name) +{ + boost::vector_property_map points_1; \ + std::vector indices; + + std::vector points_2; + + // read with custom output iterator type + dummy_counter::counter = 0; + CGAL::read_xyz_points( + std::ifstream(file_name), back_inserter(indices), points_1, Kernel()); + + // read with ordinary pmaps + CGAL::read_xyz_points( + std::ifstream(file_name), back_inserter(points_2), + CGAL::Typed_identity_property_map_by_reference(), + Kernel()); + + return check_points(points_1, points_2, indices); +} + +bool test_no_deduction_points_off(const char* file_name) +{ + boost::vector_property_map points_1; + std::vector indices; + + std::vector points_2; + + // read with custom output iterator type + dummy_counter::counter = 0; + CGAL::read_off_points( + std::ifstream(file_name), back_inserter(indices), points_1, Kernel()); + + // read with ordinary pmaps + CGAL::read_off_points( + std::ifstream(file_name), back_inserter(points_2), + CGAL::Typed_identity_property_map_by_reference(), + Kernel()); + + return check_points(points_1, points_2, indices); +} + +void compile_test() { + std::deque points; + std::deque normals; + std::deque pv_pairs; + + CGAL::read_xyz_points( + std::ifstream("data/read_test/simple.xyz"), + std::front_inserter(points)); + + CGAL::read_xyz_points( + std::ifstream("data/read_test/simple.xyz"), + std::front_inserter(points), + CGAL::Typed_identity_property_map_by_reference()); + + CGAL::read_xyz_points( + std::ifstream("data/read_test/simple.xyz"), + std::front_inserter(points), + CGAL::Typed_identity_property_map_by_reference(), + Kernel()); + // this will span all OutputIteratorValueType versions + CGAL::read_xyz_points( + std::ifstream("data/read_test/simple.xyz"), + std::front_inserter(points)); + //----------------------------------------------------------------------- + CGAL::read_off_points( + std::ifstream("data/read_test/simple.off"), + std::front_inserter(points)); + + CGAL::read_off_points( + std::ifstream("data/read_test/simple.off"), + std::front_inserter(points), + CGAL::Typed_identity_property_map_by_reference()); + + CGAL::read_off_points( + std::ifstream("data/read_test/simple.off"), + std::front_inserter(points), + CGAL::Typed_identity_property_map_by_reference(), + Kernel()); + // this will span all OutputIteratorValueType versions + CGAL::read_off_points( + std::ifstream("data/read_test/simple.off"), + std::front_inserter(points)); + //----------------------------------------------------------------------- + CGAL::read_xyz_points_and_normals( + std::ifstream("data/read_test/simple.xyz"), + std::front_inserter(points), + boost::dummy_property_map()); + + CGAL::read_xyz_points_and_normals( + std::ifstream("data/read_test/simple.xyz"), + std::front_inserter(pv_pairs), + CGAL::First_of_pair_property_map(), + CGAL::Second_of_pair_property_map()); + + CGAL::read_xyz_points_and_normals( + std::ifstream("data/read_test/simple.xyz"), + std::front_inserter(pv_pairs), + CGAL::First_of_pair_property_map(), + CGAL::Second_of_pair_property_map(), + Kernel()); + + CGAL::read_xyz_points_and_normals( + std::ifstream("data/read_test/simple.xyz"), + std::front_inserter(points), + boost::dummy_property_map()); + //----------------------------------------------------------------------- + CGAL::read_off_points_and_normals( + std::ifstream("data/read_test/simple.off"), + std::front_inserter(points), + boost::dummy_property_map()); + + CGAL::read_off_points_and_normals( + std::ifstream("data/read_test/simple.off"), + std::front_inserter(pv_pairs), + CGAL::First_of_pair_property_map(), + CGAL::Second_of_pair_property_map()); + + CGAL::read_off_points_and_normals( + std::ifstream("data/read_test/simple.off"), + std::front_inserter(pv_pairs), + CGAL::First_of_pair_property_map(), + CGAL::Second_of_pair_property_map(), + Kernel()); + + CGAL::read_off_points_and_normals( + std::ifstream("data/read_test/simple.off"), + std::front_inserter(points), + boost::dummy_property_map()); +} + +int main() { + if(!test_no_deduction_points_and_normals_xyz("data/read_test/simple.xyz")) { + return EXIT_FAILURE; + } + std::cerr << "test_no_deduction_points_and_normals_xyz OK." << std::endl; + + if(!test_no_deduction_points_and_normals_off("data/read_test/simple.off")) { + return EXIT_FAILURE; + } + std::cerr << "test_no_deduction_points_and_normals_off OK." << std::endl; + + if(!test_no_deduction_points_xyz("data/read_test/simple.xyz")) { + return EXIT_FAILURE; + } + std::cerr << "test_no_deduction_points_xyz OK." << std::endl; + + if(!test_no_deduction_points_off("data/read_test/simple.off")) { + return EXIT_FAILURE; + } + std::cerr << "test_no_deduction_points_off OK." << std::endl; + + compile_test(); + return EXIT_SUCCESS; +} \ No newline at end of file From 00f547e9574c27ac6b54505924705e33e303a9bd Mon Sep 17 00:00:00 2001 From: iyaz Date: Thu, 9 May 2013 00:27:44 +0300 Subject: [PATCH 46/63] add overload for output iterator value type --- .../output_surface_facets_to_triangle_soup.h | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Surface_reconstruction_points_3/include/CGAL/IO/output_surface_facets_to_triangle_soup.h b/Surface_reconstruction_points_3/include/CGAL/IO/output_surface_facets_to_triangle_soup.h index ff3574bf088..26b0b5efaa4 100644 --- a/Surface_reconstruction_points_3/include/CGAL/IO/output_surface_facets_to_triangle_soup.h +++ b/Surface_reconstruction_points_3/include/CGAL/IO/output_surface_facets_to_triangle_soup.h @@ -32,9 +32,12 @@ namespace CGAL { /// This variant exports the surface as a triangle soup. /// /// @commentheading Template Parameters: -/// @param SurfaceMeshComplex_2InTriangulation_3 model of the SurfaceMeshComplex_2InTriangulation_3 concept. -/// @param OutputIterator value_type must be convertible from Triangle_3. -template ::type, and can be omitted when the default is fine. +/// @tparam SurfaceMeshComplex_2InTriangulation_3 model of the SurfaceMeshComplex_2InTriangulation_3 concept. +/// @tparam OutputIterator value_type must be convertible from Triangle_3. +template void output_surface_facets_to_triangle_soup( @@ -48,7 +51,8 @@ output_surface_facets_to_triangle_soup( typedef typename Tr::Point Point; // value_type_traits is a workaround as back_insert_iterator's value_type is void - typedef typename value_type_traits::type Triangle; + // typedef typename value_type_traits::type Triangle; + typedef OutputIteratorValueType Triangle; const Tr& tr = c2t3.triangulation(); @@ -70,6 +74,17 @@ output_surface_facets_to_triangle_soup( } } +template +void +output_surface_facets_to_triangle_soup( + const SurfaceMeshComplex_2InTriangulation_3& c2t3, ///< Input surface. + OutputIterator output_iterator) +{ + output_surface_facets_to_triangle_soup + ::type> + (c2t3, output_iterator); +} } //namespace CGAL From f28c0b042a7ff2fbfa4f54732f8d06df17fe25fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 13 May 2013 10:03:20 +0200 Subject: [PATCH 47/63] update doc of value_type_traits --- .../include/CGAL/value_type_traits.h | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/value_type_traits.h b/Point_set_processing_3/include/CGAL/value_type_traits.h index 872fae9ab2c..63f94945988 100644 --- a/Point_set_processing_3/include/CGAL/value_type_traits.h +++ b/Point_set_processing_3/include/CGAL/value_type_traits.h @@ -24,41 +24,40 @@ namespace CGAL { -/// Traits class to get the value type of any iterator, -/// including an output iterator. +/// \ingroup PkgPointSetProcessing +/// Class providing the value type of an iterator, and +/// in the case of an output iterator, a type of objects that can be put in it. /// -/// Usage is: -/// \code -/// typedef typename value_type_traits::type value_type; -/// \endcode -/// -/// There are specializations for the following iterators to use value_type of a container: -/// - insert_iterator -/// - back_insert_iterator -/// - front_insert_iterator -/// template struct value_type_traits { + #ifndef DOXYGEN_RUNNING typedef typename std::iterator_traits::value_type type; + #else + /// If `T` is `std::insert_iterator`, `std::back_insert_iterator` or + /// `std::front_insert_iterator`, then `type` is `Container::value_type`. + /// Otherwise, `type` is `std::iterator_traits::%value_type`. + + typedef Hidden_type type; + #endif }; -template -struct value_type_traits > +template +struct value_type_traits > { - typedef typename T::value_type type; + typedef typename Container::value_type type; }; -template -struct value_type_traits > +template +struct value_type_traits > { - typedef typename T::value_type type; + typedef typename Container::value_type type; }; -template -struct value_type_traits > +template +struct value_type_traits > { - typedef typename T::value_type type; + typedef typename Container::value_type type; }; } //namespace CGAL From f91eac468e2cac4ec4e46941910934da6b0268d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 13 May 2013 10:59:15 +0200 Subject: [PATCH 48/63] enhance documentation --- Point_set_processing_3/include/CGAL/IO/read_off_points.h | 8 ++++---- Point_set_processing_3/include/CGAL/IO/read_xyz_points.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/IO/read_off_points.h b/Point_set_processing_3/include/CGAL/IO/read_off_points.h index e5c588bbdec..6141d702c6b 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_off_points.h @@ -45,8 +45,8 @@ namespace CGAL { /// optionally followed by the nx ny nz normal. /// Faces are ignored. /// -/// @tparam OutputIteratorValueType value_type of OutputIterator. -/// It is default to value_type_traits::type, and can be omitted when the default is fine. +/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`. +/// It is default to `value_type_traits::type` and can be omitted when the default is fine. /// @tparam OutputIterator iterator over output points. /// @tparam PointPMap is a model of `WritablePropertyMap` with a value_type = Point_3. /// It can be omitted if OutputIterator value_type is convertible to Point_3. @@ -286,8 +286,8 @@ read_off_points_and_normals( /// If the position is followed by the nx ny nz normal, then the normal will be ignored. /// Faces are ignored. /// -/// @tparam OutputIteratorValueType value_type of OutputIterator. -/// It is default to value_type_traits::type, and can be omitted when the default is fine. +/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`. +/// It is default to `value_type_traits::type` and can be omitted when the default is fine. /// @tparam OutputIterator iterator over output points. /// @tparam PointPMap is a model of `WritablePropertyMap` with a value_type = Point_3. /// It can be omitted if OutputIterator value_type is convertible to Point_3. diff --git a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h index cc88ca22097..fe324f9554c 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h @@ -46,8 +46,8 @@ namespace CGAL { /// The first line may contain the number of points in the file. /// Empty lines and comments starting by # character are allowed. /// -/// @tparam OutputIteratorValueType value_type of OutputIterator. -/// It is default to value_type_traits::type, and can be omitted when the default is fine. +/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`. +/// It is default to `value_type_traits::type` and can be omitted when the default is fine. /// @tparam OutputIterator iterator over output points. /// @tparam PointPMap is a model of `WritablePropertyMap` with a value_type = Point_3. /// It can be omitted if OutputIterator value_type is convertible to Point_3. @@ -283,8 +283,8 @@ read_xyz_points_and_normals( /// The first line may contain the number of points in the file. /// Empty lines and comments starting by # character are allowed. /// -/// @tparam OutputIteratorValueType value_type of OutputIterator. -/// It is default to value_type_traits::type, and can be omitted when the default is fine. +/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`. +/// It is default to `value_type_traits::type` and can be omitted when the default is fine. /// @tparam OutputIterator iterator over output points. /// @tparam PointPMap is a model of `WritablePropertyMap` with a value_type = Point_3. /// It can be omitted if OutputIterator value_type is convertible to Point_3. From 677bc07a4d04ecbcbe9a5bb9f6cba409a81d44ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 13 May 2013 11:38:07 +0200 Subject: [PATCH 49/63] rename Typed_identity_property_map_by_reference to Identity_property_map and update its documentation --- .../remove_outliers_example.cpp | 8 ++++---- .../include/CGAL/IO/read_off_points.h | 8 ++++---- .../include/CGAL/IO/read_xyz_points.h | 8 ++++---- .../include/CGAL/IO/write_off_points.h | 8 ++++---- .../include/CGAL/IO/write_xyz_points.h | 8 ++++---- .../include/CGAL/compute_average_spacing.h | 4 ++-- .../include/CGAL/grid_simplify_point_set.h | 4 ++-- .../include/CGAL/improved_jet_smooth_point_set.h | 4 ++-- .../CGAL/improved_laplacian_smooth_point_set.h | 4 ++-- .../include/CGAL/jet_estimate_normals.h | 4 ++-- .../include/CGAL/jet_smooth_point_set.h | 4 ++-- .../include/CGAL/mst_orient_normals.h | 4 ++-- .../include/CGAL/pca_estimate_normals.h | 4 ++-- .../include/CGAL/pca_smooth_point_set.h | 4 ++-- .../include/CGAL/property_map.h | 16 ++++++++-------- .../include/CGAL/radial_orient_normals.h | 4 ++-- .../include/CGAL/random_simplify_point_set.h | 4 ++-- .../include/CGAL/remove_outliers.h | 4 ++-- .../remove_outliers_wrt_median_knn_sq_distance.h | 4 ++-- .../read_test_with_different_pmaps.cpp | 12 ++++++------ .../CGAL/Poisson_reconstruction_function.h | 4 ++-- .../CGAL/Reconstruction_triangulation_3.h | 4 ++-- 22 files changed, 64 insertions(+), 64 deletions(-) diff --git a/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp index 07a5febe322..778e134d61f 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp @@ -13,23 +13,23 @@ typedef Kernel::Point_3 Point; int main(void) { // Reads a .xyz point set file in points[]. - // The Typed_identity_property_map_by_reference property map can be omitted here as it is the default value. + // The Identity_property_map property map can be omitted here as it is the default value. std::vector points; std::ifstream stream("data/oni.xyz"); if (!stream || !CGAL::read_xyz_points(stream, std::back_inserter(points), - CGAL::Typed_identity_property_map_by_reference())) + CGAL::Identity_property_map())) { std::cerr << "Error: cannot read file data/oni.xyz" << std::endl; return EXIT_FAILURE; } // Removes outliers using erase-remove idiom. - // The Typed_identity_property_map_by_reference property map can be omitted here as it is the default value. + // The Identity_property_map property map can be omitted here as it is the default value. const double removed_percentage = 5.0; // percentage of points to remove const int nb_neighbors = 24; // considers 24 nearest neighbor points points.erase(CGAL::remove_outliers(points.begin(), points.end(), - CGAL::Typed_identity_property_map_by_reference(), + CGAL::Identity_property_map(), nb_neighbors, removed_percentage), points.end()); diff --git a/Point_set_processing_3/include/CGAL/IO/read_off_points.h b/Point_set_processing_3/include/CGAL/IO/read_off_points.h index 6141d702c6b..eb605fd4b32 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_off_points.h @@ -235,7 +235,7 @@ read_off_points_and_normals( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Typed_identity_property_map_by_reference. +// This variant creates a default point property map = Identity_property_map. //----------------------------------------------------------------------------------- template @@ -144,7 +144,7 @@ write_off_points_and_normals( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), #else - make_typed_identity_property_map_by_reference( + make_identity_property_map( typename std::iterator_traits::value_type()), #endif normal_pmap); @@ -231,7 +231,7 @@ write_off_points( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Typed_identity_property_map_by_reference. +// This variant creates a default point property map = Identity_property_map. template bool @@ -246,7 +246,7 @@ write_off_points( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first) #else - make_typed_identity_property_map_by_reference( + make_identity_property_map( typename std::iterator_traits::value_type()) #endif ); 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 7533b746e9b..f36e812cfef 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 @@ -122,7 +122,7 @@ write_xyz_points_and_normals( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Typed_identity_property_map_by_reference. +// This variant creates a default point property map = Identity_property_map. template @@ -139,7 +139,7 @@ write_xyz_points_and_normals( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(output), #else - make_typed_identity_property_map_by_reference( + make_identity_property_map( typename std::iterator_traits::value_type()), #endif normal_pmap); @@ -222,7 +222,7 @@ write_xyz_points( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Typed_identity_property_map_by_reference. +// This variant creates a default point property map = Identity_property_map. template bool @@ -237,7 +237,7 @@ write_xyz_points( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(output) #else - make_typed_identity_property_map_by_reference( + make_identity_property_map( typename std::iterator_traits::value_type()) #endif ); 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 49dc48ecb51..2bb75b8ec0e 100644 --- a/Point_set_processing_3/include/CGAL/compute_average_spacing.h +++ b/Point_set_processing_3/include/CGAL/compute_average_spacing.h @@ -193,7 +193,7 @@ compute_average_spacing( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Typed_identity_property_map_by_reference. +// This variant creates a default point property map = Identity_property_map. template < typename InputIterator > typename Kernel_traits::value_type>::Kernel::FT compute_average_spacing( @@ -206,7 +206,7 @@ compute_average_spacing( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), #else - make_typed_identity_property_map_by_reference( + make_identity_property_map( typename std::iterator_traits::value_type()), #endif k); 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 3d973a0c541..c622b395471 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 @@ -207,7 +207,7 @@ grid_simplify_point_set( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Typed_identity_property_map_by_reference. +// This variant creates a default point property map = Identity_property_map. template ForwardIterator @@ -221,7 +221,7 @@ grid_simplify_point_set( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), #else - make_typed_identity_property_map_by_reference( + make_identity_property_map( typename std::iterator_traits::value_type()), #endif epsilon); diff --git a/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h b/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h index a421bb6a45b..4b46691cc78 100644 --- a/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h @@ -341,7 +341,7 @@ improved_jet_smooth_point_set( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Typed_identity_property_map_by_reference. +// This variant creates a default point property map = Identity_property_map. template @@ -359,7 +359,7 @@ improved_jet_smooth_point_set( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), #else - make_typed_identity_property_map_by_reference( + make_identity_property_map( typename std::iterator_traits::value_type()), #endif k, diff --git a/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h b/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h index 90cb9874784..63217fa1581 100644 --- a/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h @@ -321,7 +321,7 @@ improved_laplacian_smooth_point_set( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Typed_identity_property_map_by_reference. +// This variant creates a default point property map = Identity_property_map. template @@ -339,7 +339,7 @@ improved_laplacian_smooth_point_set( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), #else - make_typed_identity_property_map_by_reference( + make_identity_property_map( typename std::iterator_traits::value_type()), #endif k, 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 b7320fe18a9..5c7e56478dd 100644 --- a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h @@ -233,7 +233,7 @@ jet_estimate_normals( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Typed_identity_property_map_by_reference. +// This variant creates a default point property map = Identity_property_map. template @@ -250,7 +250,7 @@ jet_estimate_normals( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), #else - make_typed_identity_property_map_by_reference( + make_identity_property_map( typename std::iterator_traits::value_type()), #endif normal_pmap, 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 1592c1a729f..f6a154cab4f 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 @@ -209,7 +209,7 @@ jet_smooth_point_set( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Typed_identity_property_map_by_reference. +// This variant creates a default point property map = Identity_property_map. template void @@ -225,7 +225,7 @@ jet_smooth_point_set( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), #else - make_typed_identity_property_map_by_reference( + make_identity_property_map( typename std::iterator_traits::value_type()), #endif k, 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 f60806e709c..beda025c129 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -687,7 +687,7 @@ mst_orient_normals( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Typed_identity_property_map_by_reference. +// This variant creates a default point property map = Identity_property_map. template @@ -703,7 +703,7 @@ mst_orient_normals( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), #else - make_typed_identity_property_map_by_reference( + make_identity_property_map( typename std::iterator_traits::value_type()), #endif normal_pmap, 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 76dd71d718d..9097cb3b06d 100644 --- a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h @@ -224,7 +224,7 @@ pca_estimate_normals( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Typed_identity_property_map_by_reference. +// This variant creates a default point property map = Identity_property_map. template @@ -240,7 +240,7 @@ pca_estimate_normals( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), #else - make_typed_identity_property_map_by_reference( + make_identity_property_map( typename std::iterator_traits::value_type()), #endif normal_pmap, diff --git a/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h b/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h index b42f3a007ff..39be3e18a5c 100644 --- a/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h @@ -199,7 +199,7 @@ pca_smooth_point_set( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Typed_identity_property_map_by_reference. +// This variant creates a default point property map = Identity_property_map. template void @@ -213,7 +213,7 @@ pca_smooth_point_set( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), #else - make_typed_identity_property_map_by_reference( + make_identity_property_map( typename std::iterator_traits::value_type()), #endif k); diff --git a/Point_set_processing_3/include/CGAL/property_map.h b/Point_set_processing_3/include/CGAL/property_map.h index 49986513842..73993ac73a5 100644 --- a/Point_set_processing_3/include/CGAL/property_map.h +++ b/Point_set_processing_3/include/CGAL/property_map.h @@ -67,11 +67,11 @@ make_dereference_property_map(Iter) } /// \ingroup PkgProperty_map -/// Property map that maps a key to itself. +/// A `LvaluePropertyMap` property map mapping a key to itself (by reference). /// /// \cgalModels `LvaluePropertyMap` template -struct Typed_identity_property_map_by_reference +struct Identity_property_map { typedef T key_type; ///< typedef to `T` typedef T value_type; ///< typedef to `T` @@ -81,7 +81,7 @@ struct Typed_identity_property_map_by_reference /// @param k a key which is returned as mapped value. reference operator[](key_type& k) const { return k; } - typedef Typed_identity_property_map_by_reference Self; + typedef Identity_property_map Self; /// \name Put/get free functions /// @{ friend const value_type& get(const Self&,const key_type& k) {return k;} @@ -90,14 +90,14 @@ struct Typed_identity_property_map_by_reference /// @} }; -/// Free function to create a `Typed_identity_property_map_by_reference` property map. +/// Free function to create a `Identity_property_map` property map. /// -/// \relates Typed_identity_property_map_by_reference +/// \relates Identity_property_map template // Key and value type -Typed_identity_property_map_by_reference - make_typed_identity_property_map_by_reference(T) +Identity_property_map + make_identity_property_map(T) { - return Typed_identity_property_map_by_reference(); + return Identity_property_map(); } 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 4ad59f117f2..a0b3a5924b3 100644 --- a/Point_set_processing_3/include/CGAL/radial_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/radial_orient_normals.h @@ -164,7 +164,7 @@ radial_orient_normals( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Typed_identity_property_map_by_reference. +// This variant creates a default point property map = Identity_property_map. template @@ -179,7 +179,7 @@ radial_orient_normals( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), #else - make_typed_identity_property_map_by_reference( + make_identity_property_map( typename std::iterator_traits::value_type()), #endif normal_pmap); diff --git a/Point_set_processing_3/include/CGAL/random_simplify_point_set.h b/Point_set_processing_3/include/CGAL/random_simplify_point_set.h index 30c7ef1ca43..ffa71bba444 100644 --- a/Point_set_processing_3/include/CGAL/random_simplify_point_set.h +++ b/Point_set_processing_3/include/CGAL/random_simplify_point_set.h @@ -95,7 +95,7 @@ random_simplify_point_set( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Typed_identity_property_map_by_reference. +// This variant creates a default point property map = Identity_property_map. template ForwardIterator @@ -109,7 +109,7 @@ random_simplify_point_set( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), #else - make_typed_identity_property_map_by_reference( + make_identity_property_map( typename std::iterator_traits::value_type()), #endif removed_percentage); diff --git a/Point_set_processing_3/include/CGAL/remove_outliers.h b/Point_set_processing_3/include/CGAL/remove_outliers.h index 41bc4bfd9b9..bf1cc9a2523 100644 --- a/Point_set_processing_3/include/CGAL/remove_outliers.h +++ b/Point_set_processing_3/include/CGAL/remove_outliers.h @@ -230,7 +230,7 @@ remove_outliers( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Typed_identity_property_map_by_reference. +// This variant creates a default point property map = Identity_property_map. template InputIterator @@ -245,7 +245,7 @@ remove_outliers( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), #else - make_typed_identity_property_map_by_reference( + make_identity_property_map( typename std::iterator_traits::value_type()), #endif k,threshold_percent); diff --git a/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h b/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h index cae10a356fd..26e04248614 100644 --- a/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h +++ b/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h @@ -228,7 +228,7 @@ remove_outliers_wrt_median_knn_sq_distance( /// @endcond /// @cond SKIP_IN_MANUAL -// This variant creates a default point property map = Typed_identity_property_map_by_reference. +// This variant creates a default point property map = Identity_property_map. template InputIterator @@ -243,7 +243,7 @@ remove_outliers_wrt_median_knn_sq_distance( #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), #else - make_typed_identity_property_map_by_reference( + make_identity_property_map( typename std::iterator_traits::value_type()), #endif k,threshold_percent); diff --git a/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp b/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp index 385e7576941..1bb3c5f5166 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp @@ -127,7 +127,7 @@ bool test_no_deduction_points_xyz(const char* file_name) // read with ordinary pmaps CGAL::read_xyz_points( std::ifstream(file_name), back_inserter(points_2), - CGAL::Typed_identity_property_map_by_reference(), + CGAL::Identity_property_map(), Kernel()); return check_points(points_1, points_2, indices); @@ -148,7 +148,7 @@ bool test_no_deduction_points_off(const char* file_name) // read with ordinary pmaps CGAL::read_off_points( std::ifstream(file_name), back_inserter(points_2), - CGAL::Typed_identity_property_map_by_reference(), + CGAL::Identity_property_map(), Kernel()); return check_points(points_1, points_2, indices); @@ -166,12 +166,12 @@ void compile_test() { CGAL::read_xyz_points( std::ifstream("data/read_test/simple.xyz"), std::front_inserter(points), - CGAL::Typed_identity_property_map_by_reference()); + CGAL::Identity_property_map()); CGAL::read_xyz_points( std::ifstream("data/read_test/simple.xyz"), std::front_inserter(points), - CGAL::Typed_identity_property_map_by_reference(), + CGAL::Identity_property_map(), Kernel()); // this will span all OutputIteratorValueType versions CGAL::read_xyz_points( @@ -185,12 +185,12 @@ void compile_test() { CGAL::read_off_points( std::ifstream("data/read_test/simple.off"), std::front_inserter(points), - CGAL::Typed_identity_property_map_by_reference()); + CGAL::Identity_property_map()); CGAL::read_off_points( std::ifstream("data/read_test/simple.off"), std::front_inserter(points), - CGAL::Typed_identity_property_map_by_reference(), + CGAL::Identity_property_map(), Kernel()); // this will span all OutputIteratorValueType versions CGAL::read_off_points( diff --git a/Surface_reconstruction_points_3/include/CGAL/Poisson_reconstruction_function.h b/Surface_reconstruction_points_3/include/CGAL/Poisson_reconstruction_function.h index d6e53b1ac3b..3b69aaddd4e 100644 --- a/Surface_reconstruction_points_3/include/CGAL/Poisson_reconstruction_function.h +++ b/Surface_reconstruction_points_3/include/CGAL/Poisson_reconstruction_function.h @@ -325,7 +325,7 @@ public: forward_constructor(first, beyond, point_pmap, normal_pmap, visitor); } - // This variant creates a default point property map = Typed_identity_property_map_by_reference and Visitor=Poisson_visitor + // This variant creates a default point property map = Identity_property_map and Visitor=Poisson_visitor template @@ -344,7 +344,7 @@ public: #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS make_dereference_property_map(first), #else - make_typed_identity_property_map_by_reference( + make_identity_property_map( typename std::iterator_traits::value_type()), #endif normal_pmap, Poisson_visitor()); diff --git a/Surface_reconstruction_points_3/include/CGAL/Reconstruction_triangulation_3.h b/Surface_reconstruction_points_3/include/CGAL/Reconstruction_triangulation_3.h index b246e593f24..0860fae1d4c 100644 --- a/Surface_reconstruction_points_3/include/CGAL/Reconstruction_triangulation_3.h +++ b/Surface_reconstruction_points_3/include/CGAL/Reconstruction_triangulation_3.h @@ -440,7 +440,7 @@ public: } /// \cond SKIP_IN_MANUAL - // This variant creates a default point property map = Typed_identity_property_map_by_reference. + // This variant creates a default point property map = Identity_property_map. template ::value_type()), #endif normal_pmap, From 0e5d52457794382b424b10a073711a4f5954e39d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 5 Jun 2013 09:02:31 +0200 Subject: [PATCH 50/63] CGAL::Typed_identity_property_map_by_reference has been renamed, update missed examples --- .../examples/Point_set_processing_3/property_map.cpp | 2 +- .../Surface_reconstruction_points_3/poisson_reconstruction.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp b/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp index 7e24b94e3bc..78ae3802532 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp @@ -67,7 +67,7 @@ template void process_point_set(Iterator beg, Iterator end) { process_point_set(beg,end, - CGAL::make_typed_identity_property_map_by_reference( + CGAL::make_identity_property_map( typename CGAL::value_type_traits::type()) ); } diff --git a/Surface_reconstruction_points_3/examples/Surface_reconstruction_points_3/poisson_reconstruction.cpp b/Surface_reconstruction_points_3/examples/Surface_reconstruction_points_3/poisson_reconstruction.cpp index 4975fa69f9e..ef703c4ead6 100644 --- a/Surface_reconstruction_points_3/examples/Surface_reconstruction_points_3/poisson_reconstruction.cpp +++ b/Surface_reconstruction_points_3/examples/Surface_reconstruction_points_3/poisson_reconstruction.cpp @@ -269,7 +269,7 @@ int main(int argc, char * argv[]) // The position property map can be omitted here as we use iterators over Point_3 elements. Poisson_reconstruction_function function( points.begin(), points.end(), - CGAL::make_typed_identity_property_map_by_reference(PointList::value_type()), + CGAL::make_identity_property_map(PointList::value_type()), CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()), visitor); From d8990ec5f5dcd6c46a431a58b857e38498a58c86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 5 Jun 2013 09:03:28 +0200 Subject: [PATCH 51/63] ifstream are taken by reference, an lvalue is required --- .../read_test_with_different_pmaps.cpp | 102 +++++++++++++----- 1 file changed, 75 insertions(+), 27 deletions(-) diff --git a/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp b/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp index 1bb3c5f5166..fdcd6330a97 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp @@ -64,6 +64,7 @@ bool check_points( return false; } } + return true; } bool test_no_deduction_points_and_normals_xyz(const char* file_name) @@ -76,12 +77,15 @@ bool test_no_deduction_points_and_normals_xyz(const char* file_name) // read with custom output iterator type dummy_counter::counter = 0; + std::ifstream input(file_name); CGAL::read_xyz_points_and_normals( - std::ifstream(file_name), back_inserter(indices), points, normals, Kernel()); + input, back_inserter(indices), points, normals, Kernel()); // read with ordinary pmaps + input.close(); + input.open(file_name); CGAL::read_xyz_points_and_normals( - std::ifstream(file_name), back_inserter(pv_pairs), + input, back_inserter(pv_pairs), CGAL::First_of_pair_property_map(), CGAL::Second_of_pair_property_map(), Kernel()); @@ -99,12 +103,15 @@ bool test_no_deduction_points_and_normals_off(const char* file_name) // read with custom output iterator type dummy_counter::counter = 0; + std::ifstream input(file_name); CGAL::read_off_points_and_normals( - std::ifstream(file_name), back_inserter(indices), points, normals, Kernel()); + input, back_inserter(indices), points, normals, Kernel()); // read with ordinary pmaps + input.close(); + input.open(file_name); CGAL::read_off_points_and_normals( - std::ifstream(file_name), back_inserter(pv_pairs), + input, back_inserter(pv_pairs), CGAL::First_of_pair_property_map(), CGAL::Second_of_pair_property_map(), Kernel()); @@ -121,12 +128,15 @@ bool test_no_deduction_points_xyz(const char* file_name) // read with custom output iterator type dummy_counter::counter = 0; + std::ifstream input(file_name); CGAL::read_xyz_points( - std::ifstream(file_name), back_inserter(indices), points_1, Kernel()); + input, back_inserter(indices), points_1, Kernel()); // read with ordinary pmaps + input.close(); + input.open(file_name); CGAL::read_xyz_points( - std::ifstream(file_name), back_inserter(points_2), + input, back_inserter(points_2), CGAL::Identity_property_map(), Kernel()); @@ -142,12 +152,15 @@ bool test_no_deduction_points_off(const char* file_name) // read with custom output iterator type dummy_counter::counter = 0; + std::ifstream input(file_name); CGAL::read_off_points( - std::ifstream(file_name), back_inserter(indices), points_1, Kernel()); + input, back_inserter(indices), points_1, Kernel()); // read with ordinary pmaps + input.close(); + input.open(file_name); CGAL::read_off_points( - std::ifstream(file_name), back_inserter(points_2), + input, back_inserter(points_2), CGAL::Identity_property_map(), Kernel()); @@ -158,90 +171,125 @@ void compile_test() { std::deque points; std::deque normals; std::deque pv_pairs; - + std::ifstream input; + + input.open("data/read_test/simple.xyz"); CGAL::read_xyz_points( - std::ifstream("data/read_test/simple.xyz"), + input, std::front_inserter(points)); - + input.close(); + + input.open("data/read_test/simple.xyz"); CGAL::read_xyz_points( - std::ifstream("data/read_test/simple.xyz"), + input, std::front_inserter(points), CGAL::Identity_property_map()); + input.close(); + input.open("data/read_test/simple.xyz"); CGAL::read_xyz_points( - std::ifstream("data/read_test/simple.xyz"), + input, std::front_inserter(points), CGAL::Identity_property_map(), Kernel()); + input.close(); + // this will span all OutputIteratorValueType versions + input.open("data/read_test/simple.xyz"); CGAL::read_xyz_points( - std::ifstream("data/read_test/simple.xyz"), + input, std::front_inserter(points)); + input.close(); //----------------------------------------------------------------------- + input.open("data/read_test/simple.off"); CGAL::read_off_points( - std::ifstream("data/read_test/simple.off"), + input, std::front_inserter(points)); - + input.close(); + + input.open("data/read_test/simple.off"); CGAL::read_off_points( - std::ifstream("data/read_test/simple.off"), + input, std::front_inserter(points), CGAL::Identity_property_map()); + input.close(); + input.open("data/read_test/simple.off"); CGAL::read_off_points( - std::ifstream("data/read_test/simple.off"), + input, std::front_inserter(points), CGAL::Identity_property_map(), Kernel()); + input.close(); + // this will span all OutputIteratorValueType versions + input.open("data/read_test/simple.off"); CGAL::read_off_points( - std::ifstream("data/read_test/simple.off"), + input, std::front_inserter(points)); + input.close(); //----------------------------------------------------------------------- + input.open("data/read_test/simple.xyz"); CGAL::read_xyz_points_and_normals( - std::ifstream("data/read_test/simple.xyz"), + input, std::front_inserter(points), boost::dummy_property_map()); + input.close(); + input.open("data/read_test/simple.xyz"); CGAL::read_xyz_points_and_normals( - std::ifstream("data/read_test/simple.xyz"), + input, std::front_inserter(pv_pairs), CGAL::First_of_pair_property_map(), CGAL::Second_of_pair_property_map()); + input.close(); + input.open("data/read_test/simple.xyz"); CGAL::read_xyz_points_and_normals( - std::ifstream("data/read_test/simple.xyz"), + input, std::front_inserter(pv_pairs), CGAL::First_of_pair_property_map(), CGAL::Second_of_pair_property_map(), Kernel()); + input.close(); + input.open("data/read_test/simple.xyz"); CGAL::read_xyz_points_and_normals( - std::ifstream("data/read_test/simple.xyz"), + input, std::front_inserter(points), boost::dummy_property_map()); + input.close(); //----------------------------------------------------------------------- + input.open("data/read_test/simple.off"); CGAL::read_off_points_and_normals( - std::ifstream("data/read_test/simple.off"), + input, std::front_inserter(points), boost::dummy_property_map()); + input.close(); + input.open("data/read_test/simple.off"); CGAL::read_off_points_and_normals( - std::ifstream("data/read_test/simple.off"), + input, std::front_inserter(pv_pairs), CGAL::First_of_pair_property_map(), CGAL::Second_of_pair_property_map()); + input.close(); + input.open("data/read_test/simple.off"); CGAL::read_off_points_and_normals( - std::ifstream("data/read_test/simple.off"), + input, std::front_inserter(pv_pairs), CGAL::First_of_pair_property_map(), CGAL::Second_of_pair_property_map(), Kernel()); + input.close(); + input.open("data/read_test/simple.off"); CGAL::read_off_points_and_normals( - std::ifstream("data/read_test/simple.off"), + input, std::front_inserter(points), boost::dummy_property_map()); + input.close(); } int main() { From bafee0c3697c6e27d9ae7b618055c1f005db2293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 5 Jun 2013 09:04:05 +0200 Subject: [PATCH 52/63] specialization of Kernel_traits so that Robust_intersection_traits is picked --- Polyhedron/demo/Polyhedron/include/UI_point_3.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Polyhedron/demo/Polyhedron/include/UI_point_3.h b/Polyhedron/demo/Polyhedron/include/UI_point_3.h index 2c2407e6b23..78f27da1122 100644 --- a/Polyhedron/demo/Polyhedron/include/UI_point_3.h +++ b/Polyhedron/demo/Polyhedron/include/UI_point_3.h @@ -127,6 +127,14 @@ private: FT m_radius; }; +#include + +namespace CGAL{ +template +struct Kernel_traits< ::UI_point_3 >{ + typedef Gt Kernel; +}; +} //end of CGAL namespace #endif //UI_POINT_3_H From 5a8c5925ac2e36ff01b474ca1629b263cb2d3d0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 5 Jun 2013 09:05:05 +0200 Subject: [PATCH 53/63] update function calls due to API change --- .../Polyhedron_demo_normal_estimation_plugin.cpp | 6 +++--- .../Polyhedron/Polyhedron_demo_poisson_plugin_impl.cpp | 2 +- .../demo/Polyhedron/Scene_points_with_normal_item.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_normal_estimation_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_normal_estimation_plugin.cpp index 1fee59949a1..38759135e8c 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_normal_estimation_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_normal_estimation_plugin.cpp @@ -126,7 +126,7 @@ void Polyhedron_demo_normal_estimation_plugin::on_actionNormalEstimation_trigger // Estimates normals direction. CGAL::pca_estimate_normals(points->begin(), points->end(), - CGAL::make_normal_of_point_with_normal_pmap(points->begin()), + CGAL::make_normal_of_point_with_normal_pmap(*points->begin()), dialog.directionNbNeighbors()); // Mark all normals as unoriented @@ -144,7 +144,7 @@ void Polyhedron_demo_normal_estimation_plugin::on_actionNormalEstimation_trigger // Estimates normals direction. CGAL::jet_estimate_normals(points->begin(), points->end(), - CGAL::make_normal_of_point_with_normal_pmap(points->begin()), + CGAL::make_normal_of_point_with_normal_pmap(*points->begin()), dialog.directionNbNeighbors()); // Mark all normals as unoriented @@ -166,7 +166,7 @@ void Polyhedron_demo_normal_estimation_plugin::on_actionNormalEstimation_trigger // Tries to orient normals first_unoriented_point = CGAL::mst_orient_normals(points->begin(), points->end(), - CGAL::make_normal_of_point_with_normal_pmap(points->begin()), + CGAL::make_normal_of_point_with_normal_pmap(*points->begin()), dialog.orientationNbNeighbors()); std::size_t nb_unoriented_normals = std::distance(first_unoriented_point, points->end()); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_poisson_plugin_impl.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_poisson_plugin_impl.cpp index 98da1f5b69d..c5e9d1adf59 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_poisson_plugin_impl.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_poisson_plugin_impl.cpp @@ -88,7 +88,7 @@ Polyhedron* poisson_reconstruct(const Point_set& points, // The position property map can be omitted here as we use iterators over Point_3 elements. Poisson_reconstruction_function function( points.begin(), points.end(), - CGAL::make_normal_of_point_with_normal_pmap(points.begin())); + CGAL::make_normal_of_point_with_normal_pmap(*points.begin())); bool ok = false; #ifdef CGAL_TAUCS_ENABLED diff --git a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp index 492e5e320d2..f5907ebb889 100644 --- a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp @@ -106,7 +106,7 @@ bool Scene_points_with_normal_item::read_off_point_set(std::istream& stream) bool ok = stream && CGAL::read_off_points_and_normals(stream, std::back_inserter(*m_points), - CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(*m_points))) && + CGAL::make_normal_of_point_with_normal_pmap(*m_points->begin())) && !isEmpty(); return ok; @@ -120,7 +120,7 @@ bool Scene_points_with_normal_item::write_off_point_set(std::ostream& stream) co return stream && CGAL::write_off_points_and_normals(stream, m_points->begin(), m_points->end(), - CGAL::make_normal_of_point_with_normal_pmap(m_points->begin())); + CGAL::make_normal_of_point_with_normal_pmap(*m_points->begin())); } // Loads point set from .XYZ file @@ -132,7 +132,7 @@ bool Scene_points_with_normal_item::read_xyz_point_set(std::istream& stream) bool ok = stream && CGAL::read_xyz_points_and_normals(stream, std::back_inserter(*m_points), - CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(*m_points))) && + CGAL::make_normal_of_point_with_normal_pmap(*m_points->begin())) && !isEmpty(); return ok; @@ -146,7 +146,7 @@ bool Scene_points_with_normal_item::write_xyz_point_set(std::ostream& stream) co return stream && CGAL::write_xyz_points_and_normals(stream, m_points->begin(), m_points->end(), - CGAL::make_normal_of_point_with_normal_pmap(m_points->begin())); + CGAL::make_normal_of_point_with_normal_pmap(*m_points->begin())); } QString From b72e31e2ae29416c095b681c558735921a840b87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 5 Jun 2013 09:23:38 +0200 Subject: [PATCH 54/63] ADL does not apply to a function with an explicitly qualified template argument --- Point_set_processing_3/include/CGAL/property_map.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Point_set_processing_3/include/CGAL/property_map.h b/Point_set_processing_3/include/CGAL/property_map.h index 73993ac73a5..a5bd389d819 100644 --- a/Point_set_processing_3/include/CGAL/property_map.h +++ b/Point_set_processing_3/include/CGAL/property_map.h @@ -319,7 +319,7 @@ struct Nth_of_tuple_property_map /// @{ friend const value_type& get(const Self&,const key_type& k) {return get(k);} friend reference get(const Self&, key_type& k) {return get(k);} - friend void put(const Self&,key_type& k, const value_type& v) {get(k)=v;} + friend void put(const Self&,key_type& k, const value_type& v) {boost::get(k)=v;} /// @} }; From 6fd237a95f057edbec70a09ee3e3b6189630f6ff Mon Sep 17 00:00:00 2001 From: iyaz Date: Thu, 6 Jun 2013 17:13:40 +0300 Subject: [PATCH 55/63] include CGAL/property_map.h for avoiding boost path dif from version to version --- .../Point_set_processing_3/read_test_with_different_pmaps.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp b/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp index fdcd6330a97..ba6a14a37fa 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp @@ -8,7 +8,8 @@ #include #include -#include +//#include +#include typedef CGAL::Simple_cartesian Kernel; typedef Kernel::Point_3 Point_3; From a541518c0194dc032a714618407c870c67f08826 Mon Sep 17 00:00:00 2001 From: iyaz Date: Thu, 6 Jun 2013 22:41:43 +0300 Subject: [PATCH 56/63] use member get on tuples instead of free func get --- Point_set_processing_3/include/CGAL/property_map.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/property_map.h b/Point_set_processing_3/include/CGAL/property_map.h index a5bd389d819..817fa8a94bb 100644 --- a/Point_set_processing_3/include/CGAL/property_map.h +++ b/Point_set_processing_3/include/CGAL/property_map.h @@ -312,14 +312,14 @@ struct Nth_of_tuple_property_map typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag` /// Access a property map element. /// @param tuple a key whose Nth item is accessed - reference operator[](key_type& tuple) const { return get(tuple); } + reference operator[](key_type& tuple) const { return tuple.template get(); } typedef Nth_of_tuple_property_map Self; /// \name Put/get free functions /// @{ - friend const value_type& get(const Self&,const key_type& k) {return get(k);} - friend reference get(const Self&, key_type& k) {return get(k);} - friend void put(const Self&,key_type& k, const value_type& v) {boost::get(k)=v;} + friend const value_type& get(const Self&,const key_type& k) {return k.template get();} + friend reference get(const Self&, key_type& k) {return k.template get();} + friend void put(const Self&,key_type& k, const value_type& v) {k.template get()=v;} /// @} }; From cdab9daa57fdec2eed983d7b2e5852eab5db7be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 7 Jun 2013 07:57:45 +0200 Subject: [PATCH 57/63] path of boost header relative to the version of boost --- .../read_test_with_different_pmaps.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp b/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp index ba6a14a37fa..e8c95321473 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp @@ -8,8 +8,12 @@ #include #include -//#include -#include +#include +#if BOOST_VERSION >= 104000 + #include +#else + #include +#endif typedef CGAL::Simple_cartesian Kernel; typedef Kernel::Point_3 Point_3; From 7c16daf247abf663260714aa2d509c2afb4c7c3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 12 Jun 2013 11:58:56 +0200 Subject: [PATCH 58/63] clear stream state (getline bug on MSVC9) --- .../test/Point_set_processing_3/read_test.cpp | 0 .../read_test_with_different_pmaps.cpp | 20 +++++++++++++++++++ 2 files changed, 20 insertions(+) mode change 100755 => 100644 Point_set_processing_3/test/Point_set_processing_3/read_test.cpp diff --git a/Point_set_processing_3/test/Point_set_processing_3/read_test.cpp b/Point_set_processing_3/test/Point_set_processing_3/read_test.cpp old mode 100755 new mode 100644 diff --git a/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp b/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp index e8c95321473..acd044e65dc 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/read_test_with_different_pmaps.cpp @@ -87,6 +87,7 @@ bool test_no_deduction_points_and_normals_xyz(const char* file_name) input, back_inserter(indices), points, normals, Kernel()); // read with ordinary pmaps + input.clear(); input.close(); input.open(file_name); CGAL::read_xyz_points_and_normals( @@ -113,6 +114,7 @@ bool test_no_deduction_points_and_normals_off(const char* file_name) input, back_inserter(indices), points, normals, Kernel()); // read with ordinary pmaps + input.clear(); input.close(); input.open(file_name); CGAL::read_off_points_and_normals( @@ -138,6 +140,7 @@ bool test_no_deduction_points_xyz(const char* file_name) input, back_inserter(indices), points_1, Kernel()); // read with ordinary pmaps + input.clear(); input.close(); input.open(file_name); CGAL::read_xyz_points( @@ -162,6 +165,7 @@ bool test_no_deduction_points_off(const char* file_name) input, back_inserter(indices), points_1, Kernel()); // read with ordinary pmaps + input.clear(); input.close(); input.open(file_name); CGAL::read_off_points( @@ -182,6 +186,7 @@ void compile_test() { CGAL::read_xyz_points( input, std::front_inserter(points)); + input.clear(); input.close(); input.open("data/read_test/simple.xyz"); @@ -189,6 +194,7 @@ void compile_test() { input, std::front_inserter(points), CGAL::Identity_property_map()); + input.clear(); input.close(); input.open("data/read_test/simple.xyz"); @@ -197,6 +203,7 @@ void compile_test() { std::front_inserter(points), CGAL::Identity_property_map(), Kernel()); + input.clear(); input.close(); // this will span all OutputIteratorValueType versions @@ -204,12 +211,14 @@ void compile_test() { CGAL::read_xyz_points( input, std::front_inserter(points)); + input.clear(); input.close(); //----------------------------------------------------------------------- input.open("data/read_test/simple.off"); CGAL::read_off_points( input, std::front_inserter(points)); + input.clear(); input.close(); input.open("data/read_test/simple.off"); @@ -217,6 +226,7 @@ void compile_test() { input, std::front_inserter(points), CGAL::Identity_property_map()); + input.clear(); input.close(); input.open("data/read_test/simple.off"); @@ -225,6 +235,7 @@ void compile_test() { std::front_inserter(points), CGAL::Identity_property_map(), Kernel()); + input.clear(); input.close(); // this will span all OutputIteratorValueType versions @@ -232,6 +243,7 @@ void compile_test() { CGAL::read_off_points( input, std::front_inserter(points)); + input.clear(); input.close(); //----------------------------------------------------------------------- input.open("data/read_test/simple.xyz"); @@ -239,6 +251,7 @@ void compile_test() { input, std::front_inserter(points), boost::dummy_property_map()); + input.clear(); input.close(); input.open("data/read_test/simple.xyz"); @@ -247,6 +260,7 @@ void compile_test() { std::front_inserter(pv_pairs), CGAL::First_of_pair_property_map(), CGAL::Second_of_pair_property_map()); + input.clear(); input.close(); input.open("data/read_test/simple.xyz"); @@ -256,6 +270,7 @@ void compile_test() { CGAL::First_of_pair_property_map(), CGAL::Second_of_pair_property_map(), Kernel()); + input.clear(); input.close(); input.open("data/read_test/simple.xyz"); @@ -263,6 +278,7 @@ void compile_test() { input, std::front_inserter(points), boost::dummy_property_map()); + input.clear(); input.close(); //----------------------------------------------------------------------- input.open("data/read_test/simple.off"); @@ -270,6 +286,7 @@ void compile_test() { input, std::front_inserter(points), boost::dummy_property_map()); + input.clear(); input.close(); input.open("data/read_test/simple.off"); @@ -278,6 +295,7 @@ void compile_test() { std::front_inserter(pv_pairs), CGAL::First_of_pair_property_map(), CGAL::Second_of_pair_property_map()); + input.clear(); input.close(); input.open("data/read_test/simple.off"); @@ -287,6 +305,7 @@ void compile_test() { CGAL::First_of_pair_property_map(), CGAL::Second_of_pair_property_map(), Kernel()); + input.clear(); input.close(); input.open("data/read_test/simple.off"); @@ -294,6 +313,7 @@ void compile_test() { input, std::front_inserter(points), boost::dummy_property_map()); + input.clear(); input.close(); } From b6a332acb6fd7e84c26e8cd0851605d78dc53725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 13 Jun 2013 16:00:23 +0200 Subject: [PATCH 59/63] remove remaining Typed_identity_property_map_by_reference --- .../doc/Point_set_processing_3/Point_set_processing_3.txt | 6 +++--- Point_set_processing_3/doc/Property_map/Property_map.txt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt b/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt index 84909e1bcc9..468ec744e2f 100644 --- a/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt +++ b/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt @@ -61,11 +61,11 @@ The following classes described in Chapter \ref chapterProperty_map provide property maps for the implementations of points with normals listed above: -- `Typed_identity_property_map_by_reference` +- `Identity_property_map` - `First_of_pair_property_map` and `Second_of_pair_property_map` - `Nth_of_tuple_property_map` -`Typed_identity_property_map_by_reference` is the default value of the +`Identity_property_map` is the default value of the position property map expected by all functions in this component. See below examples using pair and tuple property maps. @@ -128,7 +128,7 @@ input points in increasing order of average squared distances to their \subsection Point_set_processing_3Example_2 Example The following example reads a point set and removes 5% of the -points. It uses the `Typed_identity_property_map_by_reference` property +points. It uses the `Identity_property_map` property map (optional as it is the default position property map of all functions in this component.) \cgalExample{Point_set_processing_3/remove_outliers_example.cpp} diff --git a/Point_set_processing_3/doc/Property_map/Property_map.txt b/Point_set_processing_3/doc/Property_map/Property_map.txt index d03bd57f933..ccdab322693 100644 --- a/Point_set_processing_3/doc/Property_map/Property_map.txt +++ b/Point_set_processing_3/doc/Property_map/Property_map.txt @@ -35,7 +35,7 @@ or as a `boost::tuple<..,Point_3, ..., Vector_3 >`. This component provides property maps to support these cases: -`Typed_identity_property_map_by_reference` +`Identity_property_map` `First_of_pair_property_map` and `Second_of_pair_property_map` @@ -43,9 +43,9 @@ This component provides property maps to support these cases: `Dereference_property_map` -\subsection Property_mapExamplewithIdentity Example with Typed_identity_property_map_by_reference +\subsection Property_mapExamplewithIdentity Example with Identity_property_map -The following example reads a point set and removes 5% of the points. It uses `Typed_identity_property_map_by_reference` as position property map. +The following example reads a point set and removes 5% of the points. It uses `Identity_property_map` as position property map. \cgalExample{Point_set_processing_3/remove_outliers_example.cpp} \subsection Property_mapExamplewithPairs Example with Pairs From 275c21022e9992fff6a6d02484223861ca76d7a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 13 Jun 2013 16:11:41 +0200 Subject: [PATCH 60/63] doc: use bullet list --- .../doc/Property_map/Property_map.txt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Point_set_processing_3/doc/Property_map/Property_map.txt b/Point_set_processing_3/doc/Property_map/Property_map.txt index ccdab322693..1e97f9a5a85 100644 --- a/Point_set_processing_3/doc/Property_map/Property_map.txt +++ b/Point_set_processing_3/doc/Property_map/Property_map.txt @@ -35,13 +35,10 @@ or as a `boost::tuple<..,Point_3, ..., Vector_3 >`. This component provides property maps to support these cases: -`Identity_property_map` - -`First_of_pair_property_map` and `Second_of_pair_property_map` - -`Nth_of_tuple_property_map` - -`Dereference_property_map` +- `Identity_property_map` +- `First_of_pair_property_map` and `Second_of_pair_property_map` +- `Nth_of_tuple_property_map` +- `Dereference_property_map` \subsection Property_mapExamplewithIdentity Example with Identity_property_map From 2e7f87f7e6e1b63756440532fbb06151363b7e90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 13 Jun 2013 16:41:20 +0200 Subject: [PATCH 61/63] remove comments --- .../test/Point_set_processing_3/analysis_test.cpp | 1 - .../test/Point_set_processing_3/normal_estimation_test.cpp | 1 - .../test/Point_set_processing_3/remove_outliers_test.cpp | 1 - .../test/Point_set_processing_3/smoothing_test.cpp | 1 - .../poisson_reconstruction_test.cpp | 1 - 5 files changed, 5 deletions(-) diff --git a/Point_set_processing_3/test/Point_set_processing_3/analysis_test.cpp b/Point_set_processing_3/test/Point_set_processing_3/analysis_test.cpp index b42725c563e..8758cee9b01 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/analysis_test.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/analysis_test.cpp @@ -1,4 +1,3 @@ -//#define CGAL_USE_OLD_PAIR_PROPERTY_MAPS // analysis_test.cpp //---------------------------------------------------------- diff --git a/Point_set_processing_3/test/Point_set_processing_3/normal_estimation_test.cpp b/Point_set_processing_3/test/Point_set_processing_3/normal_estimation_test.cpp index e6c0406a64a..f237adec40e 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/normal_estimation_test.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/normal_estimation_test.cpp @@ -1,4 +1,3 @@ -//#define CGAL_USE_OLD_PAIR_PROPERTY_MAPS // normal_estimation_test.cpp //---------------------------------------------------------- diff --git a/Point_set_processing_3/test/Point_set_processing_3/remove_outliers_test.cpp b/Point_set_processing_3/test/Point_set_processing_3/remove_outliers_test.cpp index b2491350918..a2782229c09 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/remove_outliers_test.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/remove_outliers_test.cpp @@ -1,4 +1,3 @@ -//#define CGAL_USE_OLD_PAIR_PROPERTY_MAPS // remove_outliers_test.cpp //---------------------------------------------------------- diff --git a/Point_set_processing_3/test/Point_set_processing_3/smoothing_test.cpp b/Point_set_processing_3/test/Point_set_processing_3/smoothing_test.cpp index 377d4490d57..58ed751ce88 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/smoothing_test.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/smoothing_test.cpp @@ -1,4 +1,3 @@ -//#define CGAL_USE_OLD_PAIR_PROPERTY_MAPS // smoothing_test.cpp //---------------------------------------------------------- diff --git a/Surface_reconstruction_points_3/test/Surface_reconstruction_points_3/poisson_reconstruction_test.cpp b/Surface_reconstruction_points_3/test/Surface_reconstruction_points_3/poisson_reconstruction_test.cpp index a026a2b68c8..c9955389aae 100644 --- a/Surface_reconstruction_points_3/test/Surface_reconstruction_points_3/poisson_reconstruction_test.cpp +++ b/Surface_reconstruction_points_3/test/Surface_reconstruction_points_3/poisson_reconstruction_test.cpp @@ -1,4 +1,3 @@ -//#define CGAL_USE_OLD_PAIR_PROPERTY_MAPS // poisson_reconstruction_test.cpp //---------------------------------------------------------- From ffa4bf7d3419388cf1802821060129f3b126e579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 13 Jun 2013 17:04:50 +0200 Subject: [PATCH 62/63] rename MACRO to enable old code --- .../include/CGAL/IO/read_off_points.h | 6 ++--- .../include/CGAL/IO/read_xyz_points.h | 6 ++--- .../include/CGAL/IO/write_off_points.h | 8 +++---- .../include/CGAL/IO/write_xyz_points.h | 8 +++---- .../include/CGAL/Point_with_normal_3.h | 2 +- .../include/CGAL/compute_average_spacing.h | 6 ++--- .../include/CGAL/grid_simplify_point_set.h | 4 ++-- .../CGAL/improved_jet_smooth_point_set.h | 10 ++++----- .../improved_laplacian_smooth_point_set.h | 10 ++++----- .../include/CGAL/jet_estimate_normals.h | 8 +++---- .../include/CGAL/jet_smooth_point_set.h | 6 ++--- .../include/CGAL/mst_orient_normals.h | 22 +++++++++---------- .../include/CGAL/pca_estimate_normals.h | 8 +++---- .../include/CGAL/pca_smooth_point_set.h | 6 ++--- .../include/CGAL/property_map.h | 6 ++--- .../include/CGAL/radial_orient_normals.h | 10 ++++----- .../include/CGAL/random_simplify_point_set.h | 2 +- .../include/CGAL/remove_outliers.h | 6 ++--- ...move_outliers_wrt_median_knn_sq_distance.h | 6 ++--- .../normal_estimation_test.cpp | 10 ++++----- .../PS_demo_normal_estimation_plugin.cpp | 6 ++--- .../PS_demo_poisson_plugin_cgal_code.cpp | 2 +- .../Point_set_scene_item.cpp | 8 +++---- .../CGAL/Poisson_reconstruction_function.h | 2 +- .../CGAL/Reconstruction_triangulation_3.h | 4 ++-- .../poisson_reconstruction_test.cpp | 4 ++-- 26 files changed, 88 insertions(+), 88 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/IO/read_off_points.h b/Point_set_processing_3/include/CGAL/IO/read_off_points.h index eb605fd4b32..8957cbe2360 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_off_points.h @@ -142,7 +142,7 @@ read_off_points_and_normals( } } Enriched_point pwn; -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 put(point_pmap, &pwn, point); // point_pmap[&pwn] = point put(normal_pmap, &pwn, normal); // normal_pmap[&pwn] = normal #else @@ -251,7 +251,7 @@ read_off_points_and_normals( ( stream, output, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(output), #else make_identity_property_map(OutputIteratorValueType()), @@ -400,7 +400,7 @@ read_off_points( ( stream, output, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(output) #else make_identity_property_map(OutputIteratorValueType()) diff --git a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h index 6e4526e11d7..02ff8287ca1 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h @@ -129,7 +129,7 @@ read_xyz_points_and_normals( } } Enriched_point pwn; - #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + #ifdef CGAL_USE_PROPERTY_MAPS_API_V1 put(point_pmap, &pwn, point); // point_pmap[&pwn] = point put(normal_pmap, &pwn, normal); // normal_pmap[&pwn] = normal #else @@ -247,7 +247,7 @@ read_xyz_points_and_normals( ( stream, output, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(output), #else make_identity_property_map(OutputIteratorValueType()), @@ -397,7 +397,7 @@ read_xyz_points( ( stream, output, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(output) #else make_identity_property_map(OutputIteratorValueType()) 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 72c098c1af4..d5b2c59c273 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 @@ -88,7 +88,7 @@ write_off_points_and_normals( // Write positions + normals for(ForwardIterator it = first; it != beyond; it++) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Point p = get(point_pmap, it); Vector n = get(normal_pmap, it); #else @@ -141,7 +141,7 @@ write_off_points_and_normals( return write_off_points_and_normals( stream, first, beyond, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(first), #else make_identity_property_map( @@ -197,7 +197,7 @@ write_off_points( // Write positions for(ForwardIterator it = first; it != beyond; it++) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Point p = get(point_pmap, it); #else Point p = get(point_pmap, *it); @@ -243,7 +243,7 @@ write_off_points( return write_off_points( stream, first, beyond, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(first) #else make_identity_property_map( 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 f36e812cfef..d96ace8d618 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 @@ -83,7 +83,7 @@ write_xyz_points_and_normals( // Write positions + normals for(ForwardIterator it = first; it != beyond; it++) { - #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + #ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Point p = get(point_pmap, it); Vector n = get(normal_pmap, it); #else @@ -136,7 +136,7 @@ write_xyz_points_and_normals( return write_xyz_points_and_normals( stream, first, beyond, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(output), #else make_identity_property_map( @@ -187,7 +187,7 @@ write_xyz_points( // Write positions for(ForwardIterator it = first; it != beyond; it++) { - #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + #ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Point p = get(point_pmap, it); #else Point p = get(point_pmap, *it); @@ -234,7 +234,7 @@ write_xyz_points( return write_xyz_points( stream, first, beyond, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(output) #else make_identity_property_map( 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 96339310fdc..94636bf2b3e 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 @@ -128,7 +128,7 @@ private: //========================================================================= -#ifndef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifndef CGAL_USE_PROPERTY_MAPS_API_V1 /// Property map that accesses the normal vector from a Point_with_normal_3 object /// /// @heading Is Model for the Concepts: 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 2bb75b8ec0e..39cfa485a20 100644 --- a/Point_set_processing_3/include/CGAL/compute_average_spacing.h +++ b/Point_set_processing_3/include/CGAL/compute_average_spacing.h @@ -140,7 +140,7 @@ compute_average_spacing( std::vector kd_tree_points; for(InputIterator it = first; it != beyond; it++) { - #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + #ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Point point = get(point_pmap, it); #else Point point = get(point_pmap, *it); @@ -157,7 +157,7 @@ compute_average_spacing( { sum_spacings += internal::compute_average_spacing( - #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + #ifdef CGAL_USE_PROPERTY_MAPS_API_V1 get(point_pmap,it), #else get(point_pmap,*it), @@ -203,7 +203,7 @@ compute_average_spacing( { return compute_average_spacing( first,beyond, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(first), #else make_identity_property_map( 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 c622b395471..ebd2a228e09 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 @@ -64,7 +64,7 @@ public: typedef typename boost::property_traits::value_type Point; // Round points to multiples of m_epsilon, then compare. - #ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS + #ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Point a_n = get(point_pmap,&a); Point b_n = get(point_pmap,&b); #else @@ -218,7 +218,7 @@ grid_simplify_point_set( { return grid_simplify_point_set( first,beyond, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(first), #else make_identity_property_map( diff --git a/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h b/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h index 4b46691cc78..a910d1e9716 100644 --- a/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h @@ -255,7 +255,7 @@ improved_jet_smooth_point_set( std::vector treeElements; for (it = first, i=0 ; it != beyond ; ++it,++i) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 const Point& p0 = get(point_pmap,it); #else const Point& p0 = get(point_pmap,*it); @@ -267,7 +267,7 @@ improved_jet_smooth_point_set( std::vector p(nb_points); // positions at step iter_n std::vector b(nb_points); // ... for(it = first, i=0; it != beyond; it++, ++i) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 p[i] = get(point_pmap,it); #else p[i] = get(point_pmap,*it); @@ -283,7 +283,7 @@ improved_jet_smooth_point_set( // Iterates over input points, computes (original) Laplacian smoothing and b[]. for(it = first, i=0; it != beyond; it++, ++i) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 const Point& p0 = get(point_pmap,it); #else const Point& p0 = get(point_pmap,*it); @@ -304,7 +304,7 @@ improved_jet_smooth_point_set( // Implementation note: the cast to Point& allows to modify only the point's position. for(it = first, i=0; it != beyond; it++, ++i) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 put(point_pmap, it, p[i]); #else put(point_pmap, *it, p[i]); @@ -356,7 +356,7 @@ improved_jet_smooth_point_set( { return improved_jet_smooth_point_set( first,beyond, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(first), #else make_identity_property_map( diff --git a/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h b/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h index 63217fa1581..7008f4b2d78 100644 --- a/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h @@ -238,7 +238,7 @@ improved_laplacian_smooth_point_set( std::vector treeElements; for (it = first, i=0 ; it != beyond ; ++it,++i) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 const Point& p0 = get(point_pmap,it); #else const Point& p0 = get(point_pmap,*it); @@ -250,7 +250,7 @@ improved_laplacian_smooth_point_set( std::vector p(nb_points); // positions at step iter_n std::vector b(nb_points); // ... for(it = first, i=0; it != beyond; it++, ++i) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 p[i] = get(point_pmap,it); #else p[i] = get(point_pmap,*it); @@ -263,7 +263,7 @@ improved_laplacian_smooth_point_set( // Iterates over input points, computes (original) Laplacian smoothing and b[]. for(it = first, i=0; it != beyond; it++, ++i) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 const Point& p0 = get(point_pmap,it); #else const Point& p0 = get(point_pmap,*it); @@ -284,7 +284,7 @@ improved_laplacian_smooth_point_set( // Implementation note: the cast to Point& allows to modify only the point's position. for(it = first, i=0; it != beyond; it++, ++i) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 put(point_pmap, it, p[i]); #else put(point_pmap, *it, p[i]); @@ -336,7 +336,7 @@ improved_laplacian_smooth_point_set( { return improved_laplacian_smooth_point_set( first,beyond, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(first), #else make_identity_property_map( 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 5c7e56478dd..ba9d085b37a 100644 --- a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h @@ -169,7 +169,7 @@ jet_estimate_normals( std::vector kd_tree_points; for(it = first; it != beyond; it++) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Point point = get(point_pmap, it); #else Point point = get(point_pmap, *it); @@ -186,14 +186,14 @@ jet_estimate_normals( for(it = first; it != beyond; it++) { Vector normal = internal::jet_estimate_normal( -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 get(point_pmap,it), #else get(point_pmap,*it), #endif tree, k, degree_fitting); -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 put(normal_pmap, it, normal); // normal_pmap[it] = normal #else put(normal_pmap, *it, normal); // normal_pmap[it] = normal @@ -247,7 +247,7 @@ jet_estimate_normals( { jet_estimate_normals( first,beyond, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(first), #else make_identity_property_map( 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 f6a154cab4f..f98f5251f7a 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 @@ -158,7 +158,7 @@ jet_smooth_point_set( std::vector kd_tree_points; for(it = first; it != beyond; it++) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Point point = get(point_pmap, it); #else Point point = get(point_pmap, *it); @@ -171,7 +171,7 @@ jet_smooth_point_set( // Implementation note: the cast to Point& allows to modify only the point's position. for(it = first; it != beyond; it++) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 const Point& p = get(point_pmap, it); put(point_pmap, it , internal::jet_smooth_point(p,tree,k,degree_fitting,degree_monge) ); @@ -222,7 +222,7 @@ jet_smooth_point_set( { jet_smooth_point_set( first,beyond, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(first), #else make_identity_property_map( 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 beda025c129..69894c99ee2 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -158,7 +158,7 @@ struct Propagate_normal_orientation // Gets source normal vertex_descriptor source_vertex = boost::source(edge, mst_graph); -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 const Vector source_normal = get(mst_graph.m_normal_pmap, mst_graph[source_vertex].input_point); #else const Vector source_normal = get(mst_graph.m_normal_pmap, *(mst_graph[source_vertex].input_point) ); @@ -166,7 +166,7 @@ struct Propagate_normal_orientation const bool source_normal_is_oriented = mst_graph[source_vertex].is_oriented; // Gets target normal vertex_descriptor target_vertex = boost::target(edge, mst_graph); -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 const Vector& target_normal = get( mst_graph.m_normal_pmap, mst_graph[target_vertex].input_point); #else const Vector& target_normal = get( mst_graph.m_normal_pmap, *(mst_graph[target_vertex].input_point) ); @@ -179,7 +179,7 @@ struct Propagate_normal_orientation double normals_dot = source_normal * target_normal; if (normals_dot < 0) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 put( mst_graph.m_normal_pmap, mst_graph[target_vertex].input_point, -target_normal); #else put( mst_graph.m_normal_pmap, *(mst_graph[target_vertex].input_point), -target_normal ); @@ -233,7 +233,7 @@ mst_find_source( for (ForwardIterator v = ++first; v != beyond; v++) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 double top_z = get(point_pmap,top_point).z(); // top_point's Z coordinate double z = get(point_pmap,v).z(); #else @@ -246,7 +246,7 @@ mst_find_source( } // Orients its normal towards +Z axis -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 const Vector& normal = get(normal_pmap,top_point); #else const Vector& normal = get(normal_pmap,*top_point); @@ -254,7 +254,7 @@ mst_find_source( const Vector Z(0, 0, 1); if (Z * normal < 0) { CGAL_TRACE(" Flip top point normal\n"); -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 put(normal_pmap,top_point, -normal); #else put(normal_pmap,*top_point, -normal); @@ -331,7 +331,7 @@ create_riemannian_graph( for (ForwardIterator it = first; it != beyond; it++) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Point point = get(point_pmap, it); #else Point point = get(point_pmap, *it); @@ -367,7 +367,7 @@ create_riemannian_graph( for (ForwardIterator it = first; it != beyond; it++) { std::size_t it_index = get(index_pmap,it); -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Vector it_normal_vector = get(normal_pmap,it); #else Vector it_normal_vector = get(normal_pmap,*it); @@ -378,7 +378,7 @@ create_riemannian_graph( // output first). Search may be aborted if k is greater // than number of input points. -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Point point = get(point_pmap, it); #else Point point = get(point_pmap, *it); @@ -407,7 +407,7 @@ create_riemannian_graph( // Computes edge weight = 1 - | normal1 * normal2 | // where normal1 and normal2 are the normal at the edge extremities. -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Vector neighbor_normal_vector = get(normal_pmap,neighbor); #else Vector neighbor_normal_vector = get(normal_pmap,*neighbor); @@ -700,7 +700,7 @@ mst_orient_normals( { return mst_orient_normals( first,beyond, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(first), #else make_identity_property_map( 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 9097cb3b06d..b69eafdeabd 100644 --- a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h @@ -162,7 +162,7 @@ pca_estimate_normals( std::vector kd_tree_points; for(it = first; it != beyond; it++) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Point point = get(point_pmap, it); #else Point point = get(point_pmap, *it); @@ -179,7 +179,7 @@ pca_estimate_normals( for(it = first; it != beyond; it++) { Vector normal = internal::pca_estimate_normal( -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 get(point_pmap,it), #else get(point_pmap,*it), @@ -187,7 +187,7 @@ pca_estimate_normals( tree, k); -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 put(normal_pmap, it, normal); // normal_pmap[it] = normal #else put(normal_pmap, *it, normal); // normal_pmap[it] = normal @@ -237,7 +237,7 @@ pca_estimate_normals( { pca_estimate_normals( first,beyond, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(first), #else make_identity_property_map( diff --git a/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h b/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h index 39be3e18a5c..93be9c562c0 100644 --- a/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h @@ -152,7 +152,7 @@ pca_smooth_point_set( std::vector kd_tree_points; for(it = first; it != beyond; it++) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Point point = get(point_pmap, it); #else Point point = get(point_pmap, *it); @@ -165,7 +165,7 @@ pca_smooth_point_set( // Implementation note: the cast to Point& allows to modify only the point's position. for(it = first; it != beyond; it++) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 const Point& p = get(point_pmap, it); put(point_pmap, it, internal::pca_smooth_point(p,tree,k) ); #else @@ -210,7 +210,7 @@ pca_smooth_point_set( { pca_smooth_point_set( first,beyond, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(first), #else make_identity_property_map( diff --git a/Point_set_processing_3/include/CGAL/property_map.h b/Point_set_processing_3/include/CGAL/property_map.h index 817fa8a94bb..fb201ea87a5 100644 --- a/Point_set_processing_3/include/CGAL/property_map.h +++ b/Point_set_processing_3/include/CGAL/property_map.h @@ -102,7 +102,7 @@ Identity_property_map //========================================================================= -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 /// \ingroup PkgProperty_map /// Property map that accesses the first item of a `std::pair`. /// \tparam Pair Instance of `std::pair`. @@ -175,7 +175,7 @@ First_of_pair_property_map } #endif -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 /// \ingroup PkgProperty_map /// /// Property map that accesses the second item of a `std::pair`. @@ -258,7 +258,7 @@ Second_of_pair_property_map //========================================================================= -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 /// \ingroup PkgProperty_map /// /// Property map that accesses the Nth item of a `boost::tuple`. 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 a0b3a5924b3..6da4deeb249 100644 --- a/Point_set_processing_3/include/CGAL/radial_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/radial_orient_normals.h @@ -80,7 +80,7 @@ radial_orient_normals( int nb_points = 0; for (ForwardIterator it = first; it != beyond; it++) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Point point = get(point_pmap, it); #else Point point = get(point_pmap, *it); @@ -95,7 +95,7 @@ radial_orient_normals( std::deque oriented_points, unoriented_points; for (ForwardIterator it = first; it != beyond; it++) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Point point = get(point_pmap, it); #else Point point = get(point_pmap, *it); @@ -104,7 +104,7 @@ radial_orient_normals( Vector vec1 = point - barycenter; // Point's normal -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Vector vec2 = get(normal_pmap, it); #else Vector vec2 = get(normal_pmap, *it); @@ -116,7 +116,7 @@ radial_orient_normals( if (dot < 0) vec2 = -vec2; -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 put(normal_pmap, it, vec2); #else put(normal_pmap, *it, vec2); @@ -176,7 +176,7 @@ radial_orient_normals( { return radial_orient_normals( first,beyond, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(first), #else make_identity_property_map( diff --git a/Point_set_processing_3/include/CGAL/random_simplify_point_set.h b/Point_set_processing_3/include/CGAL/random_simplify_point_set.h index ffa71bba444..f6b03392f21 100644 --- a/Point_set_processing_3/include/CGAL/random_simplify_point_set.h +++ b/Point_set_processing_3/include/CGAL/random_simplify_point_set.h @@ -106,7 +106,7 @@ random_simplify_point_set( { return random_simplify_point_set( first,beyond, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(first), #else make_identity_property_map( diff --git a/Point_set_processing_3/include/CGAL/remove_outliers.h b/Point_set_processing_3/include/CGAL/remove_outliers.h index bf1cc9a2523..131c5593100 100644 --- a/Point_set_processing_3/include/CGAL/remove_outliers.h +++ b/Point_set_processing_3/include/CGAL/remove_outliers.h @@ -164,7 +164,7 @@ remove_outliers( std::vector kd_tree_points; for(it = first; it != beyond; it++) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Point point = get(point_pmap, it); #else Point point = get(point_pmap, *it); @@ -178,7 +178,7 @@ remove_outliers( for(it = first; it != beyond; it++) { FT sq_distance = internal::compute_avg_knn_sq_distance_3( -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 get(point_pmap,it), #else get(point_pmap,*it), @@ -242,7 +242,7 @@ remove_outliers( { return remove_outliers( first,beyond, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(first), #else make_identity_property_map( diff --git a/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h b/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h index 26e04248614..7059f23587c 100644 --- a/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h +++ b/Point_set_processing_3/include/CGAL/remove_outliers_wrt_median_knn_sq_distance.h @@ -162,7 +162,7 @@ remove_outliers_wrt_median_knn_sq_distance( std::vector kd_tree_points; for(it = first; it != beyond; it++) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Point point = get(point_pmap, it); #else Point point = get(point_pmap, *it); @@ -176,7 +176,7 @@ remove_outliers_wrt_median_knn_sq_distance( for(it = first; it != beyond; it++) { FT sq_distance = internal::compute_median_knn_sq_distance_3( -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 get(point_pmap,it), #else get(point_pmap,*it), @@ -240,7 +240,7 @@ remove_outliers_wrt_median_knn_sq_distance( { return remove_outliers_wrt_median_knn_sq_distance( first,beyond, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(first), #else make_identity_property_map( diff --git a/Point_set_processing_3/test/Point_set_processing_3/normal_estimation_test.cpp b/Point_set_processing_3/test/Point_set_processing_3/normal_estimation_test.cpp index f237adec40e..02c1bbdf9d9 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/normal_estimation_test.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/normal_estimation_test.cpp @@ -127,7 +127,7 @@ bool run_pca_estimate_normals(PointList& points, // input points + output normal << nb_neighbors_pca_normals << ")...\n"; CGAL::pca_estimate_normals(points.begin(), points.end(), -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 CGAL::make_normal_of_point_with_normal_pmap(points.begin()), #else CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()), @@ -155,7 +155,7 @@ bool run_jet_estimate_normals(PointList& points, // input points + output normal << nb_neighbors_jet_fitting_normals << ")...\n"; CGAL::jet_estimate_normals(points.begin(), points.end(), -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 CGAL::make_normal_of_point_with_normal_pmap(points.begin()), #else CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()), @@ -239,7 +239,7 @@ bool run_mst_orient_normals(PointList& points, // input points + input/output no PointList::iterator unoriented_points_begin = CGAL::mst_orient_normals(points.begin(), points.end(), -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 CGAL::make_normal_of_point_with_normal_pmap(points.begin()), #else CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()), @@ -315,7 +315,7 @@ int main(int argc, char * argv[]) success = stream && CGAL::read_off_points_and_normals(stream, std::back_inserter(points), -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(points)) #else CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()) @@ -330,7 +330,7 @@ int main(int argc, char * argv[]) success = stream && CGAL::read_xyz_points_and_normals(stream, std::back_inserter(points), -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(points)) #else CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()) diff --git a/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/PS_demo_normal_estimation_plugin.cpp b/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/PS_demo_normal_estimation_plugin.cpp index 67d98750cea..178fa439a36 100644 --- a/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/PS_demo_normal_estimation_plugin.cpp +++ b/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/PS_demo_normal_estimation_plugin.cpp @@ -127,7 +127,7 @@ void PS_demo_normal_estimation_plugin::on_actionNormalEstimation_triggered() // Estimates normals direction. CGAL::pca_estimate_normals(points->begin(), points->end(), -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 CGAL::make_normal_of_point_with_normal_pmap(points->begin()), #else CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()), @@ -150,7 +150,7 @@ void PS_demo_normal_estimation_plugin::on_actionNormalEstimation_triggered() // Estimates normals direction. CGAL::jet_estimate_normals(points->begin(), points->end(), -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 CGAL::make_normal_of_point_with_normal_pmap(points->begin()), #else CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()), @@ -176,7 +176,7 @@ void PS_demo_normal_estimation_plugin::on_actionNormalEstimation_triggered() // Tries to orient normals first_unoriented_point = CGAL::mst_orient_normals(points->begin(), points->end(), -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 CGAL::make_normal_of_point_with_normal_pmap(points->begin()), #else CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()), diff --git a/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/PS_demo_poisson_plugin_cgal_code.cpp b/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/PS_demo_poisson_plugin_cgal_code.cpp index 26f58658ce5..843cbbfdfa0 100644 --- a/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/PS_demo_poisson_plugin_cgal_code.cpp +++ b/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/PS_demo_poisson_plugin_cgal_code.cpp @@ -90,7 +90,7 @@ Polyhedron* poisson_reconstruct(const Point_set& points, // The position property map can be omitted here as we use iterators over Point_3 elements. Poisson_reconstruction_function function( points.begin(), points.end(), -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 CGAL::make_normal_of_point_with_normal_pmap(points.begin()) #else CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()) diff --git a/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/Point_set_scene_item.cpp b/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/Point_set_scene_item.cpp index d1a93fa5438..ab9eb2405e1 100644 --- a/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/Point_set_scene_item.cpp +++ b/Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/Point_set_scene_item.cpp @@ -103,7 +103,7 @@ bool Point_set_scene_item::read_off_point_set(std::istream& stream) bool ok = stream && CGAL::read_off_points_and_normals(stream, std::back_inserter(*m_points), -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(*m_points)) #else CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()) @@ -122,7 +122,7 @@ bool Point_set_scene_item::write_off_point_set(std::ostream& stream) const return stream && CGAL::write_off_points_and_normals(stream, m_points->begin(), m_points->end(), -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 CGAL::make_normal_of_point_with_normal_pmap(m_points->begin()) #else CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()) @@ -139,7 +139,7 @@ bool Point_set_scene_item::read_xyz_point_set(std::istream& stream) bool ok = stream && CGAL::read_xyz_points_and_normals(stream, std::back_inserter(*m_points), -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(*m_points)) #else CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()) @@ -158,7 +158,7 @@ bool Point_set_scene_item::write_xyz_point_set(std::ostream& stream) const return stream && CGAL::write_xyz_points_and_normals(stream, m_points->begin(), m_points->end(), -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 CGAL::make_normal_of_point_with_normal_pmap(m_points->begin()) #else CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()) diff --git a/Surface_reconstruction_points_3/include/CGAL/Poisson_reconstruction_function.h b/Surface_reconstruction_points_3/include/CGAL/Poisson_reconstruction_function.h index 3b69aaddd4e..0fd3fac8a47 100644 --- a/Surface_reconstruction_points_3/include/CGAL/Poisson_reconstruction_function.h +++ b/Surface_reconstruction_points_3/include/CGAL/Poisson_reconstruction_function.h @@ -341,7 +341,7 @@ public: , average_spacing(CGAL::compute_average_spacing(first, beyond, 6)) { forward_constructor(first, beyond, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(first), #else make_identity_property_map( diff --git a/Surface_reconstruction_points_3/include/CGAL/Reconstruction_triangulation_3.h b/Surface_reconstruction_points_3/include/CGAL/Reconstruction_triangulation_3.h index 0860fae1d4c..18e0499b88f 100644 --- a/Surface_reconstruction_points_3/include/CGAL/Reconstruction_triangulation_3.h +++ b/Surface_reconstruction_points_3/include/CGAL/Reconstruction_triangulation_3.h @@ -384,7 +384,7 @@ public: //std::vector points; for (InputIterator it = first; it != beyond; ++it) { -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Point_with_normal pwn(get(point_pmap,it), get(normal_pmap,it)); #else Point_with_normal pwn(get(point_pmap,*it), get(normal_pmap,*it)); @@ -453,7 +453,7 @@ public: { return insert( first,beyond, -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 make_dereference_property_map(first), #else make_identity_property_map( diff --git a/Surface_reconstruction_points_3/test/Surface_reconstruction_points_3/poisson_reconstruction_test.cpp b/Surface_reconstruction_points_3/test/Surface_reconstruction_points_3/poisson_reconstruction_test.cpp index c9955389aae..e2a754bc622 100644 --- a/Surface_reconstruction_points_3/test/Surface_reconstruction_points_3/poisson_reconstruction_test.cpp +++ b/Surface_reconstruction_points_3/test/Surface_reconstruction_points_3/poisson_reconstruction_test.cpp @@ -145,7 +145,7 @@ int main(int argc, char * argv[]) !CGAL::read_xyz_points_and_normals( stream, std::back_inserter(points), -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(points)) #else CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()) @@ -206,7 +206,7 @@ int main(int argc, char * argv[]) // The position property map can be omitted here as we use iterators over Point_3 elements. Poisson_reconstruction_function function( points.begin(), points.end(), -#ifdef CGAL_USE_OLD_PAIR_PROPERTY_MAPS +#ifdef CGAL_USE_PROPERTY_MAPS_API_V1 CGAL::make_normal_of_point_with_normal_pmap(points.begin()) #else CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()) From b172b06b391c259bb72466b3c75bb44ff3f735bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 13 Jun 2013 18:02:11 +0200 Subject: [PATCH 63/63] update changes.html --- Installation/changes.html | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Installation/changes.html b/Installation/changes.html index 8633dcd41a6..b0f99456fa9 100755 --- a/Installation/changes.html +++ b/Installation/changes.html @@ -135,6 +135,16 @@ David A. Wheeler's 'SLOCCount', restricted to the include/CGAL/
  • Two bug fixes: do not use the 2 least significant bits for cell attribute without dart support; add share a mark in CMap_cell_iterator.
  • +

    CGAL and Boost Property Maps

    +
      +
    • The key_type of the property maps provided by CGAL used to be an iterator. In order to be more easily re-used, + the key_type has been changed to be the value_type of the iterator. + The packages that have been updated to match these changes are Point Set Processing and Surface Reconstruction from Point Sets. + However, for most users this change should be transparent if the default property maps were used. + For convenience, the former behavior can be enabled by defining the macro CGAL_USE_PROPERTY_MAPS_API_V1. +
    • +
    +

    Release 4.2