Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
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]

Public Types

using S = typename BV::S
 

Public Member Functions

int addSubModel (const std::vector< Vector3< S >> &ps)
 Add a set of points in the new BVH model. More...
 
int addSubModel (const std::vector< Vector3< S >> &ps, const std::vector< Triangle > &ts)
 Add a set of triangles in the new BVH model. More...
 
int addTriangle (const Vector3< S > &p1, const Vector3< S > &p2, const Vector3< S > &p3)
 Add one triangle in the new BVH model. More...
 
int addVertex (const Vector3< S > &p)
 Add one point in the new BVH model. More...
 
int beginModel (int num_tris=0, int num_vertices=0)
 Begin a new BVH model. More...
 
int beginReplaceModel ()
 Replace the geometry information of current frame (i.e. should have the same mesh topology with the previous frame) More...
 
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. More...
 
 BVHModel ()
 Constructing an empty BVH. More...
 
 BVHModel (const BVHModel &other)
 copy from another BVH More...
 
Vector3< ScomputeCOM () const override
 
void computeLocalAABB () override
 Compute the AABB for the BVH, used for broad-phase collision. More...
 
Matrix3< ScomputeMomentofInertia () const override
 
S computeVolume () const override
 
int endModel ()
 End BVH model construction, will build the bounding volume hierarchy. More...
 
int endReplaceModel (bool refit=true, bool bottomup=true)
 End BVH model replacement, will also refit or rebuild the bounding volume hierarchy. More...
 
int endUpdateModel (bool refit=true, bool bottomup=true)
 End BVH model update, will also refit or rebuild the bounding volume hierarchy. More...
 
BVNode< BV > & getBV (int id)
 Access the bv giving the its index. 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...
 
BVHModelType getModelType () const
 Model type described by the instance. More...
 
NODE_TYPE getNodeType () const override
 Get the BV type: default is unknown. More...
 
int getNumBVs () const
 Get the number of bv in the BVH. More...
 
OBJECT_TYPE getObjectType () const override
 Get the object type: it is a BVH. More...
 
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. More...
 
int memUsage (int msg) const
 Check the number of memory used. More...
 
int replaceSubModel (const std::vector< Vector3< S >> &ps)
 Replace a set of points in the old BVH model. More...
 
int replaceTriangle (const Vector3< S > &p1, const Vector3< S > &p2, const Vector3< S > &p3)
 Replace one triangle in the old BVH model. More...
 
int replaceVertex (const Vector3< S > &p)
 Replace one point in the old BVH model. More...
 
int updateSubModel (const std::vector< Vector3< S >> &ps)
 Update a set of points in the old BVH model. More...
 
int updateTriangle (const Vector3< S > &p1, const Vector3< S > &p2, const Vector3< S > &p3)
 Update one triangle in the old BVH model. More...
 
int updateVertex (const Vector3< S > &p)
 Update one point in the old BVH model. More...
 
 ~BVHModel ()
 deconstruction, delete mesh data related. More...
 
- Public Member Functions inherited from fcl::CollisionGeometry< BV::S >
 CollisionGeometry ()
 
virtual Vector3< BV::S > computeCOM () const
 compute center of mass More...
 
virtual Matrix3< BV::S > computeMomentofInertia () const
 compute the inertia matrix, related to the origin More...
 
virtual Matrix3< BV::S > computeMomentofInertiaRelatedToCOM () const
 compute the inertia matrix, related to the com More...
 
virtual BV::S computeVolume () const
 compute the volume More...
 
virtual NODE_TYPE getNodeType () const
 get the node type More...
 
virtual OBJECT_TYPE getObjectType () const
 get the type of the object More...
 
void * getUserData () const
 get user data in geometry More...
 
bool isFree () const
 whether the object is completely free More...
 
bool isOccupied () const
 whether the object is completely occupied More...
 
bool isUncertain () const
 whether the object has some uncertainty More...
 
void setUserData (void *data)
 set user data in geometry More...
 
virtual ~CollisionGeometry ()
 

Public Attributes

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

Private Member Functions

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

