ISpatial_DB::~ISpatial_DB() { if ( m_root ) { _node_destroy(m_root); } while (!allocator_pool.empty()){ allocator.destroy (allocator_pool.back()); allocator_pool.pop_back (); } }
void ISpatial_DB::_remove (ISpatial_NODE* N, ISpatial_NODE* N_sub) { if (0==N) return; //*** we are assured that node contains N_sub and this subnode is empty u32 octant = u32(-1); if (N_sub==N->children[0]) octant = 0; else if (N_sub==N->children[1]) octant = 1; else if (N_sub==N->children[2]) octant = 2; else if (N_sub==N->children[3]) octant = 3; else if (N_sub==N->children[4]) octant = 4; else if (N_sub==N->children[5]) octant = 5; else if (N_sub==N->children[6]) octant = 6; else if (N_sub==N->children[7]) octant = 7; VERIFY (octant<8); VERIFY (N_sub->_empty()); _node_destroy (N->children[octant]); // Recurse if (N->_empty()) _remove(N->parent,N); }