diff options
author | fgodi <fgodi@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-11-28 09:57:43 +0000 |
---|---|---|
committer | fgodi <fgodi@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-11-28 09:57:43 +0000 |
commit | e9dd788438bff7289ddff1e0ade2de0f031a2f9b (patch) | |
tree | 09f21d3a81cea03e65ad5818d6c38b42032c0888 /src/Bottleneck_distance/include/gudhi/CGAL/Kd_tree.h | |
parent | aa6960f50b6a9e20e5361b4dc87ac03a33dab1fc (diff) |
Bug fix
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/bottleneck_integration@1789 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: f2c3ef0dab1a0d80cfcf0018da83dd2b6b9a9ef1
Diffstat (limited to 'src/Bottleneck_distance/include/gudhi/CGAL/Kd_tree.h')
-rw-r--r-- | src/Bottleneck_distance/include/gudhi/CGAL/Kd_tree.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Bottleneck_distance/include/gudhi/CGAL/Kd_tree.h b/src/Bottleneck_distance/include/gudhi/CGAL/Kd_tree.h index dbdf5259..f085b0da 100644 --- a/src/Bottleneck_distance/include/gudhi/CGAL/Kd_tree.h +++ b/src/Bottleneck_distance/include/gudhi/CGAL/Kd_tree.h @@ -392,24 +392,26 @@ public: bool success = remove_(p, 0, false, 0, false, root(), equal_to_p); CGAL_assertion(success); - removed_ |= success; + // Do not set the flag is the tree has been cleared. + if(is_built()) + removed_ |= success; } private: template<class Equal> bool remove_(const Point_d& p, - Internal_node_handle grandparent, bool islower, - Internal_node_handle parent, bool islower2, + Internal_node_handle grandparent, bool parent_islower, + Internal_node_handle parent, bool islower, Node_handle node, Equal const& equal_to_p) { // Recurse to locate the point if (!node->is_leaf()) { Internal_node_handle newparent = static_cast<Internal_node_handle>(node); // FIXME: This should be if(x<y) remove low; else remove up; if (traits().construct_cartesian_const_iterator_d_object()(p)[newparent->cutting_dimension()] <= newparent->cutting_value()) { - if (remove_(p, parent, islower2, newparent, true, newparent->lower(), equal_to_p)) + if (remove_(p, parent, islower, newparent, true, newparent->lower(), equal_to_p)) return true; } //if (traits().construct_cartesian_const_iterator_d_object()(p)[newparent->cutting_dimension()] >= newparent->cutting_value()) - return remove_(p, parent, islower2, newparent, false, newparent->upper(), equal_to_p); + return remove_(p, parent, islower, newparent, false, newparent->upper(), equal_to_p); CGAL_assertion(false); // Point was not found } @@ -431,7 +433,7 @@ private: return false; } else if (grandparent) { Node_handle brother = islower ? parent->upper() : parent->lower(); - if (islower2) + if (parent_islower) grandparent->set_lower(brother); else grandparent->set_upper(brother); |