hpp-fcl
2.4.1
HPP fork of FCL -- The Flexible Collision Library
|
Go to the documentation of this file.
38 #ifndef HPP_FCL_COLLISION_DATA_H
39 #define HPP_FCL_COLLISION_DATA_H
83 static const int NONE = -1;
86 Contact() : o1(NULL), o2(NULL), b1(NONE), b2(NONE) {}
90 : o1(o1_), o2(o2_), b1(b1_), b2(b2_) {}
100 penetration_depth(depth_) {}
103 if (b1 == other.
b1)
return b2 < other.
b2;
104 return b1 < other.
b1;
108 return o1 == other.
o1 && o2 == other.
o2 && b1 == other.
b1 &&
109 b2 == other.
b2 && normal == other.
normal && pos == other.
pos &&
126 bool enable_cached_gjk_guess;
141 size_t gjk_max_iterations;
160 enable_cached_gjk_guess(false),
165 gjk_max_iterations(128),
166 cached_gjk_guess(1, 0, 0),
168 enable_timings(false),
169 collision_distance_threshold(
170 Eigen::NumTraits<
FCL_REAL>::dummy_precision()) {}
206 : cached_gjk_guess(
Vec3f::Zero()),
271 : num_max_contacts(num_max_contacts_),
272 enable_contact(flag &
CONTACT),
275 break_distance(1e-3),
276 distance_upper_bound((std::numeric_limits<
FCL_REAL>::max)()) {}
280 : num_max_contacts(1),
281 enable_contact(false),
282 enable_distance_lower_bound(false),
284 break_distance(1e-3),
285 distance_upper_bound((std::numeric_limits<
FCL_REAL>::max)()) {}
305 std::vector<Contact> contacts;
321 : distance_lower_bound((std::numeric_limits<
FCL_REAL>::max)()) {}
325 if (distance_lower_bound_ < distance_lower_bound)
326 distance_lower_bound = distance_lower_bound_;
334 return contacts == other.contacts &&
346 if (contacts.size() == 0)
347 throw std::invalid_argument(
348 "The number of contacts is zero. No Contact can be returned.");
350 if (i < contacts.size())
353 return contacts.back();
358 if (contacts.size() == 0)
359 throw std::invalid_argument(
360 "The number of contacts is zero. No Contact can be returned.");
362 if (i < contacts.size())
370 contacts_.resize(contacts.size());
371 std::copy(contacts.begin(), contacts.end(), contacts_.begin());
374 const std::vector<Contact>&
getContacts()
const {
return contacts; }
378 distance_lower_bound = (std::numeric_limits<FCL_REAL>::max)();
380 distance_lower_bound = (std::numeric_limits<FCL_REAL>::max)();
389 struct DistanceResult;
405 : enable_nearest_points(enable_nearest_points_),
451 static const int NONE = -1;
454 FCL_REAL min_distance_ = (std::numeric_limits<FCL_REAL>::max)())
455 : min_distance(min_distance_), o1(NULL), o2(NULL), b1(NONE), b2(NONE) {
457 Vec3f::Constant(std::numeric_limits<FCL_REAL>::quiet_NaN()));
458 nearest_points[0] = nearest_points[1] = normal = nan;
483 nearest_points[0] = p1;
484 nearest_points[1] = p2;
493 o1 = other_result.
o1;
494 o2 = other_result.
o2;
495 b1 = other_result.
b1;
496 b2 = other_result.
b2;
499 normal = other_result.
normal;
506 Vec3f::Constant(std::numeric_limits<FCL_REAL>::quiet_NaN()));
507 min_distance = (std::numeric_limits<FCL_REAL>::max)();
512 nearest_points[0] = nearest_points[1] = normal = nan;
521 normal == other.
normal && o1 == other.
o1 && o2 == other.
o2 &&
522 b1 == other.
b1 && b2 == other.
b2;
525 if ((o1 != NULL) ^ (other.
o1 != NULL))
return false;
526 is_same &= (o1 == other.
o1);
529 if ((o2 != NULL) ^ (other.
o2 != NULL))
return false;
530 is_same &= (o2 == other.
o2);
540 const FCL_REAL& sqrDistLowerBound) {
543 FCL_REAL new_dlb = std::sqrt(sqrDistLowerBound);
566 static_cast<int>(b));
572 static_cast<int>(b));
578 static_cast<int>(b));
#define HPP_FCL_DLLAPI
Definition: config.hh:88
CollisionRequestFlag & operator&=(CollisionRequestFlag &a, CollisionRequestFlag b)
Definition: collision_data.h:586
@ CachedGuess
Definition: data_types.h:80
int b2
information about the nearest point in object 2 if object 2 is mesh or point cloud,...
Definition: collision_data.h:448
GJKConvergenceCriterionType
Wether the convergence criterion is scaled on the norm of the solution or not.
Definition: data_types.h:93
void addContact(const Contact &c)
add one contact into result structure
Definition: collision_data.h:330
Eigen::Matrix< FCL_REAL, 3, 1 > Vec3f
Definition: data_types.h:66
CollisionRequestFlag operator|(CollisionRequestFlag a, CollisionRequestFlag b)
Definition: collision_data.h:563
void updateDistanceLowerBoundFromLeaf(const CollisionRequest &, CollisionResult &res, const FCL_REAL &distance, const Vec3f &p0, const Vec3f &p1)
Definition: collision_data.h:547
FCL_REAL break_distance
Distance below which bounding volumes are broken down. See Collision.
Definition: collision_data.h:255
Vec3f nearest_points[2]
nearest points
Definition: collision_data.h:427
@ VDB
Definition: data_types.h:89
CollisionRequest()
Default constructor.
Definition: collision_data.h:279
#define HPP_FCL_COMPILER_DIAGNOSTIC_PUSH
Definition: fwd.hh:82
void updateGuess(const QueryResult &result)
Definition: collision_data.h:210
bool operator==(const QueryRequest &other) const
whether two QueryRequest are the same or not
Definition: collision_data.h:182
bool enable_distance_lower_bound
Whether a lower bound on distance is returned when objects are disjoint.
Definition: collision_data.h:244
Vec3f nearest_points[2]
nearest points available only when distance_lower_bound is inferior to CollisionRequest::break_distan...
Definition: collision_data.h:317
bool operator==(const CollisionRequest &other) const
whether two CollisionRequest are the same or not
Definition: collision_data.h:290
@ DefaultGJK
Definition: data_types.h:83
#define HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS
Definition: fwd.hh:84
@ CONTACT
Definition: collision_data.h:229
GJKConvergenceCriterion
Which convergence criterion is used to stop the algorithm (when the shapes are not in collision)....
Definition: data_types.h:89
const Contact & getContact(size_t i) const
get the i-th contact calculated
Definition: collision_data.h:345
size_t numContacts() const
number of contacts found
Definition: collision_data.h:342
base class for all query results
Definition: collision_data.h:195
QueryResult()
Definition: collision_data.h:205
const CollisionGeometry * o1
collision object 1
Definition: collision_data.h:433
GJKInitialGuess gjk_initial_guess
Definition: collision_data.h:121
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:581
#define HPP_FCL_DEPRECATED_MESSAGE(message)
Definition: deprecated.hh:38
The geometry for the object for collision or distance computation.
Definition: collision_object.h:95
FCL_REAL abs_err
Definition: collision_data.h:398
void clear()
clear the result
Definition: collision_data.h:504
double FCL_REAL
Definition: data_types.h:65
DistanceResult(FCL_REAL min_distance_=(std::numeric_limits< FCL_REAL >::max)())
Definition: collision_data.h:453
void updateDistanceLowerBoundFromBV(const CollisionRequest &, CollisionResult &res, const FCL_REAL &sqrDistLowerBound)
Definition: collision_data.h:538
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:430
CollisionRequestFlag
flag declaration for specifying required params in CollisionResult
Definition: collision_data.h:228
CollisionRequest(const CollisionRequestFlag flag, size_t num_max_contacts_)
Constructor from a flag and a maximal number of contacts.
Definition: collision_data.h:270
int b1
information about the nearest point in object 1 if object 1 is mesh or point cloud,...
Definition: collision_data.h:442
CPUTimes timings
timings for the given request
Definition: collision_data.h:203
DistanceRequest(bool enable_nearest_points_=false, FCL_REAL rel_err_=0.0, FCL_REAL abs_err_=0.0)
Definition: collision_data.h:403
FCL_REAL security_margin
Distance below which objects are considered in collision. See Collision.
Definition: collision_data.h:251
bool enable_contact
whether the contact information (normal, penetration depth and contact position) will return
Definition: collision_data.h:241
Eigen::Vector2i support_func_guess_t
Definition: data_types.h:72
CollisionResult()
Definition: collision_data.h:320
#define HPP_FCL_COMPILER_DIAGNOSTIC_POP
Definition: fwd.hh:83
Vec3f cached_gjk_guess
the gjk initial guess set by user
Definition: collision_data.h:144
void setContact(size_t i, const Contact &c)
set the i-th contact calculated
Definition: collision_data.h:357
void clear()
clear the results obtained
Definition: collision_data.h:377
Main namespace.
Definition: broadphase_bruteforce.h:44
request to the collision algorithm
Definition: collision_data.h:235
Vec3f cached_gjk_guess
stores the last GJK ray when relevant.
Definition: collision_data.h:197
collision result
Definition: collision_data.h:302
bool isCollision() const
return binary collision result
Definition: collision_data.h:339
@ Relative
Definition: data_types.h:93
FCL_REAL min_distance
minimum distance between two objects. if two objects are in collision, min_distance <= 0.
Definition: collision_data.h:424
bool enable_cached_gjk_guess
whether enable gjk initial guess @Deprecated Use gjk_initial_guess instead
Definition: collision_data.h:126
size_t num_max_contacts
The maximum number of contacts will return.
Definition: collision_data.h:237
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:474
GJKInitialGuess
Initial guess to use for the GJK algorithm DefaultGuess: Vec3f(1, 0, 0) CachedGuess: previous vector ...
Definition: data_types.h:80
CollisionRequestFlag operator^(CollisionRequestFlag a, CollisionRequestFlag b)
Definition: collision_data.h:575
bool operator==(const DistanceResult &other) const
whether two DistanceResult are the same or not
Definition: collision_data.h:517
support_func_guess_t cached_support_func_guess
the support function initial guess set by user
Definition: collision_data.h:147
request to the distance computation
Definition: collision_data.h:392
CollisionRequestFlag operator&(CollisionRequestFlag a, CollisionRequestFlag b)
Definition: collision_data.h:569
FCL_REAL rel_err
error threshold for approximate distance
Definition: collision_data.h:397
CollisionRequestFlag operator~(CollisionRequestFlag a)
Definition: collision_data.h:559
@ DefaultGuess
Definition: data_types.h:80
distance result
Definition: collision_data.h:420
const std::vector< Contact > & getContacts() const
Definition: collision_data.h:374
CollisionRequestFlag & operator^=(CollisionRequestFlag &a, CollisionRequestFlag b)
Definition: collision_data.h:591
const CollisionGeometry * o2
collision object 2
Definition: collision_data.h:436
bool operator==(const CollisionResult &other) const
whether two CollisionResult are the same or not
Definition: collision_data.h:333
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:462
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:263
base class for all query requests
Definition: collision_data.h:119
bool enable_nearest_points
whether to return the nearest points
Definition: collision_data.h:394
void getContacts(std::vector< Contact > &contacts_) const
get all the contacts
Definition: collision_data.h:369
support_func_guess_t cached_support_func_guess
stores the last support function vertex index, when relevant.
Definition: collision_data.h:200
void update(const DistanceResult &other_result)
add distance information into the result
Definition: collision_data.h:490
@ DISTANCE_LOWER_BOUND
Definition: collision_data.h:230
bool operator==(const DistanceRequest &other) const
whether two DistanceRequest are the same or not
Definition: collision_data.h:412
GJKVariant
Variant to use for the GJK algorithm.
Definition: data_types.h:83
void updateDistanceLowerBound(const FCL_REAL &distance_lower_bound_)
Update the lower bound only if the distance is inferior.
Definition: collision_data.h:324
FCL_REAL distance_lower_bound
Definition: collision_data.h:312
@ NO_REQUEST
Definition: collision_data.h:231