mirror of https://github.com/CGAL/cgal
the order of the pts in the kd-tree is shuffled -> Internally store the input pts
This does not change the memory pick, since the points are anyway duplicated while advancing the scale space
This commit is contained in:
parent
f97bd9fb33
commit
f162da1a7c
|
|
@ -393,7 +393,6 @@ Scale_space_surface_reconstruction_3<Gt,FS,Sh,wA,Ct>::
|
|||
increase_scale( unsigned int iterations ) {
|
||||
typedef std::vector< unsigned int > CountVec;
|
||||
typedef std::map<Point, std::size_t> PIMap;
|
||||
typedef std::vector<Point> 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() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -201,6 +201,9 @@ private:
|
|||
// The shells can be accessed through iterators to the surface.
|
||||
TripleIterSet _shells;
|
||||
|
||||
typedef std::vector<Point> Pointset;
|
||||
Pointset _points;
|
||||
|
||||
public:
|
||||
/// \name Constructors
|
||||
/// \{
|
||||
|
|
@ -292,6 +295,7 @@ public:
|
|||
typename boost::enable_if< CGAL::is_iterator<InputIterator> >::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(); }
|
||||
|
|
|
|||
Loading…
Reference in New Issue