include
coal
broadphase
detail
coal/broadphase/detail/interval_tree.h
Go to the documentation of this file.
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Copyright (c) 2011-2014, Willow Garage, Inc.
5
* Copyright (c) 2014-2016, Open Source Robotics Foundation
6
* All rights reserved.
7
*
8
* Redistribution and use in source and binary forms, with or without
9
* modification, are permitted provided that the following conditions
10
* are met:
11
*
12
* * Redistributions of source code must retain the above copyright
13
* notice, this list of conditions and the following disclaimer.
14
* * Redistributions in binary form must reproduce the above
15
* copyright notice, this list of conditions and the following
16
* disclaimer in the documentation and/or other materials provided
17
* with the distribution.
18
* * Neither the name of Open Source Robotics Foundation nor the names of its
19
* contributors may be used to endorse or promote products derived
20
* from this software without specific prior written permission.
21
*
22
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33
* POSSIBILITY OF SUCH DAMAGE.
34
*/
35
38
#ifndef COAL_INTERVAL_TREE_H
39
#define COAL_INTERVAL_TREE_H
40
41
#include <deque>
42
#include <limits>
43
#include <cstdlib>
44
45
#include "
coal/broadphase/detail/interval_tree_node.h
"
46
47
namespace
coal
{
48
namespace
detail {
49
53
struct
COAL_DLLAPI
it_recursion_node
{
54
public
:
55
IntervalTreeNode
*
start_node
;
56
57
unsigned
int
parent_index
;
58
59
bool
try_right_branch
;
60
};
61
63
class
COAL_DLLAPI
IntervalTree
{
64
public
:
65
IntervalTree
();
66
67
~
IntervalTree
();
68
70
void
print
()
const
;
71
73
SimpleInterval
* deleteNode(
IntervalTreeNode
* node);
74
76
void
deleteNode(
SimpleInterval
* ivl);
77
79
IntervalTreeNode
* insert(
SimpleInterval
* new_interval);
80
82
IntervalTreeNode
* getPredecessor(
IntervalTreeNode
* node)
const
;
83
85
IntervalTreeNode
* getSuccessor(
IntervalTreeNode
* node)
const
;
86
88
std::deque<SimpleInterval*> query(
CoalScalar
low,
CoalScalar
high);
89
90
protected
:
91
IntervalTreeNode
*
root
;
92
93
IntervalTreeNode
*
invalid_node
;
94
96
void
leftRotate(
IntervalTreeNode
* node);
97
99
void
rightRotate(
IntervalTreeNode
* node);
100
102
void
recursiveInsert(
IntervalTreeNode
* node);
103
105
void
recursivePrint(
IntervalTreeNode
* node)
const
;
106
108
IntervalTreeNode
* recursiveSearch(
IntervalTreeNode
* node,
109
SimpleInterval
* ivl)
const
;
110
113
void
fixupMaxHigh(
IntervalTreeNode
* node);
114
115
void
deleteFixup(
IntervalTreeNode
* node);
116
117
private
:
118
unsigned
int
recursion_node_stack_size
;
119
it_recursion_node
*
recursion_node_stack
;
120
unsigned
int
current_parent
;
121
unsigned
int
recursion_node_stack_top
;
122
};
123
124
}
// namespace detail
125
}
// namespace coal
126
127
#endif
coal::detail::IntervalTree::invalid_node
IntervalTreeNode * invalid_node
Definition:
coal/broadphase/detail/interval_tree.h:93
coal::detail::it_recursion_node::try_right_branch
bool try_right_branch
Definition:
coal/broadphase/detail/interval_tree.h:59
coal::detail::IntervalTree::root
IntervalTreeNode * root
Definition:
coal/broadphase/detail/interval_tree.h:91
print
void print(const Eigen::SparseMatrix< Scalar, Options > &mat)
coal::detail::IntervalTree
Interval tree.
Definition:
coal/broadphase/detail/interval_tree.h:63
coal::detail::it_recursion_node
Class describes the information needed when we take the right branch in searching for intervals but p...
Definition:
coal/broadphase/detail/interval_tree.h:53
coal::detail::it_recursion_node::parent_index
unsigned int parent_index
Definition:
coal/broadphase/detail/interval_tree.h:57
coal
Main namespace.
Definition:
coal/broadphase/broadphase_bruteforce.h:44
coal::detail::IntervalTree::recursion_node_stack
it_recursion_node * recursion_node_stack
Definition:
coal/broadphase/detail/interval_tree.h:119
coal::detail::IntervalTree::recursion_node_stack_top
unsigned int recursion_node_stack_top
Definition:
coal/broadphase/detail/interval_tree.h:121
coal::detail::SimpleInterval
Interval trees implemented using red-black-trees as described in the book Introduction_To_Algorithms_...
Definition:
coal/broadphase/detail/simple_interval.h:49
coal::detail::IntervalTreeNode
The node for interval tree.
Definition:
coal/broadphase/detail/interval_tree_node.h:51
coal::detail::IntervalTree
class COAL_DLLAPI IntervalTree
Definition:
coal/broadphase/detail/interval_tree_node.h:48
interval_tree_node.h
coal::detail::IntervalTree::current_parent
unsigned int current_parent
Definition:
coal/broadphase/detail/interval_tree.h:120
coal::detail::it_recursion_node::start_node
IntervalTreeNode * start_node
Definition:
coal/broadphase/detail/interval_tree.h:55
coal::CoalScalar
double CoalScalar
Definition:
coal/data_types.h:76
coal::detail::IntervalTree::recursion_node_stack_size
unsigned int recursion_node_stack_size
Definition:
coal/broadphase/detail/interval_tree.h:118
hpp-fcl
Author(s):
autogenerated on Sat Nov 23 2024 03:44:58