CODBspTree Class
class CODBspTree
A binary space partitioning tree that stores the bounding rectangles of the components in a model. Only rectangles are used, and the z-order of components are not stored to speed up the population and searches on the tree. This tree must be updated whenever the bounding box of a component changes.Defined in: OdBspTree.h
See Also
Class Members
Construction
Constructor.
BOOL Create(CRect rcSpace)
Creates the BSP tree representing a rectangle of space.
BOOL Create(CRect rcSpace, int nThreshold)
Creates the BSP tree setting the threshold explicitly.
BOOL Create(CRect rcSpace, float fThresholdPct)
Creates the BSP tree setting the threshold as a percentage.
Attributes
int m_nThreshold
The minimum dimension threshold of a BSP node in this tree.
CODBspNode* m_pRootNode
A pointer to the root node of this tree.
int GetThreshold()
Retrieves the minimum dimension threshold of a BSP node in this tree.
Operations
void AddComponent(CODComponent* pComp)
Stores the position information of a component in the tree.
void AddComponents(CODComponentSet* pCompSet)
Stores the position information of a set of components in the tree.
void RemoveComponent(CODComponent* pComp)
Removes the position information of a component from the tree.
void RemoveComponents(CODComponentSet* pCompSet)
Removes the position information of a set of components from the tree.
void GetContaining(CODComponentSet* pCompSet, CPoint point, int nPadding = 0)
Retrieves the set of components which contain the point passed in.
void GetWithin(CODComponentSet* pCompSet, CRect rect)
Retrieves the set of components which are within the rectangle passed in.
void GetIntersecting(CODComponentSet* pCompSet, CRect rect)
Retrieves the set of componetns which intersect with the rectangle passed in.
Implementation
virtual ~CODBspTree()
Destructor.
void MapToSet(CODComponentMap* pCompMap, CODComponentSet* pCompSet)
Transfers the components in a map to a set.
void GetBspRects(CODComponentSet* pCompSet, CODBspRectArray* pRectArray)
Creates BSP rectangles based on the bounding boxes of components.