All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
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 <BVH_model.h>

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

List of all members.

Public Member Functions

int addSubModel (const std::vector< Vec3f > &ps, const std::vector< Triangle > &ts)
 Add a set of triangles in the new BVH model.
int addSubModel (const std::vector< Vec3f > &ps)
 Add a set of points in the new BVH model.
int addTriangle (const Vec3f &p1, const Vec3f &p2, const Vec3f &p3)
 Add one triangle in the new BVH model.
int addVertex (const Vec3f &p)
 Add one point in the new BVH model.
int beginModel (int num_tris=0, int num_vertices=0)
 Begin a new BVH model.
int beginReplaceModel ()
 Replace the geometry information of current frame (i.e. should have the same mesh topology with the previous frame)
int 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.
 BVHModel ()
 Constructing an empty BVH.
 BVHModel (const BVHModel &other)
 copy from another BVH
void computeLocalAABB ()
 Compute the AABB for the BVH, used for broad-phase collision.
int endModel ()
 End BVH model construction, will build the bounding volume hierarchy.
int endReplaceModel (bool refit=true, bool bottomup=true)
 End BVH model replacement, will also refit or rebuild the bounding volume hierarchy.
int endUpdateModel (bool refit=true, bool bottomup=true)
 End BVH model update, will also refit or rebuild the bounding volume hierarchy.
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.
BVNode< BV > & getBV (int id)
 Access the bv giving the its index.
BVHModelType getModelType () const
 Model type described by the instance.
NODE_TYPE getNodeType () const
 Get the BV type: default is unknown.
template<>
NODE_TYPE getNodeType () const
 get the node type
template<>
NODE_TYPE getNodeType () const
 get the node type
template<>
NODE_TYPE getNodeType () const
 get the node type
template<>
NODE_TYPE getNodeType () const
 get the node type
template<>
NODE_TYPE getNodeType () const
 get the node type
template<>
NODE_TYPE getNodeType () const
 get the node type
template<>
NODE_TYPE getNodeType () const
 get the node type
template<>
NODE_TYPE getNodeType () const
 get the node type
template<>
NODE_TYPE getNodeType () const
 get the node type
template<>
NODE_TYPE getNodeType () const
 get the node type
template<>
NODE_TYPE getNodeType () const
 get the node type
template<>
NODE_TYPE getNodeType () const
 get the node type
template<>
NODE_TYPE getNodeType () const
 get the node type
template<>
NODE_TYPE getNodeType () const
 get the node type
template<>
NODE_TYPE getNodeType () const
 get the node type
template<>
NODE_TYPE getNodeType () const
 get the node type
int getNumBVs () const
 Get the number of bv in the BVH.
OBJECT_TYPE getObjectType () const
 Get the object type: it is a BVH.
void makeParentRelative ()
 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.
int memUsage (int msg) const
 Check the number of memory used.
int replaceSubModel (const std::vector< Vec3f > &ps)
 Replace a set of points in the old BVH model.
int replaceTriangle (const Vec3f &p1, const Vec3f &p2, const Vec3f &p3)
 Replace one triangle in the old BVH model.
int replaceVertex (const Vec3f &p)
 Replace one point in the old BVH model.
int updateSubModel (const std::vector< Vec3f > &ps)
 Update a set of points in the old BVH model.
int updateTriangle (const Vec3f &p1, const Vec3f &p2, const Vec3f &p3)
 Update one triangle in the old BVH model.
int updateVertex (const Vec3f &p)
 Update one point in the old BVH model.
 ~BVHModel ()
 deconstruction, delete mesh data related.

Public Attributes

BVHBuildState build_state
 The state of BVH building process.
boost::shared_ptr
< BVFitterBase< BV > > 
bv_fitter
 Fitting rule to fit a BV node to a set of geometry primitives.
boost::shared_ptr
< BVSplitterBase< BV > > 
bv_splitter
 Split rule to split one BV node into two children.
int num_tris
 Number of triangles.
