fn grow_leaf_branch(&mut self, i: usize, center: Vec3<i64>, pts: &Pos) {
		assert!(self.nodes[i].is_leaf());
		assert!(self.nodes[i].is_full());
		let mut br = Node::new_branch();
		let link = self.nodes[i].link() as u32;
		for hnd in self.nodes[i].leaf_children() {
			let p = pts.pos(hnd).into();
			let ch = Node::which_child(center, p);
			let j = br.child[ch] as usize;
			if j > 0 {
				// NOTE: if there is a link, all children
				//       must be coincident
				assert!(self.nodes[j - 1].link() as u32 == link);
				self.nodes[j - 1].add_leaf(hnd);
			} else {
				let k = self.new_leaf();
				// Preserve link to coincident leaves
				self.nodes[k - 1].child[LINK as usize] = link;
				self.nodes[k - 1].add_leaf(hnd);
				br.child[ch] = k as u32;
			}
		}
		self.nodes[i] = br;
	}
/// Grow a full leaf into a branch
Grow a full leaf into a branch
Grow a full leaf into a branch
fn grow_leaf_branch(&mut self, i: usize, center: Vec3<i64>, pts: &Pos) {
		assert!(self.nodes[i].is_leaf());
		assert!(self.nodes[i].is_full());
		let mut br = Node::new_branch();
		let link = self.nodes[i].link() as u32;
		for hnd in self.nodes[i].leaf_children() {
			let p = pts.pos(hnd).into();
			let ch = Node::which_child(center, p);
			let j = br.child[ch] as usize;
			if j > 0 {
				// NOTE: if there is a link, all children
				//       must be coincident
				assert!(self.nodes[j - 1].link() as u32 == link);
				self.nodes[j - 1].add_leaf(hnd);
			} else {
				let k = self.new_leaf();
				// Preserve link to coincident leaves
				self.nodes[k - 1].child[LINK as usize] = link;
				self.nodes[k - 1].add_leaf(hnd);
				br.child[ch] = k as u32;
			}
		}
		self.nodes[i] = br;
	}
fn grow_leaf_branch ( & mut self , i : usize , center : Vec3 < i64 > , pts : & Pos ) { assert ! ( self nodes [ i ] is_leaf ( ) ) ; assert ! ( self nodes [ i ] is_full ( ) ) ; let mut br = Node :: new_branch ( ) ; let link = self . nodes [ i ] . link ( ) as u32 ; for hnd in self . nodes [ i ] . leaf_children ( ) { let p = pts . pos ( hnd ) . into ( ) ; let ch = Node :: which_child ( center , p ) ; let j = br . child [ ch ] as usize ; if j > 0 { // NOTE: if there is a link, all children //       must be coincident assert ! ( self nodes [ j 1 ] link ( ) as u32 link ) ; self . nodes [ j - 1 ] . add_leaf ( hnd ) ; } else { let k = self . new_leaf ( ) ; // Preserve link to coincident leaves self . nodes [ k - 1 ] . child [ LINK as usize ] = link ; self . nodes [ k - 1 ] . add_leaf ( hnd ) ; br . child [ ch ] = k as u32 ; } } self . nodes [ i ] = br ; }
Grow a full leaf into a branch
Grow a full leaf into a branch
&mut self
i
usize
center
Vec3<i64>
pts
&Pos