broadphase_spatialhash.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011-2014, Willow Garage, Inc.
5  * Copyright (c) 2014-2016, Open Source Robotics Foundation
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of Open Source Robotics Foundation nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
38 #ifndef HPP_FCL_BROADPHASE_BROADPAHSESPATIALHASH_H
39 #define HPP_FCL_BROADPHASE_BROADPAHSESPATIALHASH_H
40 
41 #include <list>
42 #include <map>
43 #include "hpp/fcl/BV/AABB.h"
48 
49 namespace hpp {
50 namespace fcl {
51 
53 template <typename HashTable = detail::SimpleHashTable<AABB, CollisionObject*,
54  detail::SpatialHash> >
56  public:
58  using Base::getObjects;
59 
60  SpatialHashingCollisionManager(FCL_REAL cell_size, const Vec3f& scene_min,
61  const Vec3f& scene_max,
62  unsigned int default_table_size = 1000);
63 
65 
68 
71 
73  void setup();
74 
76  virtual void update();
77 
79  void update(CollisionObject* updated_obj);
80 
82  void update(const std::vector<CollisionObject*>& updated_objs);
83 
85  void clear();
86 
88  void getObjects(std::vector<CollisionObject*>& objs) const;
89 
93 
97 
101 
105 
107  void collide(BroadPhaseCollisionManager* other_manager,
109 
111  void distance(BroadPhaseCollisionManager* other_manager,
113 
115  bool empty() const;
116 
118  size_t size() const;
119 
121  static void computeBound(std::vector<CollisionObject*>& objs, Vec3f& l,
122  Vec3f& u);
123 
124  protected:
128 
132  FCL_REAL& min_dist) const;
133 
135  std::list<CollisionObject*> objs;
136 
139  std::list<CollisionObject*> objs_partially_penetrating_scene_limit;
140 
142  std::list<CollisionObject*> objs_outside_scene_limit;
143 
146 
149  std::map<CollisionObject*, AABB> obj_aabb_map;
150 
153  HashTable* hash_table;
154 
155  private:
157 
158  template <typename Container>
159  bool distanceObjectToObjects(CollisionObject* obj, const Container& objs,
161  FCL_REAL& min_dist) const;
162 };
163 
164 } // namespace fcl
165 
166 } // namespace hpp
167 
169 
170 #endif
spatial_hash.h
hpp::fcl::SpatialHashingCollisionManager::setup
void setup()
initialize the manager, related with the specific type of manager
Definition: broadphase_spatialhash-inl.h:106
hpp::fcl::Vec3f
Eigen::Matrix< FCL_REAL, 3, 1 > Vec3f
Definition: data_types.h:66
hpp::fcl::SpatialHashingCollisionManager::objs
std::list< CollisionObject * > objs
all objects in the scene
Definition: broadphase_spatialhash.h:135
hpp::fcl::SpatialHashingCollisionManager::update
virtual void update()
update the condition of manager
Definition: broadphase_spatialhash-inl.h:112
hpp::fcl::SpatialHashingCollisionManager::clear
void clear()
clear the manager
Definition: broadphase_spatialhash-inl.h:238
collision_manager.callback
callback
Definition: collision_manager.py:27
hpp::fcl::SpatialHashingCollisionManager::Outside
@ Outside
Definition: broadphase_spatialhash.h:156
hpp::fcl::SpatialHashingCollisionManager
spatial hashing collision mananger
Definition: broadphase_spatialhash.h:55
hpp::fcl::SpatialHashingCollisionManager::hash_table
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:153
hpp::fcl::SpatialHashingCollisionManager::SpatialHashingCollisionManager
SpatialHashingCollisionManager(FCL_REAL cell_size, const Vec3f &scene_min, const Vec3f &scene_max, unsigned int default_table_size=1000)
Definition: broadphase_spatialhash-inl.h:48
sparse_hash_table.h
hpp::fcl::SpatialHashingCollisionManager::size
size_t size() const
the number of objects managed by the manager
Definition: broadphase_spatialhash-inl.h:496
simple_hash_table.h
broadphase_collision_manager.h
hpp::fcl::SpatialHashingCollisionManager::Inside
@ Inside
Definition: broadphase_spatialhash.h:156
hpp::fcl::SpatialHashingCollisionManager::objs_partially_penetrating_scene_limit
std::list< CollisionObject * > objs_partially_penetrating_scene_limit
objects partially penetrating (not totally inside nor outside) the scene limit are in another list
Definition: broadphase_spatialhash.h:139
hpp::fcl::SpatialHashingCollisionManager::objs_outside_scene_limit
std::list< CollisionObject * > objs_outside_scene_limit
objects outside the scene limit are in another list
Definition: broadphase_spatialhash.h:142
hpp::fcl::SpatialHashingCollisionManager::ObjectStatus
ObjectStatus
Definition: broadphase_spatialhash.h:156
hpp::fcl::BroadPhaseCollisionManager
Base class for broad phase collision. It helps to accelerate the collision/distance between N objects...
Definition: broadphase_collision_manager.h:54
hpp::fcl::SpatialHashingCollisionManager::distance
void distance(CollisionObject *obj, DistanceCallBackBase *callback) const
perform distance computation between one object and all the objects belonging ot the manager
Definition: broadphase_spatialhash-inl.h:263
hpp::fcl::SpatialHashingCollisionManager::collide_
bool collide_(CollisionObject *obj, CollisionCallBackBase *callback) const
perform collision test between one object and all the objects belonging to the manager
Definition: broadphase_spatialhash-inl.h:272
hpp::fcl::FCL_REAL
double FCL_REAL
Definition: data_types.h:65
hpp::fcl::DistanceCallBackBase
Base callback class for distance queries. This class can be supersed by child classes to provide desi...
Definition: broadphase_callbacks.h:73
hpp::fcl::SpatialHashingCollisionManager::Base
BroadPhaseCollisionManager Base
Definition: broadphase_spatialhash.h:57
hpp::fcl::SpatialHashingCollisionManager::obj_aabb_map
std::map< CollisionObject *, AABB > obj_aabb_map
store the map between objects and their aabbs. will make update more convenient
Definition: broadphase_spatialhash.h:149
hpp::fcl::BroadPhaseCollisionManager::getObjects
virtual std::vector< CollisionObject * > getObjects() const
return the objects managed by the manager
Definition: broadphase_collision_manager.h:88
hpp::fcl::SpatialHashingCollisionManager::PartiallyPenetrating
@ PartiallyPenetrating
Definition: broadphase_spatialhash.h:156
hpp::fcl::SpatialHashingCollisionManager::scene_limit
AABB scene_limit
the size of the scene
Definition: broadphase_spatialhash.h:145
hpp
Main namespace.
Definition: broadphase_bruteforce.h:44
hpp::fcl::CollisionObject
the object for collision or distance computation, contains the geometry and the transform information
Definition: collision_object.h:215
hpp::fcl::AABB
A class describing the AABB collision structure, which is a box in 3D space determined by two diagona...
Definition: BV/AABB.h:54
hpp::fcl::SpatialHashingCollisionManager::distanceObjectToObjects
bool distanceObjectToObjects(CollisionObject *obj, const Container &objs, DistanceCallBackBase *callback, FCL_REAL &min_dist) const
Definition: broadphase_spatialhash-inl.h:514
hpp::fcl::SpatialHashingCollisionManager::collide
void collide(CollisionObject *obj, CollisionCallBackBase *callback) const
perform collision test between one object and all the objects belonging to the manager
Definition: broadphase_spatialhash-inl.h:255
hpp::fcl::SpatialHashingCollisionManager::computeBound
static void computeBound(std::vector< CollisionObject * > &objs, Vec3f &l, Vec3f &u)
compute the bound for the environent
Definition: broadphase_spatialhash-inl.h:502
AABB.h
hpp::fcl::CollisionCallBackBase
Base callback class for collision queries. This class can be supersed by child classes to provide des...
Definition: broadphase_callbacks.h:50
hpp::fcl::SpatialHashingCollisionManager::~SpatialHashingCollisionManager
~SpatialHashingCollisionManager()
Definition: broadphase_spatialhash-inl.h:58
hpp::fcl::SpatialHashingCollisionManager::empty
bool empty() const
whether the manager is empty
Definition: broadphase_spatialhash-inl.h:490
hpp::fcl::SpatialHashingCollisionManager::unregisterObject
void unregisterObject(CollisionObject *obj)
remove one object from the manager
Definition: broadphase_spatialhash-inl.h:85
hpp::fcl::SpatialHashingCollisionManager::registerObject
void registerObject(CollisionObject *obj)
add one object to the manager
Definition: broadphase_spatialhash-inl.h:64
broadphase_spatialhash-inl.h
hpp::fcl::SpatialHashingCollisionManager::distance_
bool distance_(CollisionObject *obj, DistanceCallBackBase *callback, FCL_REAL &min_dist) const
perform distance computation between one object and all the objects belonging ot the manager
Definition: broadphase_spatialhash-inl.h:311


hpp-fcl
Author(s):
autogenerated on Fri Aug 2 2024 02:45:13