hpp-fcl
2.4.1
HPP fork of FCL -- The Flexible Collision Library
|
Class for hierarchy tree structure. More...
#include <hpp/fcl/broadphase/detail/hierarchy_tree.h>
Public Types | |
typedef NodeBase< BV > | Node |
Public Member Functions | |
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 bottom-up construction / optimization; topdown_level decides different methods to construct tree in topdown manner. lower level method constructs tree with better quality but is slower. More... | |
~HierarchyTree () | |
void | init (std::vector< Node * > &leaves, int level=0) |
Initialize the tree by a set of leaves using algorithm with a given level. More... | |
Node * | insert (const BV &bv, void *data) |
Insest a node. More... | |
void | remove (Node *leaf) |
Remove a leaf node. More... | |
void | clear () |
Clear the tree. More... | |
bool | empty () const |
Whether the tree is empty. More... | |
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 has its bounding volume expand or shrink to fit the bounding volumes of its children. More... | |
bool | update (Node *leaf, const BV &bv) |
update the tree when the bounding volume of a given leaf has changed More... | |
bool | update (Node *leaf, const BV &bv, const Vec3f &vel, FCL_REAL margin) |
update one leaf's bounding volume, with prediction More... | |
bool | update (Node *leaf, const BV &bv, const Vec3f &vel) |
update one leaf's bounding volume, with prediction More... | |
size_t | getMaxHeight () const |
get the max height of the tree More... | |
size_t | getMaxDepth () const |
get the max depth of the tree More... | |
void | balanceBottomup () |
balance the tree from bottom More... | |
void | balanceTopdown () |
balance the tree from top More... | |
void | balanceIncremental (int iterations) |
balance the tree in an incremental way More... | |
void | refit () |
refit the tree, i.e., when the leaf nodes' bounding volumes change, update the entire tree in a bottom-up manner More... | |
void | extractLeaves (const Node *root, std::vector< Node * > &leaves) const |
extract all the leaves of the tree More... | |
size_t | size () const |
number of leaves in the tree More... | |
Node * | getRoot () const |
get the root of the tree More... | |
Node *& | getRoot () |
void | print (Node *root, int depth) |
print the tree in a recursive way More... | |
Public Attributes | |
int | topdown_level |
decide which topdown algorithm to use More... | |
int | bu_threshold |
decide the depth to use expensive bottom-up algorithm More... | |
Protected Attributes | |
Node * | root_node |
size_t | n_leaves |
unsigned int | opath |
Node * | free_node |
int | max_lookahead_level |
Class for hierarchy tree structure.
typedef NodeBase<BV> hpp::fcl::detail::HierarchyTree< BV >::Node |
hpp::fcl::detail::HierarchyTree< BV >::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 bottom-up construction / optimization; topdown_level decides different methods to construct tree in topdown manner. lower level method constructs tree with better quality but is slower.
hpp::fcl::detail::HierarchyTree< BV >::~HierarchyTree |
void hpp::fcl::detail::HierarchyTree< BV >::balanceBottomup |
balance the tree from bottom
void hpp::fcl::detail::HierarchyTree< BV >::balanceIncremental | ( | int | iterations | ) |
balance the tree in an incremental way
void hpp::fcl::detail::HierarchyTree< BV >::balanceTopdown |
balance the tree from top
void hpp::fcl::detail::HierarchyTree< BV >::clear |
Clear the tree.
bool hpp::fcl::detail::HierarchyTree< BV >::empty |
Whether the tree is empty.
void hpp::fcl::detail::HierarchyTree< BV >::extractLeaves | ( | const Node * | root, |
std::vector< Node * > & | leaves | ||
) | const |
extract all the leaves of the tree
size_t hpp::fcl::detail::HierarchyTree< BV >::getMaxDepth |
get the max depth of the tree
size_t hpp::fcl::detail::HierarchyTree< BV >::getMaxHeight |
get the max height of the tree
Node*& hpp::fcl::detail::HierarchyTree< BV >::getRoot | ( | ) |
HierarchyTree< BV >::Node *& hpp::fcl::detail::HierarchyTree< BV >::getRoot |
get the root of the tree
void hpp::fcl::detail::HierarchyTree< BV >::init | ( | std::vector< Node * > & | leaves, |
int | level = 0 |
||
) |
Initialize the tree by a set of leaves using algorithm with a given level.
HierarchyTree< BV >::Node * hpp::fcl::detail::HierarchyTree< BV >::insert | ( | const BV & | bv, |
void * | data | ||
) |
Insest a node.
void hpp::fcl::detail::HierarchyTree< BV >::print | ( | Node * | root, |
int | depth | ||
) |
print the tree in a recursive way
void hpp::fcl::detail::HierarchyTree< BV >::refit |
refit the tree, i.e., when the leaf nodes' bounding volumes change, update the entire tree in a bottom-up manner
void hpp::fcl::detail::HierarchyTree< BV >::remove | ( | Node * | leaf | ) |
Remove a leaf node.
size_t hpp::fcl::detail::HierarchyTree< BV >::size |
number of leaves in the tree
bool hpp::fcl::detail::HierarchyTree< BV >::update | ( | Node * | leaf, |
const BV & | bv | ||
) |
update the tree when the bounding volume of a given leaf has changed
bool hpp::fcl::detail::HierarchyTree< BV >::update | ( | Node * | leaf, |
const BV & | bv, | ||
const Vec3f & | vel | ||
) |
update one leaf's bounding volume, with prediction
bool hpp::fcl::detail::HierarchyTree< BV >::update | ( | Node * | leaf, |
const BV & | bv, | ||
const Vec3f & | vel, | ||
FCL_REAL | margin | ||
) |
update one leaf's bounding volume, with prediction
void hpp::fcl::detail::HierarchyTree< BV >::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 has its bounding volume expand or shrink to fit the bounding volumes of its children.
leaf
node does not change. It is just another valid tree of the same set of objects. This is because update() works by first removing leaf
and then inserting leaf
back. The structural change could be as simple as switching the order of two leaves if the sibling of the leaf
is also a leaf. Or it could be more complicated if the sibling is an internal node. int hpp::fcl::detail::HierarchyTree< BV >::bu_threshold |
decide the depth to use expensive bottom-up algorithm
|
protected |
This is a one Node cache, the reason is that we need to remove a node and then add it again frequently.
|
protected |
|
protected |
|
protected |
|
protected |
int hpp::fcl::detail::HierarchyTree< BV >::topdown_level |
decide which topdown algorithm to use