You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let a = ([0f64, 0f64], 0);
let b = ([1f64, 0f64], 1);
let mut kdtree = KdTree::new(2);
kdtree.add(a.0, a.1).unwrap();
kdtree.add(b.0, b.1).unwrap();
kdtree.remove(&[0f64, 0f64], &1).unwrap();
or
let a = ([0f64, 0f64], 0);
let b = ([0f64, 0f64], 1);
let mut kdtree = KdTree::new(2);
kdtree.add(a.0, a.1).unwrap();
kdtree.add(b.0, b.1).unwrap();
kdtree.remove(&[0f64, 0f64], &1).unwrap();
will cause the program to stuck. There may be some issue with the implementation of the remove fn.
The text was updated successfully, but these errors were encountered:
whileletSome(p_index) = points.iter().position(|x| x == point){
basically if it is a duplicate point on the tree, and the one it finds is not the one you want to delete, it will loop forever
not sure if it is the best solution, but I zipped the two iterators together and it works good enough for me.
if let (Some(mut points), Some(mut bucket)) = (self.points.take(), self.bucket.take()) {
while let Some(p_index) = points.iter().zip(bucket.iter()).position(|(p, d)| p == point && d == data) {
points.remove(p_index);
bucket.remove(p_index);
removed += 1;
self.size -= 1;
}
self.points = Some(points);
self.bucket = Some(bucket);
} else {
Kind of this
or
will cause the program to stuck. There may be some issue with the implementation of the remove fn.
The text was updated successfully, but these errors were encountered: