Public Member Functions | Public Attributes | List of all members
hpp::fcl::BVHModel< BV > Class Template Reference

A class describing the bounding hierarchy of a mesh model or a point cloud model (which is viewed as a degraded version of mesh) More...

#include <hpp/fcl/BVH/BVH_model.h>

Inheritance diagram for hpp::fcl::BVHModel< BV >:
[legend]
Collaboration diagram for hpp::fcl::BVHModel< BV >:
[legend]

Public Member Functions

BVHModelType getModelType () const
 Model type described by the instance. More...
 
 BVHModel ()
 Constructing an empty BVH. More...
 
 BVHModel (const BVHModel &other)
 copy from another BVH More...
 
 ~BVHModel ()
 deconstruction, delete mesh data related. More...
 
const BVNode< BV > & getBV (int id) const
 We provide getBV() and getNumBVs() because BVH may be compressed (in future), so we must provide some flexibility here. More...
 
BVNode< BV > & getBV (int id)
 Access the bv giving the its index. More...
 
int getNumBVs () const
 Get the number of bv in the BVH. More...
 
OBJECT_TYPE getObjectType () const
 Get the object type: it is a BVH. More...
 
NODE_TYPE getNodeType () const
 Get the BV type: default is unknown. More...
 
void computeLocalAABB ()
 Compute the AABB for the BVH, used for broad-phase collision. More...
 
int beginModel (int num_tris=0, int num_vertices=0)
 Begin a new BVH model. More...
 
int addVertex (const Vec3f &p)
 Add one point in the new BVH model. More...
 
int addTriangle (const Vec3f &p1, const Vec3f &p2, const Vec3f &p3)
 Add one triangle in the new BVH model. More...
 
int addSubModel (const std::vector< Vec3f > &ps, const std::vector< Triangle > &ts)
 Add a set of triangles in the new BVH model. More...
 
int addSubModel (const std::vector< Vec3f > &ps)
 Add a set of points in the new BVH model. More...
 
int endModel ()
 End BVH model construction, will build the bounding volume hierarchy. More...
 
int beginReplaceModel ()
 Replace the geometry information of current frame (i.e. should have the same mesh topology with the previous frame) More...
 
int replaceVertex (const Vec3f &p)
 Replace one point in the old BVH model. More...
 
int replaceTriangle (const Vec3f &p1, const Vec3f &p2, const Vec3f &p3)
 Replace one triangle in the old BVH model. More...
 
int replaceSubModel (const std::vector< Vec3f > &ps)
 Replace a set of points in the old BVH model. More...
 
int endReplaceModel (bool refit=true, bool bottomup=true)
 End BVH model replacement, will also refit or rebuild the bounding volume hierarchy. More...
 
