Cafu Engine
OrthoBspTreeT::NodeT Class Reference

Public Types

enum  PlaneTypeE { NONE =-1, ALONG_X, ALONG_Y, ALONG_Z }
 As the nodes of the tree are not subdivided by arbitrary planes, but only by planes that are parallel to the major axes, we do not store a full Plane3T<> member with the nodes, but only a "compacted" representation: The type expresses which axes the plane is parallel to, the distance is the offset from the origin. More...
 

Public Member Functions

 NodeT (const BoundingBox3fT &BB)
 The constructor. More...
 
 ~NodeT ()
 The destructor. More...
 
PlaneTypeE GetPlaneType () const
 
float GetPlaneDist () const
 
const NodeTGetChild (unsigned int ChildNr) const
 
const ArrayT< MapElementT * > & GetElems () const
 
const BoundingBox3fTGetBB () const
 
unsigned long GetNumNodes () const
 Returns the number of nodes in the (sub-)tree at and below this node. More...
 
bool DetermineSplitPlane ()
 Determines an axis-aligned split plane for further BSP partitioning of the contents of this node. More...
 
bool IntersectsAllChildren (const BoundingBox3fT &BB) const
 Determines whether the given BB intersects (is partly inside) each child of this node. More...
 
void FindMismatches (ArrayT< MapElementT * > &Mismatches) const
 Finds any map elements in the (sub-)tree whose spatial position disagrees with their position in the tree. More...
 
void Insert (MapElementT *Elem)
 Recursively inserts the given element into the (sub-)tree at and below this node. More...
 
void Remove (MapElementT *Elem)
 Removes the given element from the (sub-)tree at and below this node (the structure of the tree remains unchanged). More...
 

Friends

class OrthoBspTreeT
 

Member Enumeration Documentation

As the nodes of the tree are not subdivided by arbitrary planes, but only by planes that are parallel to the major axes, we do not store a full Plane3T<> member with the nodes, but only a "compacted" representation: The type expresses which axes the plane is parallel to, the distance is the offset from the origin.

Enumerator
NONE 

No plane at all. Used for nodes that are actually leaves.

ALONG_X 

A plane with normal vector (1, 0, 0), parallel to the y- and z-axis.

ALONG_Y 

A plane with normal vector (0, 1, 0), parallel to the x- and z-axis.

ALONG_Z 

A plane with normal vector (0, 0, 1), parallel to the x- and y-axis.

Constructor & Destructor Documentation

OrthoBspTreeT::NodeT::NodeT ( const BoundingBox3fT BB)

The constructor.

Parameters
BBThe bounding box of this node (one "half" of the box of the parent).
OrthoBspTreeT::NodeT::~NodeT ( )

The destructor.

Member Function Documentation

bool OrthoBspTreeT::NodeT::DetermineSplitPlane ( )

Determines an axis-aligned split plane for further BSP partitioning of the contents of this node.

For choosing the split plane, the method considers the bounding-box planes of all objects (polygons, brushes, terrains) of this node and all its ancestors, provided that they are wholly or partially in BB. When a split plane was found, the m_PlaneType and m_PlaneDist members are appropriately set and true is returned, otherwise they are initialized with NONE and 0, respectively, and the return value is false.

Returns
whether a split plane has successfully been determined.
void OrthoBspTreeT::NodeT::FindMismatches ( ArrayT< MapElementT * > &  Mismatches) const

Finds any map elements in the (sub-)tree whose spatial position disagrees with their position in the tree.

unsigned long OrthoBspTreeT::NodeT::GetNumNodes ( ) const

Returns the number of nodes in the (sub-)tree at and below this node.

void OrthoBspTreeT::NodeT::Insert ( MapElementT Elem)

Recursively inserts the given element into the (sub-)tree at and below this node.

bool OrthoBspTreeT::NodeT::IntersectsAllChildren ( const BoundingBox3fT BB) const

Determines whether the given BB intersects (is partly inside) each child of this node.

Parameters
BBThe bounding box that is tested for intersection.
void OrthoBspTreeT::NodeT::Remove ( MapElementT Elem)

Removes the given element from the (sub-)tree at and below this node (the structure of the tree remains unchanged).


The documentation for this class was generated from the following files: