Go to the documentation of this file.
38 #ifndef COAL_INTERVAL_TREE_INL_H
39 #define COAL_INTERVAL_TREE_INL_H
55 -(std::numeric_limits<CoalScalar>::max)();
61 (std::numeric_limits<CoalScalar>::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);
113 y->parent =
x->parent;
115 if (
x ==
x->parent->left)
118 x->parent->right =
y;
124 std::max(
x->left->max_high, std::max(
x->right->max_high,
x->high));
125 y->max_high = std::max(
x->max_high, std::max(
y->right->max_high,
y->high));
137 x->parent =
y->parent;
138 if (
y ==
y->parent->left)
141 y->parent->right =
x;
147 std::max(
y->left->max_high, std::max(
y->right->max_high,
y->high));
148 x->max_high = std::max(
x->left->max_high, std::max(
y->max_high,
x->high));
177 std::max(
x->high, std::max(
x->left->max_high,
x->right->max_high));
193 while (
x->parent->red) {
195 if (
x->parent ==
x->parent->parent->left) {
196 y =
x->parent->parent->right;
198 x->parent->red =
true;
200 x->parent->parent->red =
true;
201 x =
x->parent->parent;
203 if (
x ==
x->parent->right) {
207 x->parent->red =
false;
208 x->parent->parent->red =
true;
212 y =
x->parent->parent->left;
214 x->parent->red =
false;
216 x->parent->parent->red =
true;
217 x =
x->parent->parent;
219 if (
x ==
x->parent->left) {
223 x->parent->red =
false;
224 x->parent->parent->red =
true;
242 while (
x ==
y->right) {
260 while (
x ==
y->left) {
286 while ((!
x->red) && (root_left_node !=
x)) {
287 if (
x ==
x->parent->left) {
288 w =
x->parent->right;
291 x->parent->red =
true;
293 w =
x->parent->right;
303 w =
x->parent->right;
305 w->
red =
x->parent->red;
306 x->parent->red =
false;
315 x->parent->red =
true;
329 w->
red =
x->parent->red;
330 x->parent->red =
false;
371 if (
root == (
x->parent =
y->parent)) {
374 if (
y ==
y->parent->left) {
377 y->parent->right =
x;
384 y->max_high = -(std::numeric_limits<CoalScalar>::max)();
407 return node_to_delete;
423 std::deque<SimpleInterval*> result_stack;
430 if (
overlap(low, high,
x->key,
x->high)) {
431 result_stack.push_back(
x->stored_interval);
434 if (
x->left->max_high >= low) {
IntervalTreeNode * invalid_node
IntervalTreeNode * insert(SimpleInterval *new_interval)
Insert one node of the interval tree.
bool red
red or black node: if red = false then the node is black
void print() const
Print the whole interval tree.
IntervalTreeNode * parent
Class describes the information needed when we take the right branch in searching for intervals but p...
unsigned int parent_index
IntervalTreeNode * getSuccessor(IntervalTreeNode *node) const
Get the successor of a given node.
std::deque< SimpleInterval * > query(CoalScalar low, CoalScalar high)
Return result for a given query.
void rightRotate(IntervalTreeNode *node)
right rotation of tree node
it_recursion_node * recursion_node_stack
unsigned int recursion_node_stack_top
SimpleInterval * stored_interval
interval stored in the node
void recursiveInsert(IntervalTreeNode *node)
Inserts node into the tree as if it were a regular binary tree.
Interval trees implemented using red-black-trees as described in the book Introduction_To_Algorithms_...
The node for interval tree.
void leftRotate(IntervalTreeNode *node)
left rotation of tree node
bool overlap(CoalScalar a1, CoalScalar a2, CoalScalar b1, CoalScalar b2)
returns 1 if the intervals overlap, and 0 otherwise
IntervalTreeNode * getPredecessor(IntervalTreeNode *node) const
get the predecessor of a given node
void recursivePrint(IntervalTreeNode *node) const
recursively print a subtree
IntervalTreeNode * recursiveSearch(IntervalTreeNode *node, SimpleInterval *ivl) const
recursively find the node corresponding to the interval
unsigned int current_parent
void deleteFixup(IntervalTreeNode *node)
void fixupMaxHigh(IntervalTreeNode *node)
Travels up to the root fixing the max_high fields after an insertion or deletion.
SimpleInterval * deleteNode(IntervalTreeNode *node)
Delete one node of the interval tree.
IntervalTreeNode * start_node
unsigned int recursion_node_stack_size
hpp-fcl
Author(s):
autogenerated on Sat Nov 23 2024 03:44:58