conspire/geometry/ntree/balance/
mod.rs1pub(super) mod octree;
2pub(super) mod quadtree;
3
4use crate::geometry::ntree::pair::Pairing;
5
6#[derive(Clone, Copy, Debug)]
8pub enum Balancing {
9 Strong(usize),
12 Weak(usize),
14 None,
16}
17
18pub trait Balance {
19 fn equilibrate(&mut self, balancing: Balancing, pairing: Pairing) -> Result<(), &'static str> {
20 let mut balanced = false;
21 let mut paired = false;
22 while !balanced || !paired {
23 balanced = self.balance(balancing);
24 paired = self.pair_up(pairing)?;
25 }
26 Ok(())
27 }
28 fn balance(&mut self, balancing: Balancing) -> bool;
29 fn pair_up(&mut self, pairing: Pairing) -> Result<bool, &'static str>;
30}