diff --git a/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h b/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h index db26ec4458a..8da661da552 100644 --- a/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h +++ b/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h @@ -393,7 +393,6 @@ Scale_space_surface_reconstruction_3:: increase_scale( unsigned int iterations ) { typedef std::vector< unsigned int > CountVec; typedef std::map PIMap; - typedef std::vector Pointset; // This method must be called after filling the point collection. if( iterations == 0 || _tree.empty() ) return; @@ -401,10 +400,6 @@ increase_scale( unsigned int iterations ) { if( !has_neighborhood_squared_radius() ) estimate_neighborhood_squared_radius(); - // To enable concurrent processing, we maintain two data structures: - // a search tree and a vector for the points after smoothing. - Pointset points; - points.assign( _tree.begin(), _tree.end() ); for( unsigned int iter = 0; iter < iterations; ++iter ) { if( !_tree.is_built() ) @@ -413,21 +408,21 @@ increase_scale( unsigned int iterations ) { // Collect the number of neighbors of each point. // This can be done concurrently. CountVec neighbors( _tree.size(), 0 ); - try_parallel( ComputeNN( points, _tree, _squared_radius, neighbors ), 0, _tree.size() ); + try_parallel( ComputeNN( _points, _tree, _squared_radius, neighbors ), 0, _tree.size() ); // Construct a mapping from each point to its index. PIMap indices; std::size_t index = 0; - for( typename Pointset::const_iterator pit = points.begin(); pit != points.end(); ++pit, ++index) + for( typename Pointset::const_iterator pit = _points.begin(); pit != _points.end(); ++pit, ++index) indices[ *pit ] = index; // Compute the tranformed point locations. // This can be done concurrently. - try_parallel( AdvanceSS( _tree, neighbors, indices, points ), 0, _tree.size() ); + try_parallel( AdvanceSS( _tree, neighbors, indices, _points ), 0, _tree.size() ); // Put the new points back in the tree. _tree.clear(); - _tree.insert( points.begin(), points.end() ); + _tree.insert( _points.begin(), _points.end() ); } } diff --git a/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h b/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h index 2df12f24502..f0e01b8a081 100644 --- a/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h +++ b/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h @@ -201,6 +201,9 @@ private: // The shells can be accessed through iterators to the surface. TripleIterSet _shells; + typedef std::vector Pointset; + Pointset _points; + public: /// \name Constructors /// \{ @@ -292,6 +295,7 @@ public: typename boost::enable_if< CGAL::is_iterator >::type* = NULL ) { #endif // DOXYGEN_RUNNING _tree.insert( begin, end ); + _points.insert(_points.end(), begin, end); } /// inserts a point into the scale-space at the current scale. @@ -310,6 +314,7 @@ public: */ void insert( const Point& p ) { _tree.insert( p ); + _points.push_back(p); } /// clears the stored scale-space surface reconstruction data. @@ -803,20 +808,20 @@ public: /// \name Iterators /// \{ /// gives an iterator to the first point at the current scale. - Point_const_iterator points_begin() const { return _tree.begin(); } + Point_const_iterator points_begin() const { return _points.begin(); } /// gives an iterator to the first point at the current scale. /** \warning Changes to the scale-space do not cause an automatic update to * the surface. */ - Point_iterator points_begin() { return _tree.begin(); } + Point_iterator points_begin() { return _points.begin(); } /// gives a past-the-end iterator of the points at the current scale. - Point_const_iterator points_end() const { return _tree.end(); } + Point_const_iterator points_end() const { return _points.end(); } /// gives a past-the-end iterator of the points at the current scale. /** \warning Changes to the scale-space do not cause an automatic update to * the surface. */ - Point_iterator points_end() { return _tree.end(); } + Point_iterator points_end() { return _points.end(); } /// gives an iterator to the first triple in the surface. Triple_const_iterator surface_begin() const { return _surface.begin(); }