added insert_nodes_and_rebuild

This commit is contained in:
Olek 2016-12-31 22:36:09 +01:00
parent a9f8dd8f14
commit 626cfd7637

View File

@ -78,6 +78,14 @@ impl<KdtreePoint: KdtreePointTrait> Kdtree<KdtreePoint> {
squared_euclidean(&self.nearest_search(node).dims(), node.dims()) squared_euclidean(&self.nearest_search(node).dims(), node.dims())
} }
pub fn insert_nodes_and_rebuild(&mut self, nodes_to_add : &mut [KdtreePoint]) {
let mut pts : Vec<KdtreePoint> = vec![];
self.gather_points(0, &mut pts);
pts.extend(nodes_to_add.iter());
self.rebuild_tree(&mut pts);
}
pub fn insert_node(&mut self, node_to_add : KdtreePoint) { pub fn insert_node(&mut self, node_to_add : KdtreePoint) {
let mut current_index = 0; let mut current_index = 0;