int beginUpdateModel ()
 Replace the geometry information of current frame (i.e. More...
 
int updateVertex (const Vec3f &p)
 Update one point in the old BVH model. More...
 
int updateTriangle (const Vec3f &p1, const Vec3f &p2, const Vec3f &p3)
 Update one triangle in the old BVH model. More...
 
int updateSubModel (const std::vector< Vec3f > &ps)
 Update a set of points in the old BVH model. More...
 
int endUpdateModel (bool refit=true, bool bottomup=true)
 End BVH model update, will also refit or rebuild the bounding volume hierarchy. More...
 
int memUsage (int msg) const
 Check the number of memory used. More...
 
void makeParentRelative ()
 This is a special acceleration: BVH_model default stores the BV's transform in world coordinate. More...
 
Vec3f computeCOM () const
 compute center of mass More...
 
FCL_REAL computeVolume () const
 compute the volume More...
 
Matrix3f computeMomentofInertia () const
 compute the inertia matrix, related to the origin More...
 
template<>
NODE_TYPE getNodeType () const
 Specialization of getNodeType() for BVHModel with different BV types. More...
 
template<>
NODE_TYPE getNodeType () const
 get the node type More...
 
template<>
NODE_TYPE getNodeType () const
 get the node type More...
 
template<>
NODE_TYPE getNodeType () const
 get the node type More...
 
template<>
NODE_TYPE getNodeType () const
 get the node type More...
 
template<>
NODE_TYPE getNodeType () const
 get the node type More...
 
template<>
NODE_TYPE getNodeType () const
 get the node type More...
 
template<>
NODE_TYPE getNodeType () const
 get the node type More...
 
- Public Member Functions inherited from hpp::fcl::CollisionGeometry
 CollisionGeometry ()
 
virtual ~CollisionGeometry ()
 
void * getUserData () const
 get user data in geometry More...
 
void setUserData (void *data)
 set user data in geometry More...
 
bool isOccupied () const HPP_FCL_DEPRECATED
 whether the object is completely occupied More...
 
bool isFree () const HPP_FCL_DEPRECATED
 whether the object is completely free More...
 
bool isUncertain () const HPP_FCL_DEPRECATED
 whether the object has some uncertainty More...
 
virtual Matrix3f computeMomentofInertiaRelatedToCOM () const
 compute the inertia matrix, related to the com More...
 

Public Attributes

Vec3fvertices
 Geometry point data. More...
 
Triangletri_indices
 Geometry triangle index data, will be NULL for point clouds. More...
 
Vec3fprev_vertices
 Geometry point data in previous frame. More...
 
int num_tris
 Number of triangles. More...
 
int num_vertices
 Number of points. More...
 
BVHBuildState build_state
 The state of BVH building process. More...
 
boost::shared_ptr< BVSplitterBase< BV > > bv_splitter
 Split rule to split one BV node into two children. More...
 
boost::shared_ptr< BVFitterBase< BV > > bv_fitter
 Fitting rule to fit a BV node to a set of geometry primitives. More...
 
- Public Attributes inherited from hpp::fcl::CollisionGeometry
Vec3f aabb_center
 AABB center in local coordinate. More...
 
FCL_REAL aabb_radius
 AABB radius. More...
 
AABB aabb_local
 AABB in local coordinate, used for tight AABB when only translation transform. More...
 
void * user_data
 pointer to user defined data specific to this object More...
 
FCL_REAL cost_density
 collision cost for unit volume More...
 
FCL_REAL threshold_occupied
 threshold for occupied ( >= is occupied) More...
 
FCL_REAL threshold_free
 threshold for free (<= is free) More...
 

Detailed Description

template<typename BV>
class hpp::fcl::BVHModel< BV >

A class describing the bounding hierarchy of a mesh model or a point cloud model (which is viewed as a degraded version of mesh)

Constructor & Destructor Documentation

template<typename BV>
hpp::fcl::BVHModel< BV >::BVHModel ( )
inline

Constructing an empty BVH.

Referenced by hpp::fcl::BVHModel< OBBRSS >::BVHModel().

template<typename BV>
hpp::fcl::BVHModel< BV >::BVHModel ( const BVHModel< BV > &  other)

copy from another BVH

template<typename BV>
hpp::fcl::BVHModel< BV >::~BVHModel ( )
inline

deconstruction, delete mesh data related.

Member Function Documentation

template<typename BV>
int hpp::fcl::BVHModel< BV >::addSubModel ( const std::vector< Vec3f > &  ps,
const std::vector< Triangle > &  ts 
)

Add a set of triangles in the new BVH model.

Referenced by hpp::fcl::generateBVHModel(), and hpp::fcl::BVHModel< OBBRSS >::getNodeType().

template<typename BV>
int hpp::fcl::BVHModel< BV >::addSubModel ( const std::vector< Vec3f > &  ps)

Add a set of points in the new BVH model.

template<typename BV>
int hpp::fcl::BVHModel< BV >::addTriangle ( const Vec3f p1,
const Vec3f p2,
const Vec3f p3 
)

Add one triangle in the new BVH model.

Referenced by hpp::fcl::BVHModel< OBBRSS >::getNodeType().

template<typename BV>
int hpp::fcl::BVHModel< BV >::addVertex ( const Vec3f p)

Add one point in the new BVH model.

Referenced by hpp::fcl::BVHModel< OBBRSS >::getNodeType().

template<typename BV>
int hpp::fcl::BVHModel< BV >::beginModel ( int  num_tris = 0,
int  num_vertices = 0 
)
template<typename BV>
int hpp::fcl::BVHModel< BV >::beginReplaceModel ( )

Replace the geometry information of current frame (i.e. should have the same mesh topology with the previous frame)

Referenced by hpp::fcl::BVHModel< OBBRSS >::getNodeType(), and hpp::fcl::initialize().

template<typename BV>
int hpp::fcl::BVHModel< BV >::beginUpdateModel ( )

Replace the geometry information of current frame (i.e.

should have the same mesh topology with the previous frame). The current frame will be saved as the previous frame in prev_vertices.

Referenced by hpp::fcl::BVHModel< OBBRSS >::getNodeType().

template<typename BV>
Vec3f hpp::fcl::BVHModel< BV >::computeCOM ( ) const
inlinevirtual

compute center of mass

Reimplemented from hpp::fcl::CollisionGeometry.

template<typename BV>
void hpp::fcl::BVHModel< BV >::computeLocalAABB ( )
virtual

Compute the AABB for the BVH, used for broad-phase collision.

Implements hpp::fcl::CollisionGeometry.

Referenced by hpp::fcl::generateBVHModel(), and hpp::fcl::BVHModel< OBBRSS >::getNodeType().

template<typename BV>
Matrix3f hpp::fcl::BVHModel< BV >::computeMomentofInertia ( ) const
inlinevirtual

compute the inertia matrix, related to the origin

Reimplemented from hpp::fcl::CollisionGeometry.

template<typename BV>
FCL_REAL hpp::fcl::BVHModel< BV >::computeVolume ( ) const
inlinevirtual

compute the volume

Reimplemented from hpp::fcl::CollisionGeometry.

template<typename BV>
int hpp::fcl::BVHModel< BV >::endModel ( )

End BVH model construction, will build the bounding volume hierarchy.

Referenced by hpp::fcl::generateBVHModel(), and hpp::fcl::BVHModel< OBBRSS >::getNodeType().

template<typename BV>
int hpp::fcl::BVHModel< BV >::endReplaceModel ( bool  refit = true,
bool  bottomup = true 
)

End BVH model replacement, will also refit or rebuild the bounding volume hierarchy.

Referenced by hpp::fcl::BVHModel< OBBRSS >::getNodeType(), and hpp::fcl::initialize().

template<typename BV>
int hpp::fcl::BVHModel< BV >::endUpdateModel ( bool  refit = true,
bool  bottomup = true 
)

End BVH model update, will also refit or rebuild the bounding volume hierarchy.

Referenced by hpp::fcl::BVHModel< OBBRSS >::getNodeType().

template<typename BV>
const BVNode<BV>& hpp::fcl::BVHModel< BV >::getBV ( int  id) const
inline

We provide getBV() and getNumBVs() because BVH may be compressed (in future), so we must provide some flexibility here.

Access the bv giving the its index

Referenced by hpp::fcl::BVHExpand(), and hpp::fcl::OcTreeSolver< NarrowPhaseSolver >::ShapeOcTreeDistance().

template<typename BV>
BVNode<BV>& hpp::fcl::BVHModel< BV >::getBV ( int  id)
inline

Access the bv giving the its index.

template<typename BV>
BVHModelType hpp::fcl::BVHModel< BV >::getModelType ( ) const
inline

Model type described by the instance.

Referenced by hpp::fcl::initialize(), and hpp::fcl::details::setupShapeMeshDistanceOrientedNode().

template<typename BV>
NODE_TYPE hpp::fcl::BVHModel< BV >::getNodeType ( ) const
inlinevirtual

Get the BV type: default is unknown.

Reimplemented from hpp::fcl::CollisionGeometry.

template<>
NODE_TYPE hpp::fcl::BVHModel< AABB >::getNodeType ( ) const
virtual

Specialization of getNodeType() for BVHModel with different BV types.

Reimplemented from hpp::fcl::CollisionGeometry.

template<>
NODE_TYPE hpp::fcl::BVHModel< OBB >::getNodeType ( ) const
virtual

get the node type

Reimplemented from hpp::fcl::CollisionGeometry.

template<>
NODE_TYPE hpp::fcl::BVHModel< RSS >::getNodeType ( ) const
virtual

get the node type

Reimplemented from hpp::fcl::CollisionGeometry.

template<>
NODE_TYPE hpp::fcl::BVHModel< kIOS >::getNodeType ( ) const
virtual

get the node type

Reimplemented from hpp::fcl::CollisionGeometry.

template<>
NODE_TYPE hpp::fcl::BVHModel< OBBRSS >::getNodeType ( ) const
virtual

get the node type

Reimplemented from hpp::fcl::CollisionGeometry.

template<>
NODE_TYPE hpp::fcl::BVHModel< KDOP< 16 > >::getNodeType ( ) const
virtual

get the node type

Reimplemented from hpp::fcl::CollisionGeometry.

template<>
NODE_TYPE hpp::fcl::BVHModel< KDOP< 18 > >::getNodeType ( ) const
virtual

get the node type

Reimplemented from hpp::fcl::CollisionGeometry.

template<>
NODE_TYPE hpp::fcl::BVHModel< KDOP< 24 > >::getNodeType ( ) const
virtual

get the node type

Reimplemented from hpp::fcl::CollisionGeometry.

template<typename BV>
int hpp::fcl::BVHModel< BV >::getNumBVs ( ) const
inline

Get the number of bv in the BVH.

template<typename BV>
OBJECT_TYPE hpp::fcl::BVHModel< BV >::getObjectType ( ) const
inlinevirtual

Get the object type: it is a BVH.

Reimplemented from hpp::fcl::CollisionGeometry.

template<typename BV>
void hpp::fcl::BVHModel< BV >::makeParentRelative ( )
inline

This is a special acceleration: BVH_model default stores the BV's transform in world coordinate.

However, we can also store each BV's transform related to its parent BV node. When traversing the BVH, this can save one matrix transformation.

template<typename BV>
int hpp::fcl::BVHModel< BV >::memUsage ( int  msg) const

Check the number of memory used.

Referenced by hpp::fcl::BVHModel< OBBRSS >::getNodeType().

template<typename BV>
int hpp::fcl::BVHModel< BV >::replaceSubModel ( const std::vector< Vec3f > &  ps)

Replace a set of points in the old BVH model.

Referenced by hpp::fcl::BVHModel< OBBRSS >::getNodeType(), and hpp::fcl::initialize().

template<typename BV>
int hpp::fcl::BVHModel< BV >::replaceTriangle ( const Vec3f p1,
const Vec3f p2,
const Vec3f p3 
)

Replace one triangle in the old BVH model.

Referenced by hpp::fcl::BVHModel< OBBRSS >::getNodeType().

template<typename BV>
int hpp::fcl::BVHModel< BV >::replaceVertex ( const Vec3f p)

Replace one point in the old BVH model.

Referenced by hpp::fcl::BVHModel< OBBRSS >::getNodeType().

template<typename BV>
int hpp::fcl::BVHModel< BV >::updateSubModel ( const std::vector< Vec3f > &  ps)

Update a set of points in the old BVH model.

Referenced by hpp::fcl::BVHModel< OBBRSS >::getNodeType().

template<typename BV>
int hpp::fcl::BVHModel< BV >::updateTriangle ( const Vec3f p1,
const Vec3f p2,
const Vec3f p3 
)

Update one triangle in the old BVH model.

Referenced by hpp::fcl::BVHModel< OBBRSS >::getNodeType().

template<typename BV>
int hpp::fcl::BVHModel< BV >::updateVertex ( const Vec3f p)

Update one point in the old BVH model.

Referenced by hpp::fcl::BVHModel< OBBRSS >::getNodeType().

Member Data Documentation

template<typename BV>
BVHBuildState hpp::fcl::BVHModel< BV >::build_state

The state of BVH building process.

template<typename BV>
boost::shared_ptr<BVFitterBase<BV> > hpp::fcl::BVHModel< BV >::bv_fitter

Fitting rule to fit a BV node to a set of geometry primitives.

template<typename BV>
boost::shared_ptr<BVSplitterBase<BV> > hpp::fcl::BVHModel< BV >::bv_splitter

Split rule to split one BV node into two children.

template<typename BV>
int hpp::fcl::BVHModel< BV >::num_tris
template<typename BV>
int hpp::fcl::BVHModel< BV >::num_vertices
template<typename BV>
Vec3f* hpp::fcl::BVHModel< BV >::prev_vertices

Geometry point data in previous frame.

Referenced by hpp::fcl::BVHModel< OBBRSS >::~BVHModel().

template<typename BV>
Triangle* hpp::fcl::BVHModel< BV >::tri_indices
template<typename BV>
Vec3f* hpp::fcl::BVHModel< BV >::vertices