/** * \brief Recompute the bounding box */ void adjust_box(node_pointer const& node) { unsigned int index = 0; for (typename node_map::iterator it = m_nodes.begin(); it != m_nodes.end(); ++it, index++) { if (it->second.get() == node.get()) { m_nodes[index] = std::make_pair(node->compute_box(), node); return; } } }
/** * \brief Replace the node in the m_nodes vector and recompute the box */ void replace_node(node_pointer const& leaf, node_pointer& new_leaf) { unsigned int index = 0; for(typename node_map::iterator it = m_nodes.begin(); it != m_nodes.end(); ++it, index++) { if (it->second.get() == leaf.get()) { m_nodes[index] = std::make_pair(new_leaf->compute_box(), new_leaf); new_leaf->update_parent(new_leaf); return; } } // TODO: mloskot - define & use GGL exception throw std::logic_error("Node not found."); }