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>
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< S > | computeCOM () const override |
void | computeLocalAABB () override |
Compute the AABB for the BVH, used for broad-phase collision. More... | |
Matrix3< S > | computeMomentofInertia () 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... | |
Triangle * | tri_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 |
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.
using fcl::BVHModel< BV >::S = typename BV::S |
Definition at line 61 of file BVH_model.h.
fcl::BVHModel< BV >::BVHModel |
Constructing an empty BVH.
Definition at line 62 of file BVH_model-inl.h.
fcl::BVHModel< BV >::BVHModel | ( | const BVHModel< BV > & | other | ) |
copy from another BVH
Definition at line 83 of file BVH_model-inl.h.
fcl::BVHModel< BV >::~BVHModel |
deconstruction, delete mesh data related.
Definition at line 150 of file BVH_model-inl.h.
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.
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.
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.
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.
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.
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.
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.
|
private |
Build the bounding volume hierarchy.
Definition at line 833 of file BVH_model-inl.h.
|
override |
Definition at line 766 of file BVH_model-inl.h.
|
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.
|
override |
Definition at line 798 of file BVH_model-inl.h.
|
override |
Definition at line 783 of file BVH_model-inl.h.
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.
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.
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.
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.
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.
BVHModelType fcl::BVHModel< BV >::getModelType |
Model type described by the instance.
Definition at line 50 of file BVH_model-inl.h.
|
override |
Get the BV type: default is unknown.
Definition at line 200 of file BVH_model-inl.h.
int fcl::BVHModel< BV >::getNumBVs |
Get the number of bv in the BVH.
Definition at line 176 of file BVH_model-inl.h.
|
override |
Get the object type: it is a BVH.
Definition at line 183 of file BVH_model-inl.h.
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.
|
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.
int fcl::BVHModel< BV >::memUsage | ( | int | msg | ) | const |
Check the number of memory used.
Definition at line 738 of file BVH_model-inl.h.
|
private |
Recursive kernel for hierarchy construction.
Definition at line 868 of file BVH_model-inl.h.
|
private |
Recursive kernel for bottomup refitting.
Definition at line 961 of file BVH_model-inl.h.
|
private |
Refit the bounding volume hierarchy.
Definition at line 942 of file BVH_model-inl.h.
|
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.
|
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.
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.
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.
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.
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.
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.
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.
|
friend |
Definition at line 226 of file BVH_model.h.
BVHBuildState fcl::BVHModel< BV >::build_state |
The state of BVH building process.
Definition at line 177 of file BVH_model.h.
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.
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.
|
private |
Bounding volume hierarchy.
Definition at line 194 of file BVH_model.h.
|
private |
Number of BV nodes in bounding volume hierarchy.
Definition at line 197 of file BVH_model.h.
|
private |
Definition at line 189 of file BVH_model.h.
int fcl::BVHModel< BV >::num_tris |
Number of triangles.
Definition at line 171 of file BVH_model.h.
|
private |
Definition at line 187 of file BVH_model.h.
|
private |
Definition at line 190 of file BVH_model.h.
int fcl::BVHModel< BV >::num_vertices |
Number of points.
Definition at line 174 of file BVH_model.h.
|
private |
Definition at line 188 of file BVH_model.h.
Vector3<S>* fcl::BVHModel< BV >::prev_vertices |
Geometry point data in previous frame.
Definition at line 168 of file BVH_model.h.
|
private |
for ccd vertex update
Definition at line 191 of file BVH_model.h.
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.
Vector3<S>* fcl::BVHModel< BV >::vertices |
Geometry point data.
Definition at line 162 of file BVH_model.h.