39 #ifndef HPP_FCL_COLLISION_DATA_H 40 #define HPP_FCL_COLLISION_DATA_H 91 static const int NONE = -1;
112 penetration_depth(depth_)
118 return b2 < other.
b2;
119 return b1 < other.
b1;
124 return o1 == other.
o1 135 return !(*
this == other);
154 enable_cached_gjk_guess (false),
155 cached_gjk_guess (1,0,0),
174 if (enable_cached_gjk_guess) {
211 bool enable_contact_ =
false,
212 bool enable_distance_lower_bound_ =
false,
213 size_t num_max_cost_sources_ = 1,
214 bool enable_cost_ =
false,
215 bool use_approximate_cost_ =
true)
219 num_max_contacts(num_max_contacts_),
220 enable_contact(flag &
CONTACT),
223 break_distance (1e-3)
229 enable_contact(false),
230 enable_distance_lower_bound (false),
232 break_distance (1e-3)
244 std::vector<Contact> contacts;
255 : distance_lower_bound (std::numeric_limits<
FCL_REAL>::max())
262 if (distance_lower_bound_ < distance_lower_bound)
263 distance_lower_bound = distance_lower_bound_;
269 contacts.push_back(c);
275 return contacts == other.contacts
282 return contacts.size() > 0;
288 return contacts.size();
294 if(contacts.size() == 0)
295 throw std::invalid_argument(
"The number of contacts is zero. No Contact can be returned.");
297 if(i < contacts.size())
300 return contacts.back();
306 contacts_.resize(contacts.size());
307 std::copy(contacts.begin(), contacts.end(), contacts_.begin());
338 enable_nearest_points(enable_nearest_points_),
350 enable_nearest_points(enable_nearest_points_),
393 static const int NONE = -1;
396 std::numeric_limits<FCL_REAL>::max()):
397 min_distance(min_distance_), o1(NULL), o2(NULL), b1(NONE), b2(NONE)
399 Vec3f nan (Vec3f::Constant(std::numeric_limits<FCL_REAL>::quiet_NaN()));
400 nearest_points [0] = nearest_points [1] = normal = nan;
407 if(min_distance > distance)
422 if(min_distance > distance)
429 nearest_points[0] = p1;
430 nearest_points[1] = p2;
441 o1 = other_result.
o1;
442 o2 = other_result.
o2;
443 b1 = other_result.
b1;
444 b2 = other_result.
b2;
447 normal = other_result.
normal;
454 min_distance = std::numeric_limits<FCL_REAL>::max();
473 if ((o1 != NULL) xor (other.
o1 != NULL))
return false;
474 is_same &= (o1 == other.
o1);
477 if ((o2 != NULL) xor (other.
o2 != NULL))
return false;
478 is_same &= (o2 == other.
o2);
490 {
return static_cast<CollisionRequestFlag>(
static_cast<const int>(a) | static_cast<const int>(b));}
493 {
return static_cast<CollisionRequestFlag>(
static_cast<const int>(a) & static_cast<const int>(b));}
496 {
return static_cast<CollisionRequestFlag>(
static_cast<const int>(a) ^ static_cast<const int>(b));}
support_func_guess_t cached_support_func_guess
the support function intial guess set by user
Definition: collision_data.h:151
size_t num_max_contacts
The maximum number of contacts will return.
Definition: collision_data.h:194
CollisionRequestFlag operator|(CollisionRequestFlag a, CollisionRequestFlag b)
Definition: collision_data.h:489
DistanceRequest(bool enable_nearest_points_, FCL_REAL rel_err_, FCL_REAL abs_err_, int) HPP_FCL_DEPRECATED
Definition: collision_data.h:334
const int GST_INDEP HPP_FCL_DEPRECATED
Definition: collision_data.h:56
request to the distance computation
Definition: collision_data.h:324
void update(const DistanceResult &other_result)
add distance information into the result
Definition: collision_data.h:436
support_func_guess_t cached_support_func_guess
stores the last support function vertex index, when relevant.
Definition: collision_data.h:169
FCL_REAL distance(const Matrix3f &R0, const Vec3f &T0, const kIOS &b1, const kIOS &b2, Vec3f *P=NULL, Vec3f *Q=NULL) HPP_FCL_DLLAPI
Approximate distance between two kIOS bounding volumes.
const CollisionGeometry * o1
collision object 1
Definition: collision_data.h:375
base class for all query results
Definition: collision_data.h:163
Main namespace.
Definition: AABB.h:43
collision result
Definition: collision_data.h:240
int b2
information about the nearest point in object 2 if object 2 is mesh or point cloud, it is the triangle or point id if object 2 is geometry shape, it is NONE (-1), if object 2 is octree, it is the id of the cell
Definition: collision_data.h:390
Vec3f nearest_points[2]
nearest points
Definition: collision_data.h:369
bool enable_cached_gjk_guess
whether enable gjk intial guess
Definition: collision_data.h:145
void updateDistanceLowerBound(const FCL_REAL &distance_lower_bound_)
Update the lower bound only if the distance in inferior.
Definition: collision_data.h:260
CollisionRequestFlag & operator|=(CollisionRequestFlag &a, CollisionRequestFlag b)
Definition: collision_data.h:498
QueryRequest()
Definition: collision_data.h:153
size_t numContacts() const
number of contacts found
Definition: collision_data.h:286
void addContact(const Contact &c)
add one contact into result structure
Definition: collision_data.h:267
DistanceResult(FCL_REAL min_distance_=std::numeric_limits< FCL_REAL >::max())
Definition: collision_data.h:395
FCL_REAL distance_lower_bound
Definition: collision_data.h:251
Definition: collision_data.h:185
void clear()
clear the result
Definition: collision_data.h:452
CollisionRequestFlag & operator &=(CollisionRequestFlag &a, CollisionRequestFlag b)
Definition: collision_data.h:501
CollisionRequestFlag
flag declaration for specifying required params in CollisionResult
Definition: collision_data.h:183
CollisionRequestFlag operator^(CollisionRequestFlag a, CollisionRequestFlag b)
Definition: collision_data.h:495
request to the collision algorithm
Definition: collision_data.h:191
void clear()
clear the results obtained
Definition: collision_data.h:311
double FCL_REAL
Definition: data_types.h:69
void updateGuess(const QueryResult &result)
Definition: collision_data.h:172
CollisionRequestFlag & operator^=(CollisionRequestFlag &a, CollisionRequestFlag b)
Definition: collision_data.h:504
FCL_REAL min_distance
minimum distance between two objects. if two objects are in collision, min_distance <= 0...
Definition: collision_data.h:366
int b1
information about the nearest point in object 1 if object 1 is mesh or point cloud, it is the triangle or point id if object 1 is geometry shape, it is NONE (-1), if object 1 is octree, it is the id of the cell
Definition: collision_data.h:384
Vec3f normal
In case both objects are in collision, store the normal.
Definition: collision_data.h:372
void getContacts(std::vector< Contact > &contacts_) const
get all the contacts
Definition: collision_data.h:304
Vec3f cached_gjk_guess
the gjk intial guess set by user
Definition: collision_data.h:148
Eigen::Vector2i support_func_guess_t
Definition: data_types.h:76
FCL_REAL break_distance
Distance below which bounding volumes are broken down. See Collision detection and distance lower bou...
Definition: collision_data.h:208
FCL_REAL rel_err
error threshold for approximate distance
Definition: collision_data.h:330
CollisionRequest()
Definition: collision_data.h:227
bool enable_nearest_points
whether to return the nearest points
Definition: collision_data.h:327
bool enable_distance_lower_bound
Whether a lower bound on distance is returned when objects are disjoint.
Definition: collision_data.h:200
CollisionResult()
Definition: collision_data.h:254
const Contact & getContact(size_t i) const
get the i-th contact calculated
Definition: collision_data.h:292
CollisionRequestFlag operator &(CollisionRequestFlag a, CollisionRequestFlag b)
Definition: collision_data.h:492
Definition: collision_data.h:186
bool enable_contact
whether the contact information (normal, penetration depth and contact position) will return ...
Definition: collision_data.h:197
Vec3f cached_gjk_guess
stores the last GJK ray when relevant.
Definition: collision_data.h:166
bool isCollision() const
return binary collision result
Definition: collision_data.h:280
base class for all query requests
Definition: collision_data.h:142
CollisionRequestFlag operator~(CollisionRequestFlag a)
Definition: collision_data.h:486
Definition: collision_data.h:187
Eigen::Matrix< FCL_REAL, 3, 1 > Vec3f
Definition: data_types.h:74
void update(FCL_REAL distance, const CollisionGeometry *o1_, const CollisionGeometry *o2_, int b1_, int b2_)
add distance information into the result
Definition: collision_data.h:405
void update(FCL_REAL distance, const CollisionGeometry *o1_, const CollisionGeometry *o2_, int b1_, int b2_, const Vec3f &p1, const Vec3f &p2, const Vec3f &normal_)
add distance information into the result
Definition: collision_data.h:418
The geometry for the object for collision or distance computation.
Definition: collision_object.h:63
FCL_REAL abs_err
Definition: collision_data.h:331
const CollisionGeometry * o2
collision object 2
Definition: collision_data.h:378
DistanceRequest(bool enable_nearest_points_=false, FCL_REAL rel_err_=0.0, FCL_REAL abs_err_=0.0)
Definition: collision_data.h:347
#define HPP_FCL_DLLAPI
Definition: config.hh:64
distance result
Definition: collision_data.h:360
FCL_REAL security_margin
Distance below which objects are considered in collision. See Collision detection and distance lower ...
Definition: collision_data.h:204