38 #ifndef FCL_BROADPHASE_BROADPAHSESPATIALHASH_H 39 #define FCL_BROADPHASE_BROADPAHSESPATIALHASH_H 43 #include "fcl/math/bv/AABB.h" 44 #include "fcl/broadphase/broadphase_collision_manager.h" 45 #include "fcl/broadphase/detail/simple_hash_table.h" 46 #include "fcl/broadphase/detail/sparse_hash_table.h" 47 #include "fcl/broadphase/detail/spatial_hash.h" 55 = detail::SimpleHashTable<AABB<S>, CollisionObject<S>*, detail::SpatialHash<S>> >
61 const Vector3<S>& scene_min,
62 const Vector3<S>& scene_max,
63 unsigned int default_table_size = 1000);
80 void update(CollisionObject<S>* updated_obj);
83 void update(
const std::vector<CollisionObject<S>*>& updated_objs);
116 static void computeBound(std::vector<CollisionObject<S>*>&
objs, Vector3<S>& l, Vector3<S>& u);
127 std::list<CollisionObject<S>*>
objs;
150 PartiallyPenetrating,
154 template <
typename Container>
155 bool distanceObjectToObjects(
156 CollisionObject<S>* obj,
157 const Container& objs,
164 template<
typename HashTable = detail::SimpleHashTable<AABB<
float>, CollisionObject<
float>*, detail::SpatialHash<
float>>>
167 template<
typename HashTable = detail::SimpleHashTable<AABB<
double>, CollisionObject<
double>*, detail::SpatialHash<
double>>>
172 #include "fcl/broadphase/broadphase_spatialhash-inl.h" void getObjects(std::vector< CollisionObject< S > * > &objs) const
return the objects managed by the manager
Definition: broadphase_spatialhash-inl.h:293
std::list< CollisionObject< S > * > objs_outside_scene_limit
objects outside the scene limit are in another list
Definition: broadphase_spatialhash.h:134
void clear()
clear the manager
Definition: broadphase_spatialhash-inl.h:283
AABB< S > scene_limit
the size of the scene
Definition: broadphase_spatialhash.h:137
Main namespace.
Definition: broadphase_bruteforce-inl.h:45
std::map< CollisionObject< S > *, AABB< S > > obj_aabb_map
store the map between objects and their aabbs. will make update more convenient
Definition: broadphase_spatialhash.h:140
bool empty() const
whether the manager is empty
Definition: broadphase_spatialhash-inl.h:605
void collide(CollisionObject< S > *obj, void *cdata, CollisionCallBack< S > callback) const
perform collision test between one object and all the objects belonging to the manager ...
Definition: broadphase_spatialhash-inl.h:301
static void computeBound(std::vector< CollisionObject< S > * > &objs, Vector3< S > &l, Vector3< S > &u)
compute the bound for the environent
Definition: broadphase_spatialhash-inl.h:619
void distance(CollisionObject< S > *obj, void *cdata, DistanceCallBack< S > callback) const
perform distance computation between one object and all the objects belonging ot the manager ...
Definition: broadphase_spatialhash-inl.h:309
spatial hashing collision mananger
Definition: broadphase_spatialhash.h:56
HashTable * hash_table
objects in the scene limit (given by scene_min and scene_max) are in the spatial hash table ...
Definition: broadphase_spatialhash.h:143
bool(*)(CollisionObject< S > *o1, CollisionObject< S > *o2, void *cdata) CollisionCallBack
Callback for collision between two objects. Return value is whether can stop now. ...
Definition: broadphase_collision_manager.h:53
bool(*)(CollisionObject< S > *o1, CollisionObject< S > *o2, void *cdata, S &dist) DistanceCallBack
Callback for distance between two objects, Return value is whether can stop now, also return the mini...
Definition: broadphase_collision_manager.h:60
std::list< CollisionObject< S > * > objs_partially_penetrating_scene_limit
objects partially penetrating (not totally inside nor outside) the scene limit are in another list ...
Definition: broadphase_spatialhash.h:131
std::list< CollisionObject< S > * > objs
all objects in the scene
Definition: broadphase_spatialhash.h:127
void registerObject(CollisionObject< S > *obj)
add one object to the manager
Definition: broadphase_spatialhash-inl.h:75
bool collide_(CollisionObject< S > *obj, void *cdata, CollisionCallBack< S > callback) const
perform collision test between one object and all the objects belonging to the manager ...
Definition: broadphase_spatialhash-inl.h:318
void setup()
initialize the manager, related with the specific type of manager
Definition: broadphase_spatialhash-inl.h:124
Base class for broad phase collision. It helps to accelerate the collision/distance between N objects...
Definition: broadphase_collision_manager.h:66
bool distance_(CollisionObject< S > *obj, void *cdata, DistanceCallBack< S > callback, S &min_dist) const
perform distance computation between one object and all the objects belonging ot the manager ...
Definition: broadphase_spatialhash-inl.h:374
size_t size() const
the number of objects managed by the manager
Definition: broadphase_spatialhash-inl.h:612
void unregisterObject(CollisionObject< S > *obj)
remove one object from the manager
Definition: broadphase_spatialhash-inl.h:100
void update()
update the condition of manager
Definition: broadphase_spatialhash-inl.h:131