coal 3.0.1
Coal, The Collision Detection Library. Previously known as HPP-FCL, fork of FCL -- The Flexible Collision Library
Loading...
Searching...
No Matches
coal::SpatialHashingCollisionManager< HashTable > Class Template Reference

spatial hashing collision mananger More...

#include <coal/broadphase/broadphase_spatialhash.h>

Inheritance diagram for coal::SpatialHashingCollisionManager< HashTable >:
Collaboration diagram for coal::SpatialHashingCollisionManager< HashTable >:

Public Types

typedef BroadPhaseCollisionManager Base
 

Public Member Functions

 SpatialHashingCollisionManager (Scalar cell_size, const Vec3s &scene_min, const Vec3s &scene_max, unsigned int default_table_size=1000)
 
 ~SpatialHashingCollisionManager ()
 
void registerObject (CollisionObject *obj)
 add one object to the manager
 
void unregisterObject (CollisionObject *obj)
 remove one object from the manager
 
void setup ()
 initialize the manager, related with the specific type of manager
 
virtual void update ()
 update the condition of manager
 
void update (CollisionObject *updated_obj)
 update the manager by explicitly given the object updated
 
void update (const std::vector< CollisionObject * > &updated_objs)
 update the manager by explicitly given the set of objects update
 
void clear ()
 clear the manager
 
void getObjects (std::vector< CollisionObject * > &objs) const
 return the objects managed by the manager
 
void collide (CollisionObject *obj, CollisionCallBackBase *callback) const
 perform collision test between one object and all the objects belonging to the manager
 
void distance (CollisionObject *obj, DistanceCallBackBase *callback) const
 perform distance computation between one object and all the objects belonging ot the manager
 
void collide (CollisionCallBackBase *callback) const
 perform collision test for the objects belonging to the manager (i.e, N^2 self collision)
 
void distance (DistanceCallBackBase *callback) const
 perform distance test for the objects belonging to the manager (i.e., N^2 self distance)
 
void collide (BroadPhaseCollisionManager *other_manager, CollisionCallBackBase *callback) const
 perform collision test with objects belonging to another manager
 
void distance (BroadPhaseCollisionManager *other_manager, DistanceCallBackBase *callback) const
 perform distance test with objects belonging to another manager
 
bool empty () const
 whether the manager is empty
 
size_t size () const
 the number of objects managed by the manager
 
virtual void getObjects (std::vector< CollisionObject * > &objs) const=0
 return the objects managed by the manager
 
virtual std::vector< CollisionObject * > getObjects () const
 return the objects managed by the manager
 
- Public Member Functions inherited from coal::BroadPhaseCollisionManager
 BroadPhaseCollisionManager ()
 
virtual ~BroadPhaseCollisionManager ()
 
virtual void registerObjects (const std::vector< CollisionObject * > &other_objs)
 add objects to the manager
 

Static Public Member Functions

static void computeBound (std::vector< CollisionObject * > &objs, Vec3s &l, Vec3s &u)
 compute the bound for the environent
 

Protected Member Functions

bool collide_ (CollisionObject *obj, CollisionCallBackBase *callback) const
 perform collision test between one object and all the objects belonging to the manager
 
bool distance_ (CollisionObject *obj, DistanceCallBackBase *callback, Scalar &min_dist) const
 perform distance computation between one object and all the objects belonging ot the manager
 
- Protected Member Functions inherited from coal::BroadPhaseCollisionManager
bool inTestedSet (CollisionObject *a, CollisionObject *b) const
 
void insertTestedSet (CollisionObject *a, CollisionObject *b) const
 

Protected Attributes

std::list< CollisionObject * > objs
 all objects in the scene
 
std::list< CollisionObject * > objs_partially_penetrating_scene_limit
 objects partially penetrating (not totally inside nor outside) the scene limit are in another list
 
std::list< CollisionObject * > objs_outside_scene_limit
 objects outside the scene limit are in another list
 
AABB scene_limit
 the size of the scene
 
std::map< CollisionObject *, AABBobj_aabb_map
 store the map between objects and their aabbs. will make update more convenient
 
HashTable * hash_table
 objects in the scene limit (given by scene_min and scene_max) are in the spatial hash table
 
- Protected Attributes inherited from coal::BroadPhaseCollisionManager
std::set< std::pair< CollisionObject *, CollisionObject * > > tested_set
 tools help to avoid repeating collision or distance callback for the pairs of objects tested before. It can be useful for some of the broadphase algorithms.
 
