|
void | Insert (const ELEMTYPE a_min[NUMDIMS], const ELEMTYPE a_max[NUMDIMS], const DATATYPE &a_dataId) |
| Insert entry.
|
|
bool | Remove (const ELEMTYPE a_min[NUMDIMS], const ELEMTYPE a_max[NUMDIMS], const DATATYPE &a_dataId) |
| Remove entry.
|
|
int | Search (const ELEMTYPE a_min[NUMDIMS], const ELEMTYPE a_max[NUMDIMS], std::function< bool(const DATATYPE &)> a_callback) const |
| Find all within search rectangle.
|
|
int | Search (const ELEMTYPE a_min[NUMDIMS], const ELEMTYPE a_max[NUMDIMS], std::function< bool(const DATATYPE &)> a_callback, bool &aFinished) const |
| Find all within search rectangle.
|
|
template<class VISITOR > |
int | Search (const ELEMTYPE a_min[NUMDIMS], const ELEMTYPE a_max[NUMDIMS], VISITOR &a_visitor) const |
|
Statistics | CalcStats () |
| Calculate Statistics.
|
|
void | RemoveAll () |
| Remove all entries from tree.
|
|
int | Count () const |
| Count the data elements in this container. This is slow as no internal counter is maintained.
|
|
bool | Load (const char *a_fileName) |
| Load tree contents from file.
|
|
bool | Load (RTFileStream &a_stream) const |
| Load tree contents from stream.
|
|
bool | Save (const char *a_fileName) |
| Save tree contents to file.
|
|
bool | Save (RTFileStream &a_stream) const |
| Save tree contents to stream.
|
|
std::vector< std::pair< ELEMTYPE, DATATYPE > > | NearestNeighbors (const ELEMTYPE aPoint[NUMDIMS], std::function< bool(const std::size_t aNumResults, const ELEMTYPE aMinDist)> aTerminate, std::function< bool(const DATATYPE aElement)> aFilter, std::function< ELEMTYPE(const ELEMTYPE a_point[NUMDIMS], const DATATYPE a_data)> aSquaredDist) const |
| Gets an ordered vector of the nearest data elements to a specified point.
|
|
iterator | begin (const Rect &aRect) const |
|
iterator | begin () const |
|
iterator | end () const |
|
iterator | end (const Rect &aRect) const |
|
|
Node * | AllocNode () const |
|
void | FreeNode (Node *a_node) const |
|
void | InitNode (Node *a_node) const |
|
void | InitRect (Rect *a_rect) const |
|
bool | InsertRectRec (const Rect *a_rect, const DATATYPE &a_id, Node *a_node, Node **a_newNode, int a_level) const |
|
bool | InsertRect (const Rect *a_rect, const DATATYPE &a_id, Node **a_root, int a_level) const |
|
Rect | NodeCover (Node *a_node) const |
|
bool | AddBranch (const Branch *a_branch, Node *a_node, Node **a_newNode) const |
|
void | DisconnectBranch (Node *a_node, int a_index) const |
|
int | PickBranch (const Rect *a_rect, Node *a_node) const |
|
Rect | CombineRect (const Rect *a_rectA, const Rect *a_rectB) const |
|
void | SplitNode (Node *a_node, const Branch *a_branch, Node **a_newNode) const |
|
ELEMTYPEREAL | RectSphericalVolume (const Rect *a_rect) const |
|
ELEMTYPEREAL | RectVolume (const Rect *a_rect) const |
|
ELEMTYPEREAL | CalcRectVolume (const Rect *a_rect) const |
|
void | GetBranches (Node *a_node, const Branch *a_branch, PartitionVars *a_parVars) const |
|
void | ChoosePartition (PartitionVars *a_parVars, int a_minFill) const |
|
void | LoadNodes (Node *a_nodeA, Node *a_nodeB, PartitionVars *a_parVars) const |
|
void | InitParVars (PartitionVars *a_parVars, int a_maxRects, int a_minFill) const |
|
void | PickSeeds (PartitionVars *a_parVars) const |
|
void | Classify (int a_index, int a_group, PartitionVars *a_parVars) const |
|
bool | RemoveRect (const Rect *a_rect, const DATATYPE &a_id, Node **a_root) const |
|
bool | RemoveRectRec (const Rect *a_rect, const DATATYPE &a_id, Node *a_node, ListNode **a_listNode) const |
|
ListNode * | AllocListNode () const |
|
void | FreeListNode (ListNode *a_listNode) const |
|
void | ReInsert (Node *a_node, ListNode **a_listNode) const |
|
ELEMTYPE | MinDist (const ELEMTYPE a_point[NUMDIMS], const Rect &a_rect) const |
|
bool | Search (const Node *a_node, const Rect *a_rect, int &a_foundCount, std::function< bool(const DATATYPE &)> a_callback) const |
|
template<class VISITOR > |
bool | Search (const Node *a_node, const Rect *a_rect, VISITOR &a_visitor, int &a_foundCount) const |
|
void | RemoveAllRec (Node *a_node) const |
|
void | Reset () const |
|
void | CountRec (const Node *a_node, int &a_count) const |
|
bool | SaveRec (const Node *a_node, RTFileStream &a_stream) const |
|
bool | LoadRec (const Node *a_node, RTFileStream &a_stream) const |
|
template<class DATATYPE, class ELEMTYPE, int NUMDIMS, class ELEMTYPEREAL = ELEMTYPE, int TMAXNODES = 8, int TMINNODES = TMAXNODES / 2>
class RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >
Implementation of RTree, a multidimensional bounding rectangle tree.
Example usage: For a 3-dimensional tree use RTree<Object*, float, 3> myTree;
This modified, templated C++ version by Greg Douglas at Auran (http://www.auran.com)
DATATYPE Referenced data, should be int, void*, obj* etc. no larger than sizeof<void*> and simple type ELEMTYPE Type of element such as int or float NUMDIMS Number of dimensions such as 2 or 3 ELEMTYPEREAL Type of element that allows fractional and large values such as float or double, for use in volume calcs
NOTES: Inserting and removing data requires the knowledge of its constant Minimal Bounding Rectangle. This version uses new/delete for nodes, I recommend using a fixed size allocator for efficiency. Instead of using a callback function for returned results, I recommend and efficient pre-sized, grow-only memory array similar to MFC CArray or STL Vector for returning search query result.