hpp-fcl
1.7.4
HPP fork of FCL -- The Flexible Collision Library
|
Go to the documentation of this file.
39 #ifndef HPP_FCL_COLLISION_DATA_H
40 #define HPP_FCL_COLLISION_DATA_H
87 static const int NONE = -1;
108 penetration_depth(depth_)
114 return b2 < other.
b2;
115 return b1 < other.
b1;
120 return o1 == other.
o1
131 return !(*
this == other);
153 enable_cached_gjk_guess (false),
154 cached_gjk_guess (1,0,0),
156 enable_timings(false)
184 : cached_gjk_guess(
Vec3f::Zero())
234 num_max_contacts(num_max_contacts_),
235 enable_contact(flag &
CONTACT),
238 break_distance (1e-3),
239 distance_upper_bound ((std::numeric_limits<
FCL_REAL>::max)())
245 enable_contact(false),
246 enable_distance_lower_bound (false),
248 break_distance (1e-3),
249 distance_upper_bound ((std::numeric_limits<
FCL_REAL>::max)())
273 std::vector<Contact> contacts;
284 : distance_lower_bound ((std::numeric_limits<
FCL_REAL>::max)())
291 if (distance_lower_bound_ < distance_lower_bound)
292 distance_lower_bound = distance_lower_bound_;
298 contacts.push_back(c);
304 return contacts == other.contacts
311 return contacts.size() > 0;
317 return contacts.size();
323 if(contacts.size() == 0)
324 throw std::invalid_argument(
"The number of contacts is zero. No Contact can be returned.");
326 if(i < contacts.size())
329 return contacts.back();
335 contacts_.resize(contacts.size());
336 std::copy(contacts.begin(), contacts.end(), contacts_.begin());
347 distance_lower_bound = (std::numeric_limits<FCL_REAL>::max)();
349 distance_lower_bound = (std::numeric_limits<FCL_REAL>::max)();
358 struct DistanceResult;
376 enable_nearest_points(enable_nearest_points_),
428 static const int NONE = -1;
431 (std::numeric_limits<FCL_REAL>::max)()):
432 min_distance(min_distance_), o1(NULL), o2(NULL), b1(NONE), b2(NONE)
434 const Vec3f nan (Vec3f::Constant(std::numeric_limits<FCL_REAL>::quiet_NaN()));
435 nearest_points [0] = nearest_points [1] = normal = nan;
464 nearest_points[0] = p1;
465 nearest_points[1] = p2;
476 o1 = other_result.
o1;
477 o2 = other_result.
o2;
478 b1 = other_result.
b1;
479 b2 = other_result.
b2;
482 normal = other_result.
normal;
489 const Vec3f nan (Vec3f::Constant(std::numeric_limits<FCL_REAL>::quiet_NaN()));
490 min_distance = (std::numeric_limits<FCL_REAL>::max)();
495 nearest_points [0] = nearest_points [1] = normal = nan;
512 if ((o1 != NULL) ^ (other.
o1 != NULL))
return false;
513 is_same &= (o1 == other.
o1);
516 if ((o2 != NULL) ^ (other.
o2 != NULL))
return false;
517 is_same &= (o2 == other.
o2);
529 {
return static_cast<CollisionRequestFlag>(
static_cast<const int>(a) |
static_cast<const int>(b));}
532 {
return static_cast<CollisionRequestFlag>(
static_cast<const int>(a) &
static_cast<const int>(b));}
535 {
return static_cast<CollisionRequestFlag>(
static_cast<const int>(a) ^
static_cast<const int>(b));}
#define HPP_FCL_DLLAPI
Definition: config.hh:64
CollisionRequestFlag & operator&=(CollisionRequestFlag &a, CollisionRequestFlag b)
Definition: collision_data.h:540
int b2
information about the nearest point in object 2 if object 2 is mesh or point cloud,...
Definition: collision_data.h:425
void addContact(const Contact &c)
add one contact into result structure
Definition: collision_data.h:296
Eigen::Matrix< FCL_REAL, 3, 1 > Vec3f
Definition: data_types.h:67
CollisionRequestFlag operator|(CollisionRequestFlag a, CollisionRequestFlag b)
Definition: collision_data.h:528
FCL_REAL break_distance
Distance below which bounding volumes are broken down. See Collision detection and distance lower bou...
Definition: collision_data.h:225
Vec3f nearest_points[2]
nearest points
Definition: collision_data.h:404
CollisionRequest()
Definition: collision_data.h:243
void updateGuess(const QueryResult &result)
Definition: collision_data.h:189
bool operator==(const QueryRequest &other) const
whether two QueryRequest are the same or not
Definition: collision_data.h:162
bool enable_distance_lower_bound
Whether a lower bound on distance is returned when objects are disjoint.
Definition: collision_data.h:217
@ CONTACT
Definition: collision_data.h:202
const Contact & getContact(size_t i) const
get the i-th contact calculated
Definition: collision_data.h:321
size_t numContacts() const
number of contacts found
Definition: collision_data.h:315
base class for all query results
Definition: collision_data.h:172
QueryResult()
Definition: collision_data.h:183
const CollisionGeometry * o1
collision object 1
Definition: collision_data.h:410
FCL_REAL distance(const Matrix3f &R0, const Vec3f &T0, const kIOS &b1, const kIOS &b2, Vec3f *P=NULL, Vec3f *Q=NULL)
Approximate distance between two kIOS bounding volumes.
CollisionRequestFlag & operator|=(CollisionRequestFlag &a, CollisionRequestFlag b)
Definition: collision_data.h:537
The geometry for the object for collision or distance computation.
Definition: collision_object.h:65
FCL_REAL abs_err
Definition: collision_data.h:368
QueryRequest()
Definition: collision_data.h:152
void clear()
clear the result
Definition: collision_data.h:487
double FCL_REAL
Definition: data_types.h:66
DistanceResult(FCL_REAL min_distance_=(std::numeric_limits< FCL_REAL >::max)())
Definition: collision_data.h:430
bool enable_timings
enable timings when performing collision/distance request
Definition: collision_data.h:150
Vec3f normal
In case both objects are in collision, store the normal.
Definition: collision_data.h:407
CollisionRequestFlag
flag declaration for specifying required params in CollisionResult
Definition: collision_data.h:200
CollisionRequest(const CollisionRequestFlag flag, size_t num_max_contacts_)
Definition: collision_data.h:233
int b1
information about the nearest point in object 1 if object 1 is mesh or point cloud,...
Definition: collision_data.h:419
CPUTimes timings
timings for the given request
Definition: collision_data.h:181
DistanceRequest(bool enable_nearest_points_=false, FCL_REAL rel_err_=0.0, FCL_REAL abs_err_=0.0)
Definition: collision_data.h:373
FCL_REAL security_margin
Distance below which objects are considered in collision. See Collision detection and distance lower ...
Definition: collision_data.h:221
bool enable_contact
whether the contact information (normal, penetration depth and contact position) will return
Definition: collision_data.h:214
Eigen::Vector2i support_func_guess_t
Definition: data_types.h:71
CollisionResult()
Definition: collision_data.h:283
Vec3f cached_gjk_guess
the gjk intial guess set by user
Definition: collision_data.h:144
void clear()
clear the results obtained
Definition: collision_data.h:345
Main namespace.
Definition: AABB.h:43
request to the collision algorithm
Definition: collision_data.h:208
Vec3f cached_gjk_guess
stores the last GJK ray when relevant.
Definition: collision_data.h:175
collision result
Definition: collision_data.h:269
bool isCollision() const
return binary collision result
Definition: collision_data.h:309
FCL_REAL min_distance
minimum distance between two objects. if two objects are in collision, min_distance <= 0.
Definition: collision_data.h:401
bool enable_cached_gjk_guess
whether enable gjk intial guess
Definition: collision_data.h:141
size_t num_max_contacts
The maximum number of contacts will return.
Definition: collision_data.h:211
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:453
CollisionRequestFlag operator^(CollisionRequestFlag a, CollisionRequestFlag b)
Definition: collision_data.h:534
support_func_guess_t cached_support_func_guess
the support function intial guess set by user
Definition: collision_data.h:147
request to the distance computation
Definition: collision_data.h:361
CollisionRequestFlag operator&(CollisionRequestFlag a, CollisionRequestFlag b)
Definition: collision_data.h:531
FCL_REAL rel_err
error threshold for approximate distance
Definition: collision_data.h:367
CollisionRequestFlag operator~(CollisionRequestFlag a)
Definition: collision_data.h:525
distance result
Definition: collision_data.h:395
const std::vector< Contact > & getContacts() const
Definition: collision_data.h:339
CollisionRequestFlag & operator^=(CollisionRequestFlag &a, CollisionRequestFlag b)
Definition: collision_data.h:543
const CollisionGeometry * o2
collision object 2
Definition: collision_data.h:413
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:440
FCL_REAL distance_upper_bound
Distance above which GJK solver makes an early stopping. GJK stops searching for the closest points w...
Definition: collision_data.h:231
base class for all query requests
Definition: collision_data.h:138
bool enable_nearest_points
whether to return the nearest points
Definition: collision_data.h:364
void getContacts(std::vector< Contact > &contacts_) const
get all the contacts
Definition: collision_data.h:333
support_func_guess_t cached_support_func_guess
stores the last support function vertex index, when relevant.
Definition: collision_data.h:178
void update(const DistanceResult &other_result)
add distance information into the result
Definition: collision_data.h:471
@ DISTANCE_LOWER_BOUND
Definition: collision_data.h:203
void updateDistanceLowerBound(const FCL_REAL &distance_lower_bound_)
Update the lower bound only if the distance is inferior.
Definition: collision_data.h:289
FCL_REAL distance_lower_bound
Definition: collision_data.h:280
@ NO_REQUEST
Definition: collision_data.h:204