int num_vertices
 Number of points.
Vec3fprev_vertices
 Geometry point data in previous frame.
Triangletri_indices
 Geometry triangle index data, will be NULL for point clouds.
Vec3fvertices
 Geometry point data.

Private Member Functions

int buildTree ()
 Build the bounding volume hierarchy.
void makeParentRelativeRecurse (int bv_id, Vec3f parent_axis[], const Vec3f &parent_c)
template<>
void makeParentRelativeRecurse (int bv_id, Vec3f parent_axis[], const Vec3f &parent_c)
template<>
void makeParentRelativeRecurse (int bv_id, Vec3f parent_axis[], const Vec3f &parent_c)
template<>
void makeParentRelativeRecurse (int bv_id, Vec3f parent_axis[], const Vec3f &parent_c)
template<>
void makeParentRelativeRecurse (int bv_id, Vec3f parent_axis[], const Vec3f &parent_c)
template<>
void makeParentRelativeRecurse (int bv_id, Vec3f parent_axis[], const Vec3f &parent_c)
template<>
void makeParentRelativeRecurse (int bv_id, Vec3f parent_axis[], const Vec3f &parent_c)
int recursiveBuildTree (int bv_id, int first_primitive, int num_primitives)
 Recursive kernel for hierarchy construction.
int recursiveRefitTree_bottomup (int bv_id)
 Recursive kernel for bottomup refitting.
int refitTree (bool bottomup)
 Refit the bounding volume hierarchy.
int refitTree_bottomup ()
 Refit the bounding volume hierarchy in a bottom-up way (fast but less compact)
int refitTree_topdown ()
 Refit the bounding volume hierarchy in a top-down way (slow but more compact)

Private Attributes

BVNode< BV > * bvs
 Bounding volume hierarchy.
int num_bvs
 Number of BV nodes in bounding volume hierarchy.
int num_bvs_allocated
int num_tris_allocated
int num_vertex_updated
int num_vertices_allocated
unsigned int * primitive_indices
 for ccd vertex update

Detailed Description

template<typename BV>
class 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)

Definition at line 53 of file BVH_model.h.


Constructor & Destructor Documentation

template<typename BV>
fcl::BVHModel< BV >::BVHModel ( ) [inline]

Constructing an empty BVH.

Definition at line 69 of file BVH_model.h.

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

copy from another BVH

Definition at line 46 of file BVH_model.cpp.

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

deconstruction, delete mesh data related.

Definition at line 91 of file BVH_model.h.


Member Function Documentation

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

Add a set of triangles in the new BVH model.

Definition at line 278 of file BVH_model.cpp.

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

Add a set of points in the new BVH model.

Definition at line 243 of file BVH_model.cpp.

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

Add one triangle in the new BVH model.

Definition at line 189 of file BVH_model.cpp.

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

Add one point in the new BVH model.

Definition at line 159 of file BVH_model.cpp.

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

Begin a new BVH model.

Definition at line 112 of file BVH_model.cpp.

template<typename BV >
int fcl::BVHModel< BV >::beginReplaceModel ( )

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

Definition at line 412 of file BVH_model.cpp.

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

Definition at line 510 of file BVH_model.cpp.

template<typename BV >
int fcl::BVHModel< BV >::buildTree ( ) [private]

Build the bounding volume hierarchy.

Definition at line 642 of file BVH_model.cpp.

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

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

Implements fcl::CollisionGeometry.

Definition at line 856 of file BVH_model.cpp.

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

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

Definition at line 340 of file BVH_model.cpp.

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

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

Definition at line 477 of file BVH_model.cpp.

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

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

Definition at line 585 of file BVH_model.cpp.

template<typename BV>
const BVNode<BV>& 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

Definition at line 104 of file BVH_model.h.

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

Access the bv giving the its index.

Definition at line 110 of file BVH_model.h.

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

Model type described by the instance.

Definition at line 58 of file BVH_model.h.

