MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / recompute_bbox

Method recompute_bbox

nodedb-spatial/src/rtree/node.rs:122–147  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

120 }
121
122 pub fn recompute_bbox(&mut self) {
123 match &self.kind {
124 NodeKind::Internal { children } => {
125 if children.is_empty() {
126 self.bbox = BoundingBox::new(0.0, 0.0, 0.0, 0.0);
127 return;
128 }
129 let mut bb = children[0].bbox;
130 for c in &children[1..] {
131 bb = bb.union(&c.bbox);
132 }
133 self.bbox = bb;
134 }
135 NodeKind::Leaf { entries } => {
136 if entries.is_empty() {
137 self.bbox = BoundingBox::new(0.0, 0.0, 0.0, 0.0);
138 return;
139 }
140 let mut bb = entries[0].bbox;
141 for e in &entries[1..] {
142 bb = bb.union(&e.bbox);
143 }
144 self.bbox = bb;
145 }
146 }
147 }
148}

Callers 6

split_nodeFunction · 0.80
str_packFunction · 0.80
pack_internalFunction · 0.80
insert_entryFunction · 0.80
forced_reinsertFunction · 0.80
delete_entryFunction · 0.80

Calls 2

is_emptyMethod · 0.45
unionMethod · 0.45

Tested by

no test coverage detected