
272 Chapter 12 Collision Detection
Center
of new
parent
sphere
Sphere 1
Sphere 2
FIGURE 12.8 Working out a parent bounding sphere.
* Holds the node immediately above us in the tree.
*/
BVHNode * parent;
};
Removing an object from the hierarchy involves replacing its parent node with its
sibling, and recalculating the bounding volumes further up the hierarchy. Figure 12.9
illustrates this process. It can be implemented as follows:
Excerpt from file include/cyclone/collide_broad.h
template<class BoundingVolumeClass>
class BVHNode
{
// ... Other BVHNode code as before ...
/**
* Deletes this node, removing it first from the hierarchy,