All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fcl::HierarchyTree< BV > Class Template Reference

Class for hierarchy tree structure. More...

#include <hpp/fcl/broadphase/hierarchy_tree.h>

Collaboration diagram for fcl::HierarchyTree< BV >:

Public Member Functions

 HierarchyTree (int bu_threshold_=16, int topdown_level_=0)
 Create hierarchy tree with suitable setting. More...
 
 ~HierarchyTree ()
 
void init (std::vector< NodeType * > &leaves, int level=0)
 Initialize the tree by a set of leaves using algorithm with a given level. More...
 
NodeTypeinsert (const BV &bv, void *data)
 Insest a node. More...
 
void remove (NodeType *leaf)
 Remove a leaf node. More...
 
void clear ()
 Clear the tree. More...
 
bool empty () const
 Whether the tree is empty. More...
 
void update (NodeType *leaf, int lookahead_level=-1)
 update one leaf node More...
 
bool update (NodeType *leaf, const BV &bv)
 update the tree when the bounding volume of a given leaf has changed More...
 
bool update (NodeType *leaf, const BV &bv, const Vec3f &vel, FCL_REAL margin)
 update one leaf's bounding volume, with prediction More...
 
bool update (NodeType *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 NodeType *root, std::vector< NodeType * > &leaves) const
 extract all the leaves of the tree More...
 
size_t size () const
 number of leaves in the tree More...
 
NodeTypegetRoot () const
 get the root of the tree More...
 
NodeType *& getRoot ()
 
void print (NodeType *root, int depth)
 print the tree in a recursive way More...
 
template<>
bool update (NodeBase< AABB > *leaf, const AABB &bv_, const Vec3f &vel, FCL_REAL margin)
 
template<>
bool update (NodeBase< AABB > *leaf, const AABB &bv_, const Vec3f &vel)
 

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

NodeTyperoot_node
 
size_t n_leaves
 
unsigned int opath
 
NodeTypefree_node
 This is a one NodeType cache, the reason is that we need to remove a node and then add it again frequently. More...
 
int max_lookahead_level
 

Detailed Description

template<typename BV>
class fcl::HierarchyTree< BV >

Class for hierarchy tree structure.

Constructor & Destructor Documentation

template<typename BV >
fcl::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.

template<typename BV >
fcl::HierarchyTree< BV >::~HierarchyTree ( )

Member Function Documentation

template<typename BV >
void fcl::HierarchyTree< BV >::balanceBottomup ( )

balance the tree from bottom

template<typename BV >
void fcl::HierarchyTree< BV >::balanceIncremental ( int  iterations)

balance the tree in an incremental way

References fcl::NodeBase< BV >::children, and fcl::NodeBase< BV >::isLeaf().

template<typename BV >
void fcl::HierarchyTree< BV >::balanceTopdown ( )

balance the tree from top

template<typename BV >
void fcl::HierarchyTree< BV >::clear ( )

Clear the tree.

template<typename BV >
bool fcl::HierarchyTree< BV >::empty ( ) const

Whether the tree is empty.

template<typename BV >
void fcl::HierarchyTree< BV >::extractLeaves ( const NodeType root,
std::vector< NodeType * > &  leaves 
) const

extract all the leaves of the tree

References fcl::NodeBase< BV >::children, and fcl::NodeBase< BV >::isLeaf().

template<typename BV >
size_t fcl::HierarchyTree< BV >::getMaxDepth ( ) const

get the max depth of the tree

template<typename BV >
size_t fcl::HierarchyTree< BV >::getMaxHeight ( ) const

get the max height of the tree

template<typename BV >
HierarchyTree< BV >::NodeType * fcl::HierarchyTree< BV >::getRoot ( ) const

get the root of the tree

template<typename BV >
HierarchyTree< BV >::NodeType *& fcl::HierarchyTree< BV >::getRoot ( )
template<typename BV >
void fcl::HierarchyTree< BV >::init ( std::vector< NodeType * > &  leaves,
int  level = 0 
)

Initialize the tree by a set of leaves using algorithm with a given level.

template<typename BV>
HierarchyTree< BV >::NodeType * fcl::HierarchyTree< BV >::insert ( const BV &  bv,
void *  data 
)

Insest a node.

template<typename BV >
void fcl::HierarchyTree< BV >::print ( NodeType root,
int  depth 
)

print the tree in a recursive way

References fcl::NodeBase< BV >::bv, fcl::NodeBase< BV >::children, and fcl::NodeBase< BV >::isLeaf().

template<typename BV >
void fcl::HierarchyTree< BV >::refit ( )

refit the tree, i.e., when the leaf nodes' bounding volumes change, update the entire tree in a bottom-up manner

template<typename BV >
void fcl::HierarchyTree< BV >::remove ( NodeType leaf)

Remove a leaf node.

template<typename BV >
size_t fcl::HierarchyTree< BV >::size ( ) const

number of leaves in the tree

template<typename BV >
void fcl::HierarchyTree< BV >::update ( NodeType leaf,
int  lookahead_level = -1 
)

update one leaf node

References fcl::NodeBase< BV >::parent.

template<typename BV>
bool fcl::HierarchyTree< BV >::update ( NodeType leaf,
const BV &  bv 
)

update the tree when the bounding volume of a given leaf has changed

References fcl::NodeBase< BV >::bv.

template<typename BV>
bool fcl::HierarchyTree< BV >::update ( NodeType leaf,
const BV &  bv,
const Vec3f vel,
FCL_REAL  margin 
)

update one leaf's bounding volume, with prediction

References fcl::NodeBase< BV >::bv.

template<typename BV>
bool fcl::HierarchyTree< BV >::update ( NodeType leaf,
const BV &  bv,
const Vec3f vel 
)

update one leaf's bounding volume, with prediction

References fcl::NodeBase< BV >::bv.

template<>
bool fcl::HierarchyTree< AABB >::update ( NodeBase< AABB > *  leaf,
const AABB bv_,
const Vec3f vel,
FCL_REAL  margin 
)
template<>
bool fcl::HierarchyTree< AABB >::update ( NodeBase< AABB > *  leaf,
const AABB bv_,
const Vec3f vel 
)

Member Data Documentation

template<typename BV>
int fcl::HierarchyTree< BV >::bu_threshold

decide the depth to use expensive bottom-up algorithm

template<typename BV>
NodeType* fcl::HierarchyTree< BV >::free_node
protected

This is a one NodeType cache, the reason is that we need to remove a node and then add it again frequently.

template<typename BV>
int fcl::HierarchyTree< BV >::max_lookahead_level
protected
template<typename BV>
size_t fcl::HierarchyTree< BV >::n_leaves
protected
template<typename BV>
unsigned int fcl::HierarchyTree< BV >::opath
protected
template<typename BV>
NodeType* fcl::HierarchyTree< BV >::root_node
protected
template<typename BV>
int fcl::HierarchyTree< BV >::topdown_level

decide which topdown algorithm to use