(&mut self)
| 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 | } |
no test coverage detected