bool enable_tested_set_
 

Detailed Description

template<typename HashTable = detail::SimpleHashTable<AABB, CollisionObject*, detail::SpatialHash>>
class coal::SpatialHashingCollisionManager< HashTable >

spatial hashing collision mananger

Member Typedef Documentation

◆ Base

template<typename HashTable = detail::SimpleHashTable<AABB, CollisionObject*, detail::SpatialHash>>
typedef BroadPhaseCollisionManager coal::SpatialHashingCollisionManager< HashTable >::Base

Constructor & Destructor Documentation

◆ SpatialHashingCollisionManager()

template<typename HashTable >
coal::SpatialHashingCollisionManager< HashTable >::SpatialHashingCollisionManager ( Scalar  cell_size,
const Vec3s scene_min,
const Vec3s scene_max,
unsigned int  default_table_size = 1000 
)

◆ ~SpatialHashingCollisionManager()

template<typename HashTable >
coal::SpatialHashingCollisionManager< HashTable >::~SpatialHashingCollisionManager ( )

Member Function Documentation

◆ clear()

template<typename HashTable >
void coal::SpatialHashingCollisionManager< HashTable >::clear ( )
virtual

clear the manager

Implements coal::BroadPhaseCollisionManager.

◆ collide() [1/3]

template<typename HashTable >
void coal::SpatialHashingCollisionManager< HashTable >::collide ( BroadPhaseCollisionManager other_manager,
CollisionCallBackBase callback 
) const
virtual

perform collision test with objects belonging to another manager

Implements coal::BroadPhaseCollisionManager.

◆ collide() [2/3]

template<typename HashTable >
void coal::SpatialHashingCollisionManager< HashTable >::collide ( CollisionCallBackBase callback) const
virtual

perform collision test for the objects belonging to the manager (i.e, N^2 self collision)

Implements coal::BroadPhaseCollisionManager.

◆ collide() [3/3]

template<typename HashTable >
void coal::SpatialHashingCollisionManager< HashTable >::collide ( CollisionObject obj,
CollisionCallBackBase callback 
) const
virtual

perform collision test between one object and all the objects belonging to the manager

Implements coal::BroadPhaseCollisionManager.

◆ collide_()

template<typename HashTable >
bool coal::SpatialHashingCollisionManager< HashTable >::collide_ ( CollisionObject obj,
CollisionCallBackBase callback 
) const
protected

perform collision test between one object and all the objects belonging to the manager

◆ computeBound()

template<typename HashTable >
void coal::SpatialHashingCollisionManager< HashTable >::computeBound ( std::vector< CollisionObject * > &  objs,
Vec3s l,
Vec3s u 
)
static

compute the bound for the environent

◆ distance() [1/3]

template<typename HashTable >
void coal::SpatialHashingCollisionManager< HashTable >::distance ( BroadPhaseCollisionManager other_manager,
DistanceCallBackBase callback 
) const
virtual

perform distance test with objects belonging to another manager

Implements coal::BroadPhaseCollisionManager.

◆ distance() [2/3]

template<typename HashTable >
void coal::SpatialHashingCollisionManager< HashTable >::distance ( CollisionObject obj,
DistanceCallBackBase callback 
) const
virtual

perform distance computation between one object and all the objects belonging ot the manager

Implements coal::BroadPhaseCollisionManager.

◆ distance() [3/3]

template<typename HashTable >
void coal::SpatialHashingCollisionManager< HashTable >::distance ( DistanceCallBackBase callback) const
virtual

perform distance test for the objects belonging to the manager (i.e., N^2 self distance)

Implements coal::BroadPhaseCollisionManager.

◆ distance_()

template<typename HashTable >
bool coal::SpatialHashingCollisionManager< HashTable >::distance_ ( CollisionObject obj,
DistanceCallBackBase callback,
Scalar min_dist 
) const
protected

perform distance computation between one object and all the objects belonging ot the manager

◆ empty()

template<typename HashTable >
bool coal::SpatialHashingCollisionManager< HashTable >::empty ( ) const
virtual

whether the manager is empty

Implements coal::BroadPhaseCollisionManager.

◆ getObjects() [1/3]

