hpp-fcl
2.4.1
HPP fork of FCL -- The Flexible Collision Library
|
Go to the documentation of this file.
38 #ifndef HPP_FCL_HIERARCHY_TREE_ARRAY_H
39 #define HPP_FCL_HIERARCHY_TREE_ARRAY_H
55 namespace implementation_array {
58 template <
typename BV>
65 SortByMorton(
Node* nodes_in) :
nodes(nodes_in) {}
66 SortByMorton(
Node* nodes_in, uint32_t split_in)
67 :
nodes(nodes_in), split(split_in) {}
68 bool operator()(
size_t a,
size_t b)
const {
89 HierarchyTree(
int bu_threshold_ = 16,
int topdown_level_ = 0);
95 void init(
Node* leaves,
int n_leaves_,
int level = 0);
99 size_t insert(
const BV& bv,
void* data);
111 void update(
size_t leaf,
int lookahead_level = -1);
115 bool update(
size_t leaf,
const BV& bv);
121 bool update(
size_t leaf,
const BV& bv,
const Vec3f& vel);
155 void print(
size_t root,
int depth);
159 void bottomup(
size_t* lbeg,
size_t* lend);
162 size_t topdown(
size_t* lbeg,
size_t* lend);
168 void getMaxDepth(
size_t node,
size_t depth,
size_t& max_depth)
const;
175 size_t topdown_0(
size_t* lbeg,
size_t* lend);
183 size_t topdown_1(
size_t* lbeg,
size_t* lend);
187 void init_0(
Node* leaves,
int n_leaves_);
193 void init_1(
Node* leaves,
int n_leaves_);
199 void init_2(
Node* leaves,
int n_leaves_);
204 void init_3(
Node* leaves,
int n_leaves_);
206 size_t mortonRecurse_0(
size_t* lbeg,
size_t* lend,
const uint32_t& split,
209 size_t mortonRecurse_1(
size_t* lbeg,
size_t* lend,
const uint32_t& split,
212 size_t mortonRecurse_2(
size_t* lbeg,
size_t* lend);
215 void update_(
size_t leaf,
const BV& bv);
218 void insertLeaf(
size_t root,
size_t leaf);
223 size_t removeLeaf(
size_t leaf);
227 void fetchLeaves(
size_t root,
Node*& leaves,
int depth = -1);
229 size_t indexOf(
size_t node);
231 size_t allocateNode();
234 size_t createNode(
size_t parent,
const BV& bv1,
const BV& bv2,
void* data);
236 size_t createNode(
size_t parent,
const BV& bv,
void* data);
238 size_t createNode(
size_t parent,
void* data);
240 void deleteNode(
size_t node);
242 void recurseRefit(
size_t node);
264 static const size_t NULL_NODE = std::numeric_limits<size_t>::max();
267 template <
typename BV>
271 template <
typename BV>
287 template <
typename BV>
292 template <
typename BV>
size_t getMaxHeight() const
get the max height of the tree
Definition: hierarchy_tree_array-inl.h:322
Definition: node_base_array.h:51
Node * nodes
Definition: hierarchy_tree_array.h:246
Eigen::Matrix< FCL_REAL, 3, 1 > Vec3f
Definition: data_types.h:66
void print(size_t root, int depth)
print the tree in a recursive way
Definition: hierarchy_tree_array-inl.h:440
int max_lookahead_level
Definition: hierarchy_tree_array.h:254
void remove(size_t leaf)
Remove a leaf node.
Definition: hierarchy_tree_array-inl.h:246
size_t freelist
Definition: hierarchy_tree_array.h:251
size_t n_nodes
Definition: hierarchy_tree_array.h:247
Functor comparing two nodes.
Definition: hierarchy_tree_array.h:272
void clear()
Clear the tree.
Definition: hierarchy_tree_array-inl.h:254
size_t size() const
number of leaves in the tree
Definition: hierarchy_tree_array-inl.h:422
uint32_t code
Definition: node_base_array.h:64
size_t getRoot() const
get the root of the tree
Definition: hierarchy_tree_array-inl.h:428
size_t root_node
Definition: hierarchy_tree_array.h:245
void init(Node *leaves, int n_leaves_, int level=0)
Initialize the tree by a set of leaves using algorithm with a given level.
Definition: hierarchy_tree_array-inl.h:78
static const size_t NULL_NODE
Definition: hierarchy_tree_array.h:264
double FCL_REAL
Definition: data_types.h:65
int topdown_level
decide which topdown algorithm to use
Definition: hierarchy_tree_array.h:258
size_t select(size_t query, size_t node1, size_t node2, NodeBase< BV > *nodes)
select the node from node1 and node2 which is close to the query-th node in the nodes....
Definition: hierarchy_tree_array-inl.h:934
Main namespace.
Definition: broadphase_bruteforce.h:44
Class for hierarchy tree structure.
Definition: hierarchy_tree_array.h:59
void update(size_t leaf, int lookahead_level=-1)
update one leaf node
Definition: hierarchy_tree_array-inl.h:276
~HierarchyTree()
Definition: hierarchy_tree_array-inl.h:72
size_t getMaxDepth() const
get the max depth of the tree
Definition: hierarchy_tree_array-inl.h:330
void balanceIncremental(int iterations)
balance the tree in an incremental way
Definition: hierarchy_tree_array-inl.h:386
dynamic AABB tree node
Definition: node_base.h:50
bool empty() const
Whether the tree is empty.
Definition: hierarchy_tree_array-inl.h:270
void balanceBottomup()
balance the tree from bottom
Definition: hierarchy_tree_array-inl.h:340
HierarchyTree(int bu_threshold_=16, int topdown_level_=0)
Create hierarchy tree with suitable setting. bu_threshold decides the height of tree node to start bo...
Definition: hierarchy_tree_array-inl.h:55
int bu_threshold
decide the depth to use expensive bottom-up algorithm
Definition: hierarchy_tree_array.h:261
size_t insert(const BV &bv, void *data)
Initialize the tree by a set of leaves using algorithm with a given level.
Definition: hierarchy_tree_array-inl.h:237
void balanceTopdown()
balance the tree from top
Definition: hierarchy_tree_array-inl.h:364
bool operator()(size_t i, size_t j) const
Definition: hierarchy_tree_array-inl.h:902
NodeBase< BV > Node
Definition: hierarchy_tree_array.h:61
size_t n_nodes_alloc
Definition: hierarchy_tree_array.h:248
nodeBaseLess(const NodeBase< BV > *nodes_, size_t d_)
Definition: hierarchy_tree_array-inl.h:895
size_t n_leaves
Definition: hierarchy_tree_array.h:250
void refit()
refit the tree, i.e., when the leaf nodes' bounding volumes change, update the entire tree in a botto...
Definition: hierarchy_tree_array-inl.h:404
void extractLeaves(size_t root, Node *&leaves) const
extract all the leaves of the tree
Definition: hierarchy_tree_array-inl.h:410
unsigned int opath
Definition: hierarchy_tree_array.h:252
Node * getNodes() const
get the pointer to the nodes array
Definition: hierarchy_tree_array-inl.h:434