template<typename BV>
NODE_TYPE fcl::BVHModel< BV >::getNodeType ( ) const [inline, virtual]

Get the BV type: default is unknown.

Reimplemented from fcl::CollisionGeometry.

Definition at line 125 of file BVH_model.h.

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

get the node type

Reimplemented from fcl::CollisionGeometry.

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

get the node type

Reimplemented from fcl::CollisionGeometry.

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

get the node type

Reimplemented from fcl::CollisionGeometry.

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

get the node type

Reimplemented from fcl::CollisionGeometry.

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

get the node type

Reimplemented from fcl::CollisionGeometry.

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

get the node type

Reimplemented from fcl::CollisionGeometry.

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

get the node type

Reimplemented from fcl::CollisionGeometry.

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

get the node type

Reimplemented from fcl::CollisionGeometry.

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

get the node type

Reimplemented from fcl::CollisionGeometry.

Definition at line 948 of file BVH_model.cpp.

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

get the node type

Reimplemented from fcl::CollisionGeometry.

Definition at line 954 of file BVH_model.cpp.

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

get the node type

Reimplemented from fcl::CollisionGeometry.

Definition at line 960 of file BVH_model.cpp.

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

get the node type

Reimplemented from fcl::CollisionGeometry.

Definition at line 966 of file BVH_model.cpp.

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

get the node type

Reimplemented from fcl::CollisionGeometry.

Definition at line 972 of file BVH_model.cpp.

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

get the node type

Reimplemented from fcl::CollisionGeometry.

Definition at line 978 of file BVH_model.cpp.

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

get the node type

Reimplemented from fcl::CollisionGeometry.

Definition at line 984 of file BVH_model.cpp.

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

get the node type

Reimplemented from fcl::CollisionGeometry.

Definition at line 990 of file BVH_model.cpp.

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

Get the number of bv in the BVH.

Definition at line 116 of file BVH_model.h.

template<typename BV>
OBJECT_TYPE fcl::BVHModel< BV >::getObjectType ( ) const [inline, virtual]

Get the object type: it is a BVH.

Reimplemented from fcl::CollisionGeometry.

Definition at line 122 of file BVH_model.h.

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

Definition at line 186 of file BVH_model.h.

template<typename BV>
void fcl::BVHModel< BV >::makeParentRelativeRecurse ( int  bv_id,
Vec3f  parent_axis[],
const Vec3f parent_c 
) [inline, private]

compute each bv's transform related to its parent. For default BV, only the translation works. For oriented BV (OBB, RSS, OBBRSS), special implementation is provided.

Definition at line 252 of file BVH_model.h.

template<>
void fcl::BVHModel< OBB >::makeParentRelativeRecurse ( int  bv_id,
Vec3f  parent_axis[],
const Vec3f parent_c 
) [private]
template<>
void fcl::BVHModel< RSS >::makeParentRelativeRecurse ( int  bv_id,
Vec3f  parent_axis[],
const Vec3f parent_c 
) [private]
template<>
void fcl::BVHModel< OBBRSS >::makeParentRelativeRecurse ( int  bv_id,
Vec3f  parent_axis[],
const Vec3f parent_c 
) [private]
template<>
void fcl::BVHModel< OBB >::makeParentRelativeRecurse ( int  bv_id,
Vec3f  parent_axis[],
const Vec3f parent_c 
) [private]

Definition at line 880 of file BVH_model.cpp.

template<>
void fcl::BVHModel< RSS >::makeParentRelativeRecurse ( int  bv_id,
Vec3f  parent_axis[],
const Vec3f parent_c 
) [private]

Definition at line 900 of file BVH_model.cpp.

template<>
void fcl::BVHModel< OBBRSS >::makeParentRelativeRecurse ( int  bv_id,
Vec3f  parent_axis[],
const Vec3f parent_c 
) [private]

Definition at line 920 of file BVH_model.cpp.

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

Check the number of memory used.

