Template Class SpatialHashingCollisionManager

Inheritance Relationships

Base Type

Class Documentation

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

spatial hashing collision mananger

Public Types

typedef BroadPhaseCollisionManager Base

Public Functions

SpatialHashingCollisionManager(CoalScalar cell_size, const Vec3s &scene_min, const Vec3s &scene_max, unsigned int default_table_size = 1000)
~SpatialHashingCollisionManager()
virtual void registerObject(CollisionObject *obj)

add one object to the manager

virtual void unregisterObject(CollisionObject *obj)

remove one object from the manager

virtual void setup()

initialize the manager, related with the specific type of manager

virtual void update()

update the condition of manager

virtual void update(CollisionObject *updated_obj)

update the manager by explicitly given the object updated

virtual void update(const std::vector<CollisionObject*> &updated_objs)

update the manager by explicitly given the set of objects update

virtual void clear()

clear the manager

virtual void getObjects(std::vector<CollisionObject*> &objs) const

return the objects managed by the manager

virtual void collide(CollisionObject *obj, CollisionCallBackBase *callback) const

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

virtual void distance(CollisionObject *obj, DistanceCallBackBase *callback) const

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

virtual void collide(CollisionCallBackBase *callback) const

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

virtual void distance(DistanceCallBackBase *callback) const

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

virtual void collide(BroadPhaseCollisionManager *other_manager, CollisionCallBackBase *callback) const

perform collision test with objects belonging to another manager

virtual void distance(BroadPhaseCollisionManager *other_manager, DistanceCallBackBase *callback) const

perform distance test with objects belonging to another manager

virtual bool empty() const

whether the manager is empty

virtual 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

inline virtual std::vector<CollisionObject*> getObjects() const

return the objects managed by the manager

Public Static Functions

static void computeBound(std::vector<CollisionObject*> &objs, Vec3s &l, Vec3s &u)

compute the bound for the environent

Protected 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, CoalScalar &min_dist) const

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

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*, AABB> obj_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