add needs_update modification upon oct-tree edit

This commit is contained in:
Lillian Vixe 2024-04-02 09:44:54 -07:00
parent 7f2e781616
commit d09e607bfc

View file

@ -130,6 +130,7 @@ impl<T: Clone> OctTree<T> {
let mut count: usize = 0;
Self::prune(&mut self.root, result.unwrap().1, &mut count);
self.trim(&mut count);
self.needs_update = true;
return count;
} else {
return 0; // no culled leaves
@ -204,6 +205,7 @@ impl<T: Clone> OctTree<T> {
match &mut self.root {
TreeNode::Leaf(nvalue) => {
*nvalue = value;
self.needs_update = true;
return true;
}
_ => {
@ -226,6 +228,7 @@ impl<T: Clone> OctTree<T> {
match &mut iter {
TreeNode::Leaf(nvalue) => {
*nvalue = value;
self.needs_update = true;
return true;
}
_ => {
@ -241,6 +244,7 @@ impl<T: Clone> OctTree<T> {
self.center = location;
self.size = 1;
self.root = TreeNode::Leaf(value);
self.needs_update = true;
return Default::default();
}
_ => {} // 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());
*next_rc_loc = end;
self.needs_update = true;
return path;
}
match next_rc_loc {
@ -331,6 +336,7 @@ impl<T: Clone> OctTree<T> {
"value set {location} within {rc_center}, {rc_size}, index {search_direction}"
);
*lvalue = value.clone();
self.needs_update = true;
return path;
}
}
@ -348,6 +354,7 @@ impl<T: Clone> OctTree<T> {
"value set {location} within {rc_center}, {rc_size}, index {search_direction}"
);
*lvalue = value;
self.needs_update = true;
return path;
} else {
println!("tree edited to contain non-unit node size. returning instead of losing data");