template<typename HashTable = detail::SimpleHashTable<AABB, CollisionObject*, detail::SpatialHash>>
virtual std::vector< CollisionObject * > coal::BroadPhaseCollisionManager::getObjects ( ) const
inlinevirtual

return the objects managed by the manager

Reimplemented from coal::BroadPhaseCollisionManager.

◆ getObjects() [2/3]

template<typename HashTable >
void coal::SpatialHashingCollisionManager< HashTable >::getObjects ( std::vector< CollisionObject * > &  objs) const
virtual

return the objects managed by the manager

Implements coal::BroadPhaseCollisionManager.

◆ getObjects() [3/3]

template<typename HashTable = detail::SimpleHashTable<AABB, CollisionObject*, detail::SpatialHash>>
virtual void coal::BroadPhaseCollisionManager::getObjects ( std::vector< CollisionObject * > &  objs) const
virtual

return the objects managed by the manager

Implements coal::BroadPhaseCollisionManager.

◆ registerObject()

template<typename HashTable >
void coal::SpatialHashingCollisionManager< HashTable >::registerObject ( CollisionObject obj)
virtual

add one object to the manager

Implements coal::BroadPhaseCollisionManager.

◆ setup()

template<typename HashTable >
void coal::SpatialHashingCollisionManager< HashTable >::setup ( )
virtual

initialize the manager, related with the specific type of manager

Implements coal::BroadPhaseCollisionManager.

◆ size()

template<typename HashTable >
size_t coal::SpatialHashingCollisionManager< HashTable >::size ( ) const
virtual

the number of objects managed by the manager

Implements coal::BroadPhaseCollisionManager.

◆ unregisterObject()

template<typename HashTable >
void coal::SpatialHashingCollisionManager< HashTable >::unregisterObject ( CollisionObject obj)
virtual

remove one object from the manager

Implements coal::BroadPhaseCollisionManager.

◆ update() [1/3]

template<typename HashTable >
void coal::SpatialHashingCollisionManager< HashTable >::update ( )
virtual

update the condition of manager

Implements coal::BroadPhaseCollisionManager.

◆ update() [2/3]

template<typename HashTable >
void coal::SpatialHashingCollisionManager< HashTable >::update ( CollisionObject updated_obj)
virtual

update the manager by explicitly given the object updated

Reimplemented from coal::BroadPhaseCollisionManager.

◆ update() [3/3]

template<typename HashTable >
void coal::SpatialHashingCollisionManager< HashTable >::update ( const std::vector< CollisionObject * > &  updated_objs)
virtual

update the manager by explicitly given the set of objects update

Reimplemented from coal::BroadPhaseCollisionManager.

Member Data Documentation

◆ hash_table

template<typename HashTable = detail::SimpleHashTable<AABB, CollisionObject*, detail::SpatialHash>>
HashTable* coal::SpatialHashingCollisionManager< HashTable >::hash_table
protected

objects in the scene limit (given by scene_min and scene_max) are in the spatial hash table

◆ obj_aabb_map

template<typename HashTable = detail::SimpleHashTable<AABB, CollisionObject*, detail::SpatialHash>>
std::map<CollisionObject*, AABB> coal::SpatialHashingCollisionManager< HashTable >::obj_aabb_map
protected

store the map between objects and their aabbs. will make update more convenient

◆ objs

template<typename HashTable = detail::SimpleHashTable<AABB, CollisionObject*, detail::SpatialHash>>
std::list<CollisionObject*> coal::SpatialHashingCollisionManager< HashTable >::objs
protected

all objects in the scene

◆ objs_outside_scene_limit

template<typename HashTable = detail::SimpleHashTable<AABB, CollisionObject*, detail::SpatialHash>>
std::list<CollisionObject*> coal::SpatialHashingCollisionManager< HashTable >::objs_outside_scene_limit
protected

objects outside the scene limit are in another list

◆ objs_partially_penetrating_scene_limit

template<typename HashTable = detail::SimpleHashTable<AABB, CollisionObject*, detail::SpatialHash>>
std::list<CollisionObject*> coal::SpatialHashingCollisionManager< HashTable >::objs_partially_penetrating_scene_limit
protected

objects partially penetrating (not totally inside nor outside) the scene limit are in another list

◆ scene_limit

template<typename HashTable = detail::SimpleHashTable<AABB, CollisionObject*, detail::SpatialHash>>
AABB coal::SpatialHashingCollisionManager< HashTable >::scene_limit
protected

the size of the scene


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