Keep nodes in leafs
This commit is contained in:
parent
5f78e5fc5f
commit
2dc25e95f8
|
@ -39,4 +39,10 @@ fn main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
println!("{}", kdtree);
|
println!("{}", kdtree);
|
||||||
|
|
||||||
|
kdtree.traverse_leaves(&mut |locations, elements| {
|
||||||
|
for element in elements {
|
||||||
|
println!("{}", element);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ impl<T: Clone> KdTree<T> where {
|
||||||
|
|
||||||
// Build the left and right branches
|
// Build the left and right branches
|
||||||
let mut left = vec![];
|
let mut left = vec![];
|
||||||
for i in &points[0..delimiter] {
|
for i in &points[0..delimiter + 1] {
|
||||||
left.push(i.clone());
|
left.push(i.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue