add needs_update modification upon oct-tree edit
This commit is contained in:
parent
7f2e781616
commit
d09e607bfc
|
@ -130,6 +130,7 @@ impl<T: Clone> OctTree<T> {
|
||||||
let mut count: usize = 0;
|
let mut count: usize = 0;
|
||||||
Self::prune(&mut self.root, result.unwrap().1, &mut count);
|
Self::prune(&mut self.root, result.unwrap().1, &mut count);
|
||||||
self.trim(&mut count);
|
self.trim(&mut count);
|
||||||
|
self.needs_update = true;
|
||||||
return count;
|
return count;
|
||||||
} else {
|
} else {
|
||||||
return 0; // no culled leaves
|
return 0; // no culled leaves
|
||||||
|
@ -204,6 +205,7 @@ impl<T: Clone> OctTree<T> {
|
||||||
match &mut self.root {
|
match &mut self.root {
|
||||||
TreeNode::Leaf(nvalue) => {
|
TreeNode::Leaf(nvalue) => {
|
||||||
*nvalue = value;
|
*nvalue = value;
|
||||||
|
self.needs_update = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -226,6 +228,7 @@ impl<T: Clone> OctTree<T> {
|
||||||
match &mut iter {
|
match &mut iter {
|
||||||
TreeNode::Leaf(nvalue) => {
|
TreeNode::Leaf(nvalue) => {
|
||||||
*nvalue = value;
|
*nvalue = value;
|
||||||
|
self.needs_update = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -241,6 +244,7 @@ impl<T: Clone> OctTree<T> {
|
||||||
self.center = location;
|
self.center = location;
|
||||||
self.size = 1;
|
self.size = 1;
|
||||||
self.root = TreeNode::Leaf(value);
|
self.root = TreeNode::Leaf(value);
|
||||||
|
self.needs_update = true;
|
||||||
return Default::default();
|
return Default::default();
|
||||||
}
|
}
|
||||||
_ => {} // continue to modify the tree structure - no easy answer yet
|
_ => {} // continue to modify the tree structure - no easy answer yet
|
||||||
|
@ -318,6 +322,7 @@ impl<T: Clone> OctTree<T> {
|
||||||
);
|
);
|
||||||
let end = TreeNode::Leaf(value.clone());
|
let end = TreeNode::Leaf(value.clone());
|
||||||
*next_rc_loc = end;
|
*next_rc_loc = end;
|
||||||
|
self.needs_update = true;
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
match next_rc_loc {
|
match next_rc_loc {
|
||||||
|
@ -331,6 +336,7 @@ impl<T: Clone> OctTree<T> {
|
||||||
"value set {location} within {rc_center}, {rc_size}, index {search_direction}"
|
"value set {location} within {rc_center}, {rc_size}, index {search_direction}"
|
||||||
);
|
);
|
||||||
*lvalue = value.clone();
|
*lvalue = value.clone();
|
||||||
|
self.needs_update = true;
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -348,6 +354,7 @@ impl<T: Clone> OctTree<T> {
|
||||||
"value set {location} within {rc_center}, {rc_size}, index {search_direction}"
|
"value set {location} within {rc_center}, {rc_size}, index {search_direction}"
|
||||||
);
|
);
|
||||||
*lvalue = value;
|
*lvalue = value;
|
||||||
|
self.needs_update = true;
|
||||||
return path;
|
return path;
|
||||||
} else {
|
} else {
|
||||||
println!("tree edited to contain non-unit node size. returning instead of losing data");
|
println!("tree edited to contain non-unit node size. returning instead of losing data");
|
||||||
|
|
Loading…
Reference in a new issue