Private Attributes

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

Friends

template<typename , typename >
struct MakeParentRelativeRecurseImpl
 

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 57 of file BVH_model.h.

Member Typedef Documentation

◆ S

template<typename BV >
using fcl::BVHModel< BV >::S = typename BV::S

Definition at line 61 of file BVH_model.h.

Constructor & Destructor Documentation

◆ BVHModel() [1/2]

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

Constructing an empty BVH.

Definition at line 62 of file BVH_model-inl.h.

◆ BVHModel() [2/2]

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

copy from another BVH

Definition at line 83 of file BVH_model-inl.h.

◆ ~BVHModel()

template<typename BV >
fcl::BVHModel< BV >::~BVHModel

deconstruction, delete mesh data related.

Definition at line 150 of file BVH_model-inl.h.

Member Function Documentation

◆ addSubModel() [1/2]

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

Add a set of points in the new BVH model.

Definition at line 347 of file BVH_model-inl.h.

◆ addSubModel() [2/2]

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

Add a set of triangles in the new BVH model.

Definition at line 383 of file BVH_model-inl.h.

◆ addTriangle()

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

Add one triangle in the new BVH model.

Definition at line 288 of file BVH_model-inl.h.

◆ addVertex()

template<typename BV >
int fcl::BVHModel< BV >::addVertex ( const Vector3< S > &  p)

Add one point in the new BVH model.

Definition at line 257 of file BVH_model-inl.h.

◆ beginModel()

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

Begin a new BVH model.

Definition at line 207 of file BVH_model-inl.h.

◆ beginReplaceModel()

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 521 of file BVH_model-inl.h.

◆ beginUpdateModel()

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 624 of file BVH_model-inl.h.

◆ buildTree()

template<typename BV >
int fcl::BVHModel< BV >::buildTree
private

Build the bounding volume hierarchy.

Definition at line 833 of file BVH_model-inl.h.

◆ computeCOM()

template<typename BV >
Vector3< typename BV::S > fcl::BVHModel< BV >::computeCOM
override

Definition at line 766 of file BVH_model-inl.h.

◆ computeLocalAABB()

template<typename BV >
void fcl::BVHModel< BV >::computeLocalAABB
overridevirtual

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

Implements fcl::CollisionGeometry< BV::S >.

Definition at line 1080 of file BVH_model-inl.h.

◆ computeMomentofInertia()

template<typename BV >
Matrix3< typename BV::S > fcl::BVHModel< BV >::computeMomentofInertia
override

Definition at line 798 of file BVH_model-inl.h.

◆ computeVolume()

template<typename BV >
BV::S fcl::BVHModel< BV >::computeVolume
override

Definition at line 783 of file BVH_model-inl.h.

◆ endModel()

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

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

Definition at line 450 of file BVH_model-inl.h.

◆ endReplaceModel()

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 594 of file BVH_model-inl.h.

◆ endUpdateModel()

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 703 of file BVH_model-inl.h.

◆ getBV() [1/2]

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

Access the bv giving the its index.

Definition at line 169 of file BVH_model-inl.h.

◆ getBV() [2/2]

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

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 162 of file BVH_model-inl.h.

◆ getModelType()

template<typename BV >
BVHModelType fcl::BVHModel< BV >::getModelType

Model type described by the instance.

Definition at line 50 of file BVH_model-inl.h.

◆ getNodeType()

template<typename BV >
NODE_TYPE fcl::BVHModel< BV >::getNodeType
override

Get the BV type: default is unknown.

Definition at line 200 of file BVH_model-inl.h.

◆ getNumBVs()

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

Get the number of bv in the BVH.

Definition at line 176 of file BVH_model-inl.h.

◆ getObjectType()

template<typename BV >
OBJECT_TYPE fcl::BVHModel< BV >::getObjectType
override

Get the object type: it is a BVH.

Definition at line 183 of file BVH_model-inl.h.

◆ makeParentRelative()

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

Definition at line 758 of file BVH_model-inl.h.

◆ makeParentRelativeRecurse()

