/*! * \brief Constructor * * creates a new BVHNode and a BoundingSphere which has one center and * contains all triangles getting from the list */ DeformableBvhNode::DeformableBvhNode(World* world, const std::list<Triangle*>& triangles, const Vertex* center) : BvhNode(world) { createBoundingSphere(triangles, center); //sets each Triangle his enclosing BoundingNode std::list<Triangle*>::const_iterator iter; iter = triangles.begin(); for (;iter != triangles.end(); iter++) { (*iter)->addBvHierarchyNode(this); } }
/*! * \brief Adds one triangle and recalculates the BoundingSphere * */ void DeformableBvhNode::addTriangle(Triangle* triangle) { //std::cout << "DeformableBvhNode::addTriangle(Triangle* triangle)" << std::endl; //adds the triangle to the existing list of Enclosed Triangles std::list<Triangle*> triangles = mBoundingVolume->getEnclosedTriangles(); triangles.push_back(triangle); //sets the Triangle his enclosing BoundingNode triangle->addBvHierarchyNode(this); const Vertex* center = ((BoundingSphere*) mBoundingVolume)->getCenterVertex(); delete(mBoundingVolume); createBoundingSphere(triangles, center); }
const SrSphere3D test_SmallestEnclosingSphere_TwinklingStar(const SrPoint3D* point, int n) { return createBoundingSphere(point,n); }