From d09e607bfc96efbee70f55659fb582bb04d4b2d6 Mon Sep 17 00:00:00 2001 From: adia redmoon Date: Tue, 2 Apr 2024 09:44:54 -0700 Subject: [PATCH] add needs_update modification upon oct-tree edit --- src/vvlib/octtree.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/vvlib/octtree.rs b/src/vvlib/octtree.rs index 25c0ee8..633435a 100644 --- a/src/vvlib/octtree.rs +++ b/src/vvlib/octtree.rs @@ -130,6 +130,7 @@ impl OctTree { 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 OctTree { match &mut self.root { TreeNode::Leaf(nvalue) => { *nvalue = value; + self.needs_update = true; return true; } _ => { @@ -226,6 +228,7 @@ impl OctTree { match &mut iter { TreeNode::Leaf(nvalue) => { *nvalue = value; + self.needs_update = true; return true; } _ => { @@ -241,6 +244,7 @@ impl OctTree { 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 OctTree { ); 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 OctTree { "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 OctTree { "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");