template<typename BV >
void fcl::BVHModel< BV >::makeParentRelativeRecurse ( int  bv_id,
const Matrix3< S > &  parent_axis,
const Vector3< S > &  parent_c 
)
private

@recursively 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 1053 of file BVH_model-inl.h.

◆ memUsage()

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

Check the number of memory used.

Definition at line 738 of file BVH_model-inl.h.

◆ recursiveBuildTree()

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 868 of file BVH_model-inl.h.

◆ recursiveRefitTree_bottomup()

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

Recursive kernel for bottomup refitting.

Definition at line 961 of file BVH_model-inl.h.

◆ refitTree()

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

Refit the bounding volume hierarchy.

Definition at line 942 of file BVH_model-inl.h.

◆ refitTree_bottomup()

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 952 of file BVH_model-inl.h.

◆ refitTree_topdown()

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 1064 of file BVH_model-inl.h.

◆ replaceSubModel()

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

Replace a set of points in the old BVH model.

Definition at line 576 of file BVH_model-inl.h.

◆ replaceTriangle()

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

Replace one triangle in the old BVH model.

Definition at line 560 of file BVH_model-inl.h.

◆ replaceVertex()

template<typename BV >
int fcl::BVHModel< BV >::replaceVertex ( const Vector3< S > &  p)

Replace one point in the old BVH model.

Definition at line 544 of file BVH_model-inl.h.

◆ updateSubModel()

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

Update a set of points in the old BVH model.

Definition at line 685 of file BVH_model-inl.h.

◆ updateTriangle()

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

Update one triangle in the old BVH model.

Definition at line 669 of file BVH_model-inl.h.

◆ updateVertex()

template<typename BV >
int fcl::BVHModel< BV >::updateVertex ( const Vector3< S > &  p)

Update one point in the old BVH model.

Definition at line 653 of file BVH_model-inl.h.

Friends And Related Function Documentation

◆ MakeParentRelativeRecurseImpl

template<typename BV >
template<typename , typename >
friend struct MakeParentRelativeRecurseImpl
friend

Definition at line 226 of file BVH_model.h.

Member Data Documentation

◆ build_state

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

The state of BVH building process.

Definition at line 177 of file BVH_model.h.

◆ bv_fitter

template<typename BV >
std::shared_ptr<detail::BVFitterBase<BV> > fcl::BVHModel< BV >::bv_fitter

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

Definition at line 183 of file BVH_model.h.

◆ bv_splitter

template<typename BV >
std::shared_ptr<detail::BVSplitterBase<BV> > fcl::BVHModel< BV >::bv_splitter

Split rule to split one BV node into two children.

Definition at line 180 of file BVH_model.h.

◆ bvs

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

Bounding volume hierarchy.

Definition at line 194 of file BVH_model.h.

◆ num_bvs

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

Number of BV nodes in bounding volume hierarchy.

Definition at line 197 of file BVH_model.h.

◆ num_bvs_allocated

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

Definition at line 189 of file BVH_model.h.

◆ num_tris

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

Number of triangles.

Definition at line 171 of file BVH_model.h.

◆ num_tris_allocated

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

Definition at line 187 of file BVH_model.h.

◆ num_vertex_updated

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

Definition at line 190 of file BVH_model.h.

◆ num_vertices

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

Number of points.

Definition at line 174 of file BVH_model.h.

◆ num_vertices_allocated

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

Definition at line 188 of file BVH_model.h.

◆ prev_vertices

template<typename BV >
Vector3<S>* fcl::BVHModel< BV >::prev_vertices

Geometry point data in previous frame.

Definition at line 168 of file BVH_model.h.

◆ primitive_indices

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

for ccd vertex update

Definition at line 191 of file BVH_model.h.

◆ tri_indices

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

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

Definition at line 165 of file BVH_model.h.

◆ vertices

template<typename BV >
Vector3<S>* fcl::BVHModel< BV >::vertices

Geometry point data.

Definition at line 162 of file BVH_model.h.


The documentation for this class was generated from the following files:


fcl
Author(s):
autogenerated on Tue Dec 5 2023 03:40:50