53 const std::vector<CollisionObject*>& other_objs) {
54 std::copy(other_objs.begin(), other_objs.end(), std::back_inserter(
objs));
82 std::vector<CollisionObject*>& objs_)
const {
83 objs_.resize(
objs.size());
84 std::copy(
objs.begin(),
objs.end(), objs_.begin());
91 if (
size() == 0)
return;
93 for (
auto* obj2 :
objs) {
94 if ((*callback)(obj, obj2))
return;
102 if (
size() == 0)
return;
104 FCL_REAL min_dist = (std::numeric_limits<FCL_REAL>::max)();
105 for (
auto* obj2 :
objs) {
107 if ((*callback)(obj, obj2, min_dist))
return;
115 if (
size() == 0)
return;
117 for (
typename std::list<CollisionObject*>::const_iterator it1 =
objs.begin(),
120 typename std::list<CollisionObject*>::const_iterator it2 = it1;
122 for (; it2 != end; ++it2) {
123 if ((*it1)->getAABB().overlap((*it2)->getAABB())) {
124 if ((*callback)(*it1, *it2))
return;
133 if (
size() == 0)
return;
135 FCL_REAL min_dist = (std::numeric_limits<FCL_REAL>::max)();
136 for (
typename std::list<CollisionObject*>::const_iterator it1 =
objs.begin(),
139 typename std::list<CollisionObject*>::const_iterator it2 = it1;
141 for (; it2 != end; ++it2) {
142 if ((*it1)->getAABB().distance((*it2)->getAABB()) < min_dist) {
143 if ((*callback)(*it1, *it2, min_dist))
return;
156 if ((
size() == 0) || (other_manager->
size() == 0))
return;
158 if (
this == other_manager) {
163 for (
auto* obj1 :
objs) {
164 for (
auto* obj2 : other_manager->
objs) {
165 if (obj1->getAABB().overlap(obj2->getAABB())) {
166 if ((*callback)(obj1, obj2))
return;
179 if ((
size() == 0) || (other_manager->
size() == 0))
return;
181 if (
this == other_manager) {
186 FCL_REAL min_dist = (std::numeric_limits<FCL_REAL>::max)();
187 for (
auto* obj1 :
objs) {
188 for (
auto* obj2 : other_manager->
objs) {
189 if (obj1->getAABB().distance(obj2->getAABB()) < min_dist) {
190 if ((*callback)(obj1, obj2, min_dist))
return;
void unregisterObject(CollisionObject *obj)
remove one object from the manager
bool empty() const
whether the manager is empty
virtual void init()
Initialization of the callback before running the collision broadphase manager.
Base class for broad phase collision. It helps to accelerate the collision/distance between N objects...
Base callback class for collision queries. This class can be supersed by child classes to provide des...
size_t size() const
the number of objects managed by the manager
virtual void init()
Initialization of the callback before running the collision broadphase manager.
std::list< CollisionObject * > objs
objects belonging to the manager are stored in a list structure
virtual void update()
update the condition of manager
void registerObjects(const std::vector< CollisionObject *> &other_objs)
add objects to the manager
virtual std::vector< CollisionObject * > getObjects() const
return the objects managed by the manager
void setup()
initialize the manager, related with the specific type of manager
void clear()
clear 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 to the manager ...
Brute force N-body collision manager.
FCL_REAL distance(const AABB &other) const
Distance between two AABBs.
const AABB & getAABB() const
get the AABB in world space
the object for collision or distance computation, contains the geometry and the transform information...
Base callback class for distance queries. This class can be supersed by child classes to provide desi...
void registerObject(CollisionObject *obj)
add one object to the manager