Newer
Older
#include "BarnesHutTree.hpp"
namespace nbody {
BarnesHutTree::BarnesHutTree() {
this->root = NULL;
}
BarnesHutTree::~BarnesHutTree() {
delete this->root;
this->root = NULL;
}
void BarnesHutTree::build(vector<Body> bodies) {
delete this->root;
this->root = new TreeNode();
std::copy(bodies.begin(), bodies.end(), this->root->bodies.begin());
this->root->extendBBforBodies();
this->root->extendBBtoCube();