38 #ifndef HPP_FCL_INTERVAL_TREE_INL_H 39 #define HPP_FCL_INTERVAL_TREE_INL_H 55 -(std::numeric_limits<FCL_REAL>::max)();
61 (std::numeric_limits<FCL_REAL>::max)();
76 std::deque<IntervalTreeNode*> nodes_to_free;
80 nodes_to_free.push_back(x->
left);
83 nodes_to_free.push_back(x->
right);
87 while (nodes_to_free.size() > 0) {
88 x = nodes_to_free.back();
89 nodes_to_free.pop_back();
91 nodes_to_free.push_back(x->
left);
94 nodes_to_free.push_back(x->
right);
242 while (x == y->
right) {
260 while (x == y->
left) {
286 while ((!x->
red) && (root_left_node != x)) {
353 if (left !=
nil)
return left;
355 if (right !=
nil)
return right;
382 y->
max_high = -(std::numeric_limits<FCL_REAL>::max)();
405 return node_to_delete;
420 std::deque<SimpleInterval*> result_stack;
void print() const
Print the whole interval tree.
Interval trees implemented using red-black-trees as described in the book Introduction_To_Algorithms_...
IntervalTreeNode * insert(SimpleInterval *new_interval)
Insert one node of the interval tree.
IntervalTreeNode * getSuccessor(IntervalTreeNode *node) const
Get the successor of a given node.
void fixupMaxHigh(IntervalTreeNode *node)
Travels up to the root fixing the max_high fields after an insertion or deletion. ...
unsigned int recursion_node_stack_size
void recursiveInsert(IntervalTreeNode *node)
Inserts node into the tree as if it were a regular binary tree.
SimpleInterval * stored_interval
interval stored in the node
it_recursion_node * recursion_node_stack
Class describes the information needed when we take the right branch in searching for intervals but p...
IntervalTreeNode * parent
IntervalTreeNode * recursiveSearch(IntervalTreeNode *node, SimpleInterval *ivl) const
recursively find the node corresponding to the interval
unsigned int parent_index
void print(IntervalTreeNode *left, IntervalTreeNode *right) const
Print the interval node information: set left = nil and right = root.
void rightRotate(IntervalTreeNode *node)
right rotation of tree node
void deleteFixup(IntervalTreeNode *node)
The node for interval tree.
bool overlap(FCL_REAL a1, FCL_REAL a2, FCL_REAL b1, FCL_REAL b2)
returns 1 if the intervals overlap, and 0 otherwise
void leftRotate(IntervalTreeNode *node)
left rotation of tree node
IntervalTreeNode * getPredecessor(IntervalTreeNode *node) const
get the predecessor of a given node
unsigned int recursion_node_stack_top
unsigned int current_parent
SimpleInterval * deleteNode(IntervalTreeNode *node)
Delete one node of the interval tree.
IntervalTreeNode * start_node
std::deque< SimpleInterval * > query(FCL_REAL low, FCL_REAL high)
Return result for a given query.
bool red
red or black node: if red = false then the node is black
void recursivePrint(IntervalTreeNode *node) const
recursively print a subtree