38 #ifndef FCL_BROAD_PHASE_BRUTE_FORCE_INL_H 39 #define FCL_BROAD_PHASE_BRUTE_FORCE_INL_H 62 std::copy(other_objs.begin(), other_objs.end(), std::back_inserter(objs));
101 template <
typename S>
104 objs_.resize(objs.size());
105 std::copy(objs.begin(), objs.end(), objs_.begin());
109 template <
typename S>
112 if(size() == 0)
return;
114 for(
auto*
obj2 : objs)
116 if(callback(obj,
obj2, cdata))
122 template <
typename S>
125 if(size() == 0)
return;
128 for(
auto*
obj2 : objs)
132 if(callback(obj,
obj2, cdata, min_dist))
139 template <
typename S>
142 if(size() == 0)
return;
144 for(
typename std::list<
CollisionObject<S>*>::const_iterator it1 = objs.begin(), end = objs.end();
147 typename std::list<CollisionObject<S>*>::const_iterator it2 = it1; it2++;
148 for(; it2 != end; ++it2)
150 if((*it1)->getAABB().overlap((*it2)->getAABB()))
152 if(callback(*it1, *it2, cdata))
160 template <
typename S>
163 if(size() == 0)
return;
166 for(
typename std::list<
CollisionObject<S>*>::const_iterator it1 = objs.begin(), end = objs.end(); it1 != end; ++it1)
168 typename std::list<CollisionObject<S>*>::const_iterator it2 = it1; it2++;
169 for(; it2 != end; ++it2)
171 if((*it1)->getAABB().distance((*it2)->getAABB()) < min_dist)
173 if(callback(*it1, *it2, cdata, min_dist))
181 template <
typename S>
186 if((size() == 0) || (other_manager->
size() == 0))
return;
188 if(
this == other_manager)
194 for(
auto*
obj1 : objs)
196 for(
auto*
obj2 : other_manager->
objs)
198 if(
obj1->getAABB().overlap(
obj2->getAABB()))
208 template <
typename S>
213 if((size() == 0) || (other_manager->
size() == 0))
return;
215 if(
this == other_manager)
222 for(
auto*
obj1 : objs)
224 for(
auto*
obj2 : other_manager->
objs)
226 if(
obj1->getAABB().distance(
obj2->getAABB()) < min_dist)
228 if(callback(
obj1,
obj2, cdata, min_dist))
236 template <
typename S>
243 template <
typename S>
void registerObject(CollisionObject< S > *obj)
add one object to the manager
const AABB< S > & getAABB() const
get the AABB in world space
void getObjects(std::vector< CollisionObject< S > *> &objs) const
return the objects managed by the manager
CollisionObject< S > * obj1
S distance(const Eigen::MatrixBase< DerivedA > &R0, const Eigen::MatrixBase< DerivedB > &T0, const kIOS< S > &b1, const kIOS< S > &b2, Vector3< S > *P, Vector3< S > *Q)
Approximate distance between two kIOS bounding volumes.
void distance(CollisionObject< S > *obj, void *cdata, DistanceCallBack< S > callback) const
perform distance computation between one object and all the objects belonging to the manager ...
void clear()
clear the manager
bool(*)(CollisionObject< S > *o1, CollisionObject< S > *o2, void *cdata) CollisionCallBack
Callback for collision between two objects. Return value is whether can stop now. ...
template FCL_EXPORT std::size_t collide(const CollisionObject< double > *o1, const CollisionObject< double > *o2, const CollisionRequest< double > &request, CollisionResult< double > &result)
void registerObjects(const std::vector< CollisionObject< S > *> &other_objs)
add objects to the manager
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...
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 ...
void update()
update the condition of manager
S distance(const AABB< S > &other, Vector3< S > *P, Vector3< S > *Q) const
Distance between two AABBs; P and Q, should not be nullptr, return the nearest points.
std::list< CollisionObject< S > * > objs
objects belonging to the manager are stored in a list structure
bool empty() const
whether the manager is empty
the object for collision or distance computation, contains the geometry and the transform information...
size_t size() const
the number of objects managed by the manager
Brute force N-body collision manager.
void unregisterObject(CollisionObject< S > *obj)
remove one object from the manager
CollisionObject< S > * obj2
Base class for broad phase collision. It helps to accelerate the collision/distance between N objects...
CollisionObject< S > * obj
object
void setup()
initialize the manager, related with the specific type of manager