Definition at line 622 of file BVH_model.cpp.

template<typename BV >
int fcl::BVHModel< BV >::recursiveBuildTree ( int  bv_id,
int  first_primitive,
int  num_primitives 
) [private]

Recursive kernel for hierarchy construction.

Definition at line 676 of file BVH_model.cpp.

template<typename BV >
int fcl::BVHModel< BV >::recursiveRefitTree_bottomup ( int  bv_id) [private]

Recursive kernel for bottomup refitting.

Definition at line 772 of file BVH_model.cpp.

template<typename BV >
int fcl::BVHModel< BV >::refitTree ( bool  bottomup) [private]

Refit the bounding volume hierarchy.

Definition at line 754 of file BVH_model.cpp.

template<typename BV >
int fcl::BVHModel< BV >::refitTree_bottomup ( ) [private]

Refit the bounding volume hierarchy in a bottom-up way (fast but less compact)

Definition at line 763 of file BVH_model.cpp.

template<typename BV >
int fcl::BVHModel< BV >::refitTree_topdown ( ) [private]

Refit the bounding volume hierarchy in a top-down way (slow but more compact)

Definition at line 841 of file BVH_model.cpp.

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

Replace a set of points in the old BVH model.

Definition at line 460 of file BVH_model.cpp.

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

Replace one triangle in the old BVH model.

Definition at line 445 of file BVH_model.cpp.

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

Replace one point in the old BVH model.

Definition at line 430 of file BVH_model.cpp.

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

Update a set of points in the old BVH model.

Definition at line 568 of file BVH_model.cpp.

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

Update one triangle in the old BVH model.

Definition at line 553 of file BVH_model.cpp.

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

Update one point in the old BVH model.

Definition at line 538 of file BVH_model.cpp.


Member Data Documentation

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

The state of BVH building process.

Definition at line 209 of file BVH_model.h.

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

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

Definition at line 215 of file BVH_model.h.

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

Split rule to split one BV node into two children.

Definition at line 212 of file BVH_model.h.

template<typename BV>
BVNode<BV>* fcl::BVHModel< BV >::bvs [private]

Bounding volume hierarchy.

Definition at line 227 of file BVH_model.h.

template<typename BV>
int fcl::BVHModel< BV >::num_bvs [private]

Number of BV nodes in bounding volume hierarchy.

Definition at line 230 of file BVH_model.h.

template<typename BV>
int fcl::BVHModel< BV >::num_bvs_allocated [private]

Definition at line 221 of file BVH_model.h.

template<typename BV>
int fcl::BVHModel< BV >::num_tris

Number of triangles.

Definition at line 203 of file BVH_model.h.

template<typename BV>
int fcl::BVHModel< BV >::num_tris_allocated [private]

Definition at line 219 of file BVH_model.h.

template<typename BV>
int fcl::BVHModel< BV >::num_vertex_updated [private]

Definition at line 222 of file BVH_model.h.

template<typename BV>
int fcl::BVHModel< BV >::num_vertices

Number of points.

Definition at line 206 of file BVH_model.h.

template<typename BV>
int fcl::BVHModel< BV >::num_vertices_allocated [private]

Definition at line 220 of file BVH_model.h.

template<typename BV>
Vec3f* fcl::BVHModel< BV >::prev_vertices

Geometry point data in previous frame.

Definition at line 200 of file BVH_model.h.

template<typename BV>
unsigned int* fcl::BVHModel< BV >::primitive_indices [private]

for ccd vertex update

Definition at line 223 of file BVH_model.h.

template<typename BV>
Triangle* fcl::BVHModel< BV >::tri_indices

Geometry triangle index data, will be NULL for point clouds.

Definition at line 197 of file BVH_model.h.

template<typename BV>
Vec3f* fcl::BVHModel< BV >::vertices

Geometry point data.

Definition at line 194 of file BVH_model.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


fcl
Author(s): Jia Pan
autogenerated on Tue Jan 15 2013 16:05:31