CollisionVolume* TreeBuilder::recConstructTree(Model* const model, BoundingBox* const box, int level) { if(level == 0) { return 0; } else { CollisionVolume* rootVolume = box; if(this->type == OCT) { for(int i = 0; i < 8; ++i) { BoxQuadrent loc = (BoxQuadrent)(TOP_FRONT_LEFT + i); PartialBoundingBox* subQuad = buildSubQuadrent(model, box->getLocalCorners(), loc); //Visualizer::showSphere(subQuad->getCenter(), subQuad->getRadius()); if(triangleInSphere(model, subQuad)) { //BoundingSphere* octSphere = boxToSphere(model, subQuad); rootVolume->setChild(subQuad); subQuad->setChild(recConstructTree(model, subQuad, level-1)); } } } else if(this->type == QUAD) { } return (CollisionVolume*)rootVolume->getChild(); } }