hpp-fcl  3.0.0
HPP fork of FCL -- The Flexible Collision Library
broadphase_collision_manager.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_BROADPHASECOLLISIONMANAGER_H
39 #define HPP_FCL_BROADPHASE_BROADPHASECOLLISIONMANAGER_H
40 
41 #include <set>
42 #include <vector>
43 #include <boost/function.hpp>
44 
47 
48 namespace hpp {
49 namespace fcl {
50 
55  public:
57 
59 
61  virtual void registerObjects(const std::vector<CollisionObject*>& other_objs);
62 
64  virtual void registerObject(CollisionObject* obj) = 0;
65 
67  virtual void unregisterObject(CollisionObject* obj) = 0;
68 
70  virtual void setup() = 0;
71 
73  virtual void update() = 0;
74 
76  virtual void update(CollisionObject* updated_obj);
77 
79  virtual void update(const std::vector<CollisionObject*>& updated_objs);
80 
82  virtual void clear() = 0;
83 
85  virtual void getObjects(std::vector<CollisionObject*>& objs) const = 0;
86 
88  virtual std::vector<CollisionObject*> getObjects() const {
89  std::vector<CollisionObject*> res(size());
90  getObjects(res);
91  return res;
92  };
93 
96  virtual void collide(CollisionObject* obj,
97  CollisionCallBackBase* callback) const = 0;
98 
101  virtual void distance(CollisionObject* obj,
102  DistanceCallBackBase* callback) const = 0;
103 
106  virtual void collide(CollisionCallBackBase* callback) const = 0;
107 
110  virtual void distance(DistanceCallBackBase* callback) const = 0;
111 
113  virtual void collide(BroadPhaseCollisionManager* other_manager,
114  CollisionCallBackBase* callback) const = 0;
115 
117  virtual void distance(BroadPhaseCollisionManager* other_manager,
118  DistanceCallBackBase* callback) const = 0;
119 
121  virtual bool empty() const = 0;
122 
124  virtual size_t size() const = 0;
125 
126  protected:
130  mutable std::set<std::pair<CollisionObject*, CollisionObject*> > tested_set;
131  mutable bool enable_tested_set_;
132 
134 
136 };
137 
138 } // namespace fcl
139 } // namespace hpp
140 
141 #endif
Base class for broad phase collision. It helps to accelerate the collision/distance between N objects...
Definition: broadphase_collision_manager.h:54
virtual void distance(CollisionObject *obj, DistanceCallBackBase *callback) const =0
perform distance computation between one object and all the objects belonging to the manager
virtual void setup()=0
initialize the manager, related with the specific type of manager
virtual bool empty() const =0
whether the manager is empty
virtual void getObjects(std::vector< CollisionObject * > &objs) const =0
return the objects managed by the manager
virtual void collide(CollisionCallBackBase *callback) const =0
perform collision test for the objects belonging to the manager (i.e., N^2 self collision)
virtual void unregisterObject(CollisionObject *obj)=0
remove one object from the manager
virtual size_t size() const =0
the number of objects managed by the manager
virtual void distance(DistanceCallBackBase *callback) const =0
perform distance test for the objects belonging to the manager (i.e., N^2 self distance)
virtual void update(const std::vector< CollisionObject * > &updated_objs)
update the manager by explicitly given the set of objects update
virtual void update()=0
update the condition of manager
virtual std::vector< CollisionObject * > getObjects() const
return the objects managed by the manager
Definition: broadphase_collision_manager.h:88
std::set< std::pair< CollisionObject *, CollisionObject * > > tested_set
tools help to avoid repeating collision or distance callback for the pairs of objects tested before....
Definition: broadphase_collision_manager.h:130
void insertTestedSet(CollisionObject *a, CollisionObject *b) const
virtual void collide(BroadPhaseCollisionManager *other_manager, CollisionCallBackBase *callback) const =0
perform collision test with objects belonging to another manager
virtual void clear()=0
clear the manager
virtual void distance(BroadPhaseCollisionManager *other_manager, DistanceCallBackBase *callback) const =0
perform distance test with objects belonging to another manager
virtual void update(CollisionObject *updated_obj)
update the manager by explicitly given the object updated
bool inTestedSet(CollisionObject *a, CollisionObject *b) const
virtual void registerObject(CollisionObject *obj)=0
add one object to the manager
virtual void registerObjects(const std::vector< CollisionObject * > &other_objs)
add objects to the manager
virtual void collide(CollisionObject *obj, CollisionCallBackBase *callback) const =0
perform collision test between one object and all the objects belonging to the manager
bool enable_tested_set_
Definition: broadphase_collision_manager.h:131
the object for collision or distance computation, contains the geometry and the transform information
Definition: collision_object.h:215
#define HPP_FCL_DLLAPI
Definition: config.hh:88
Main namespace.
Definition: broadphase_bruteforce.h:44
Base callback class for collision queries. This class can be supersed by child classes to provide des...
Definition: broadphase_callbacks.h:50
Base callback class for distance queries. This class can be supersed by child classes to provide desi...
Definition: broadphase_callbacks.h:73