Go to the documentation of this file.
38 #ifndef HPP_FCL_HIERARCHY_TREE_H
39 #define HPP_FCL_HIERARCHY_TREE_H
45 #include "hpp/fcl/warning.hh"
56 template <
typename BV>
66 HierarchyTree(
int bu_threshold_ = 16,
int topdown_level_ = 0);
72 void init(std::vector<Node*>& leaves,
int level = 0);
97 void update(
Node* leaf,
int lookahead_level = -1);
149 return a->code <
b->code;
182 void init_0(std::vector<Node*>& leaves);
188 void init_1(std::vector<Node*>& leaves);
194 void init_2(std::vector<Node*>& leaves);
199 void init_3(std::vector<Node*>& leaves);
202 const uint32_t& split,
int bits);
205 const uint32_t& split,
int bits);
234 void fetchLeaves(
Node* root, std::vector<Node*>& leaves,
int depth = -1);
273 template <
typename BV>
278 template <
typename BV>
284 template <
typename BV>
void bottomup(const NodeVecIterator lbeg, const NodeVecIterator lend)
construct a tree for a set of leaves from bottom – very heavy way
Eigen::Matrix< FCL_REAL, 3, 1 > Vec3f
void balanceIncremental(int iterations)
balance the tree in an incremental way
void refit()
refit the tree, i.e., when the leaf nodes' bounding volumes change, update the entire tree in a botto...
void init_3(std::vector< Node * > &leaves)
init tree from leaves using morton code. It uses morton_2, i.e., for all nodes, we simply divide the ...
Node * removeLeaf(Node *const leaf)
Remove a leaf. Maintain the tree as a full binary tree (every interior node has exactly two children)...
Node * mortonRecurse_2(const NodeVecIterator lbeg, const NodeVecIterator lend)
int topdown_level
decide which topdown algorithm to use
int bu_threshold
decide the depth to use expensive bottom-up algorithm
std::vector< NodeBase< BV > * >::iterator NodeVecIterator
void extractLeaves(const Node *root, std::vector< Node * > &leaves) const
extract all the leaves of the tree
Class for hierarchy tree structure.
void init_0(std::vector< Node * > &leaves)
init tree from leaves in the topdown manner (topdown_0 or topdown_1)
Node * topdown_1(const NodeVecIterator lbeg, const NodeVecIterator lend)
construct a tree from a list of nodes stored in [lbeg, lend) in a topdown manner. During construction...
Node * topdown(const NodeVecIterator lbeg, const NodeVecIterator lend)
construct a tree for a set of leaves from top
Node * mortonRecurse_1(const NodeVecIterator lbeg, const NodeVecIterator lend, const uint32_t &split, int bits)
size_t getMaxHeight() const
get the max height of the tree
void clear()
Clear the tree.
void balanceTopdown()
balance the tree from top
void fetchLeaves(Node *root, std::vector< Node * > &leaves, int depth=-1)
Delete all internal nodes and return all leaves nodes with given depth from root.
void insertLeaf(Node *const sub_root, Node *const leaf)
Insert a leaf node and also update its ancestors. Maintain the tree as a full binary tree (every inte...
void print(Node *root, int depth)
print the tree in a recursive way
void recurseDeleteNode(Node *node)
void deleteNode(Node *node)
bool operator()(const Node *a, const Node *b) const
size_t size() const
number of leaves in the tree
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...
Node * mortonRecurse_0(const NodeVecIterator lbeg, const NodeVecIterator lend, const uint32_t &split, int bits)
void update(Node *leaf, int lookahead_level=-1)
Updates a leaf node. A use case is when the bounding volume of an object changes. Ensure every parent...
void remove(Node *leaf)
Remove a leaf node.
Node * topdown_0(const NodeVecIterator lbeg, const NodeVecIterator lend)
construct a tree from a list of nodes stored in [lbeg, lend) in a topdown manner. During construction...
Node * getRoot() const
get the root of the tree
bool nodeBaseLess(NodeBase< BV > *a, NodeBase< BV > *b, int d)
Compare two nodes accoording to the d-th dimension of node center.
Node * insert(const BV &bv, void *data)
Insest a node.
void recurseRefit(Node *node)
void balanceBottomup()
balance the tree from bottom
bool empty() const
Whether the tree is empty.
size_t getMaxDepth() const
get the max depth of the tree
size_t select(const NodeBase< BV > &query, const NodeBase< BV > &node1, const NodeBase< BV > &node2)
select from node1 and node2 which is close to a given query. 0 for node1 and 1 for node2
void init(std::vector< Node * > &leaves, int level=0)
Initialize the tree by a set of leaves using algorithm with a given level.
Node * createNode(Node *parent, const BV &bv, void *data)
create one node (leaf or internal)
std::vector< NodeBase< BV > * >::const_iterator NodeVecConstIterator
static size_t indexOf(Node *node)
void init_2(std::vector< Node * > &leaves)
init tree from leaves using morton code. It uses morton_0, i.e., for nodes which is of depth more tha...
Node * sort(Node *n, Node *&r)
sort node n and its parent according to their memory position
void update_(Node *leaf, const BV &bv)
update one leaf node's bounding volume
void init_1(std::vector< Node * > &leaves)
init tree from leaves using morton code. It uses morton_0, i.e., for nodes which is of depth more tha...
hpp-fcl
Author(s):
autogenerated on Fri Aug 2 2024 02:45:14