template<class TheObjType, class TheBndType>
class NCollection_UBTree< TheObjType, TheBndType >
The algorithm of unbalanced binary tree of overlapped bounding boxes.
Once the tree of boxes of geometric objects is constructed, the algorithm is capable of fast geometric selection of objects. The tree can be easily updated by adding to it a new object with bounding box.
The time of adding to the tree of one object is O(log(N)), where N is the total number of objects, so the time of building a tree of N objects is O(N(log(N)). The search time of one object is O(log(N)).
Defining various classes inheriting NCollection_UBTree::Selector we can perform various kinds of selection over the same b-tree object
The object may be of any type allowing copying. Among the best suitable solutions there can be a pointer to an object, handled object or integer index of object inside some collection. The bounding object may have any dimension and geometry. The minimal interface of TheBndType (besides public empty and copy constructor and operator =) used in UBTree algorithm is as the following:
class MyBndType
{
public:
inline void Add (
const MyBndType& other);
};
bool Standard_Boolean
Definition: Standard_TypeDef.hxx:77
double Standard_Real
Definition: Standard_TypeDef.hxx:76
virtual Standard_Boolean Add(const TheObjType &theObj, const TheBndType &theBnd)
Definition: NCollection_UBTree.hxx:351
To select objects you need to define a class derived from UBTree::Selector that should redefine the necessary virtual methods to maintain the selection condition. The object of this class is also used to retrieve selected objects after search.