Go to the documentation of this file.
38 #ifndef COAL_HIERARCHY_TREE_H
39 #define COAL_HIERARCHY_TREE_H
45 #include "coal/warning.hh"
55 template <
typename BV>
65 HierarchyTree(
int bu_threshold_ = 16,
int topdown_level_ = 0);
71 void init(std::vector<Node*>& leaves,
int level = 0);
96 void update(
Node* leaf,
int lookahead_level = -1);
148 return a->code <
b->code;
181 void init_0(std::vector<Node*>& leaves);
187 void init_1(std::vector<Node*>& leaves);
193 void init_2(std::vector<Node*>& leaves);
198 void init_3(std::vector<Node*>& leaves);
201 const uint32_t& split,
int bits);
204 const uint32_t& split,
int bits);
233 void fetchLeaves(
Node* root, std::vector<Node*>& leaves,
int depth = -1);
272 template <
typename BV>
277 template <
typename BV>
283 template <
typename BV>
void deleteNode(Node *node)
Eigen::Matrix< CoalScalar, 3, 1 > Vec3s
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...
std::vector< NodeBase< BV > * >::iterator NodeVecIterator
std::vector< NodeBase< BV > * >::const_iterator NodeVecConstIterator
Node * insert(const BV &bv, void *data)
Insest a node.
void print(Node *root, int depth)
print the tree in a recursive way
size_t getMaxDepth() const
get the max depth of the tree
void recurseDeleteNode(Node *node)
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...
Node * mortonRecurse_0(const NodeVecIterator lbeg, const NodeVecIterator lend, const uint32_t &split, int bits)
void balanceIncremental(int iterations)
balance the tree in an incremental way
void recurseRefit(Node *node)
size_t getMaxHeight() const
get the max height of the tree
void refit()
refit the tree, i.e., when the leaf nodes' bounding volumes change, update the entire tree in a botto...
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 * createNode(Node *parent, const BV &bv, void *data)
create one node (leaf or internal)
Node * mortonRecurse_1(const NodeVecIterator lbeg, const NodeVecIterator lend, const uint32_t &split, int bits)
static size_t indexOf(Node *node)
void balanceTopdown()
balance the tree from top
void clear()
Clear the tree.
Node * sort(Node *n, Node *&r)
sort node n and its parent according to their memory position
void bottomup(const NodeVecIterator lbeg, const NodeVecIterator lend)
construct a tree for a set of leaves from bottom – very heavy way
int bu_threshold
decide the depth to use expensive bottom-up algorithm
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
Node * getRoot() const
get the root of the tree
Node * removeLeaf(Node *const leaf)
Remove a leaf. Maintain the tree as a full binary tree (every interior node has exactly two children)...
Class for hierarchy tree structure.
Node * mortonRecurse_2(const NodeVecIterator lbeg, const NodeVecIterator lend)
bool empty() const
Whether the tree is empty.
int topdown_level
decide which topdown algorithm to use
Node * topdown(const NodeVecIterator lbeg, const NodeVecIterator lend)
construct a tree for a set of leaves from top
bool operator()(const Node *a, const Node *b) const
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 update_(Node *leaf, const BV &bv)
update one leaf node's bounding volume
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 extractLeaves(const Node *root, std::vector< Node * > &leaves) const
extract all the leaves of the tree
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...
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...
size_t size() const
number of leaves in the tree
void init(std::vector< Node * > &leaves, int level=0)
Initialize the tree by a set of leaves using algorithm with a given level.
void init_0(std::vector< Node * > &leaves)
init tree from leaves in the topdown manner (topdown_0 or topdown_1)
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...
bool nodeBaseLess(NodeBase< BV > *a, NodeBase< BV > *b, int d)
Compare two nodes accoording to the d-th dimension of node center.
void balanceBottomup()
balance the tree from bottom
void remove(Node *leaf)
Remove a leaf node.
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 ...
hpp-fcl
Author(s):
autogenerated on Sat Nov 23 2024 03:44:58