hpp-fcl  3.0.0
HPP fork of FCL -- The Flexible Collision Library
collision_data.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011-2014, Willow Garage, Inc.
5  * Copyright (c) 2014-2015, Open Source Robotics Foundation
6  * Copyright (c) 2024, INRIA
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of Open Source Robotics Foundation nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  */
36 
39 #ifndef HPP_FCL_COLLISION_DATA_H
40 #define HPP_FCL_COLLISION_DATA_H
41 
42 #include <vector>
43 #include <array>
44 #include <set>
45 #include <limits>
46 #include <numeric>
47 
49 #include "hpp/fcl/config.hh"
50 #include "hpp/fcl/data_types.h"
51 #include "hpp/fcl/timings.h"
53 #include "hpp/fcl/logging.h"
54 
55 namespace hpp {
56 namespace fcl {
57 
62 
65 
70  int b1;
71 
76  int b2;
77 
90 
100  std::array<Vec3f, 2> nearest_points;
101 
104 
107 
109  static const int NONE = -1;
110 
112  Contact() : o1(NULL), o2(NULL), b1(NONE), b2(NONE) {
113  penetration_depth = (std::numeric_limits<FCL_REAL>::max)();
114  nearest_points[0] = nearest_points[1] = normal = pos =
115  Vec3f::Constant(std::numeric_limits<FCL_REAL>::quiet_NaN());
116  }
117 
118  Contact(const CollisionGeometry* o1_, const CollisionGeometry* o2_, int b1_,
119  int b2_)
120  : o1(o1_), o2(o2_), b1(b1_), b2(b2_) {
121  penetration_depth = (std::numeric_limits<FCL_REAL>::max)();
122  nearest_points[0] = nearest_points[1] = normal = pos =
123  Vec3f::Constant(std::numeric_limits<FCL_REAL>::quiet_NaN());
124  }
125 
126  Contact(const CollisionGeometry* o1_, const CollisionGeometry* o2_, int b1_,
127  int b2_, const Vec3f& pos_, const Vec3f& normal_, FCL_REAL depth_)
128  : o1(o1_),
129  o2(o2_),
130  b1(b1_),
131  b2(b2_),
132  normal(normal_),
133  nearest_points{pos_ - (depth_ * normal_ / 2),
134  pos_ + (depth_ * normal_ / 2)},
135  pos(pos_),
136  penetration_depth(depth_) {}
137 
138  Contact(const CollisionGeometry* o1_, const CollisionGeometry* o2_, int b1_,
139  int b2_, const Vec3f& p1, const Vec3f& p2, const Vec3f& normal_,
140  FCL_REAL depth_)
141  : o1(o1_),
142  o2(o2_),
143  b1(b1_),
144  b2(b2_),
145  normal(normal_),
146  nearest_points{p1, p2},
147  pos((p1 + p2) / 2),
148  penetration_depth(depth_) {}
149 
150  bool operator<(const Contact& other) const {
151  if (b1 == other.b1) return b2 < other.b2;
152  return b1 < other.b1;
153  }
154 
155  bool operator==(const Contact& other) const {
156  return o1 == other.o1 && o2 == other.o2 && b1 == other.b1 &&
157  b2 == other.b2 && normal == other.normal && pos == other.pos &&
158  nearest_points[0] == other.nearest_points[0] &&
159  nearest_points[1] == other.nearest_points[1] &&
160  penetration_depth == other.penetration_depth;
161  }
162 
163  bool operator!=(const Contact& other) const { return !(*this == other); }
164 
165  FCL_REAL getDistanceToCollision(const CollisionRequest& request) const;
166 };
167 
168 struct QueryResult;
169 
172  // @brief Initial guess to use for the GJK algorithm
174 
177  HPP_FCL_DEPRECATED_MESSAGE(Use gjk_initial_guess instead)
178  bool enable_cached_gjk_guess;
179 
181  mutable Vec3f cached_gjk_guess;
182 
184  mutable support_func_guess_t cached_support_func_guess;
185 
187  size_t gjk_max_iterations;
188 
193  FCL_REAL gjk_tolerance;
194 
196  GJKVariant gjk_variant;
197 
199  GJKConvergenceCriterion gjk_convergence_criterion;
200 
202  GJKConvergenceCriterionType gjk_convergence_criterion_type;
203 
205  size_t epa_max_iterations;
206 
212  FCL_REAL epa_tolerance;
213 
215  bool enable_timings;
216 
218  FCL_REAL collision_distance_threshold;
219 
224  : gjk_initial_guess(GJKInitialGuess::DefaultGuess),
225  enable_cached_gjk_guess(false),
226  cached_gjk_guess(1, 0, 0),
227  cached_support_func_guess(support_func_guess_t::Zero()),
228  gjk_max_iterations(GJK_DEFAULT_MAX_ITERATIONS),
229  gjk_tolerance(GJK_DEFAULT_TOLERANCE),
230  gjk_variant(GJKVariant::DefaultGJK),
231  gjk_convergence_criterion(GJKConvergenceCriterion::Default),
232  gjk_convergence_criterion_type(GJKConvergenceCriterionType::Relative),
233  epa_max_iterations(EPA_DEFAULT_MAX_ITERATIONS),
234  epa_tolerance(EPA_DEFAULT_TOLERANCE),
235  enable_timings(false),
236  collision_distance_threshold(
237  Eigen::NumTraits<FCL_REAL>::dummy_precision()) {}
238 
240  QueryRequest(const QueryRequest& other) = default;
241 
243  QueryRequest& operator=(const QueryRequest& other) = default;
245 
251  void updateGuess(const QueryResult& result) const;
252 
254  inline bool operator==(const QueryRequest& other) const {
257  return gjk_initial_guess == other.gjk_initial_guess &&
258  enable_cached_gjk_guess == other.enable_cached_gjk_guess &&
259  gjk_variant == other.gjk_variant &&
260  gjk_convergence_criterion == other.gjk_convergence_criterion &&
261  gjk_convergence_criterion_type ==
263  gjk_tolerance == other.gjk_tolerance &&
264  gjk_max_iterations == other.gjk_max_iterations &&
265  cached_gjk_guess == other.cached_gjk_guess &&
266  cached_support_func_guess == other.cached_support_func_guess &&
267  epa_max_iterations == other.epa_max_iterations &&
268  epa_tolerance == other.epa_tolerance &&
269  enable_timings == other.enable_timings &&
270  collision_distance_threshold == other.collision_distance_threshold;
272  }
273 };
274 
279 
282 
285 
287  : cached_gjk_guess(Vec3f::Zero()),
288  cached_support_func_guess(support_func_guess_t::Constant(-1)) {}
289 };
290 
291 inline void QueryRequest::updateGuess(const QueryResult& result) const {
298  }
300 }
301 
302 struct CollisionResult;
303 
306  CONTACT = 0x00001,
308  NO_REQUEST = 0x01000
309 };
310 
315 
319 
321  HPP_FCL_DEPRECATED_MESSAGE(A lower bound on distance is always computed.)
322  bool enable_distance_lower_bound;
323 
329  FCL_REAL security_margin;
330 
333  FCL_REAL break_distance;
334 
341  FCL_REAL distance_upper_bound;
342 
350  CollisionRequest(const CollisionRequestFlag flag, size_t num_max_contacts_)
351  : num_max_contacts(num_max_contacts_),
352  enable_contact(flag & CONTACT),
353  enable_distance_lower_bound(flag & DISTANCE_LOWER_BOUND),
354  security_margin(0),
355  break_distance(1e-3),
356  distance_upper_bound((std::numeric_limits<FCL_REAL>::max)()) {}
357 
360  : num_max_contacts(1),
361  enable_contact(true),
362  enable_distance_lower_bound(false),
363  security_margin(0),
364  break_distance(1e-3),
365  distance_upper_bound((std::numeric_limits<FCL_REAL>::max)()) {}
367 
368  bool isSatisfied(const CollisionResult& result) const;
369 
371  inline bool operator==(const CollisionRequest& other) const {
374  return QueryRequest::operator==(other) &&
375  num_max_contacts == other.num_max_contacts &&
376  enable_contact == other.enable_contact &&
377  enable_distance_lower_bound == other.enable_distance_lower_bound &&
378  security_margin == other.security_margin &&
379  break_distance == other.break_distance &&
380  distance_upper_bound == other.distance_upper_bound;
382  }
383 };
384 
386  const CollisionRequest& request) const {
387  return penetration_depth - request.security_margin;
388 }
389 
392  private:
394  std::vector<Contact> contacts;
395 
396  public:
403 
407 
415  std::array<Vec3f, 2> nearest_points;
416 
417  public:
419  : distance_lower_bound((std::numeric_limits<FCL_REAL>::max)()) {
420  nearest_points[0] = nearest_points[1] = normal =
421  Vec3f::Constant(std::numeric_limits<FCL_REAL>::quiet_NaN());
422  }
423 
425  inline void updateDistanceLowerBound(const FCL_REAL& distance_lower_bound_) {
426  if (distance_lower_bound_ < distance_lower_bound)
427  distance_lower_bound = distance_lower_bound_;
428  }
429 
431  inline void addContact(const Contact& c) { contacts.push_back(c); }
432 
434  inline bool operator==(const CollisionResult& other) const {
435  return contacts == other.contacts &&
436  distance_lower_bound == other.distance_lower_bound &&
437  nearest_points[0] == other.nearest_points[0] &&
438  nearest_points[1] == other.nearest_points[1] &&
439  normal == other.normal;
440  }
441 
443  bool isCollision() const { return contacts.size() > 0; }
444 
446  size_t numContacts() const { return contacts.size(); }
447 
449  const Contact& getContact(size_t i) const {
450  if (contacts.size() == 0)
452  "The number of contacts is zero. No Contact can be returned.",
453  std::invalid_argument);
454 
455  if (i < contacts.size())
456  return contacts[i];
457  else
458  return contacts.back();
459  }
460 
462  void setContact(size_t i, const Contact& c) {
463  if (contacts.size() == 0)
465  "The number of contacts is zero. No Contact can be returned.",
466  std::invalid_argument);
467 
468  if (i < contacts.size())
469  contacts[i] = c;
470  else
471  contacts.back() = c;
472  }
473 
475  void getContacts(std::vector<Contact>& contacts_) const {
476  contacts_.resize(contacts.size());
477  std::copy(contacts.begin(), contacts.end(), contacts_.begin());
478  }
479 
480  const std::vector<Contact>& getContacts() const { return contacts; }
481 
483  void clear() {
484  distance_lower_bound = (std::numeric_limits<FCL_REAL>::max)();
485  contacts.clear();
486  timings.clear();
487  nearest_points[0] = nearest_points[1] = normal =
488  Vec3f::Constant(std::numeric_limits<FCL_REAL>::quiet_NaN());
489  }
490 
493  void swapObjects();
494 };
495 
513  public:
514  using Polygon = std::vector<Vec2f>;
515 
519 
529  enum PatchDirection { DEFAULT = 0, INVERTED = 1 };
530 
533 
546 
549  static constexpr size_t default_preallocated_size = 12;
550 
551  protected:
554 
555  public:
561  explicit ContactPatch(size_t preallocated_size = default_preallocated_size)
562  : tf(Transform3f::Identity()),
563  direction(PatchDirection::DEFAULT),
564  penetration_depth(0) {
565  this->m_points.reserve(preallocated_size);
566  }
567 
569  Vec3f getNormal() const {
570  if (this->direction == PatchDirection::INVERTED) {
571  return -this->tf.rotation().col(2);
572  }
573  return this->tf.rotation().col(2);
574  }
575 
577  size_t size() const { return this->m_points.size(); }
578 
584  void addPoint(const Vec3f& point_3d) {
585  const Vec3f point = this->tf.inverseTransform(point_3d);
586  this->m_points.emplace_back(point.template head<2>());
587  }
588 
590  Vec3f getPoint(const size_t i) const {
591  Vec3f point(0, 0, 0);
592  point.head<2>() = this->point(i);
593  point = tf.transform(point);
594  return point;
595  }
596 
600  Vec3f getPointShape1(const size_t i) const {
601  Vec3f point = this->getPoint(i);
602  point -= (this->penetration_depth / 2) * this->getNormal();
603  return point;
604  }
605 
609  Vec3f getPointShape2(const size_t i) const {
610  Vec3f point = this->getPoint(i);
611  point += (this->penetration_depth / 2) * this->getNormal();
612  return point;
613  }
614 
616  Polygon& points() { return this->m_points; }
617 
619  const Polygon& points() const { return this->m_points; }
620 
622  Vec2f& point(const size_t i) {
623  HPP_FCL_ASSERT(this->m_points.size() > 0, "Patch is empty.",
624  std::logic_error);
625  if (i < this->m_points.size()) {
626  return this->m_points[i];
627  }
628  return this->m_points.back();
629  }
630 
632  const Vec2f& point(const size_t i) const {
633  HPP_FCL_ASSERT(this->m_points.size() > 0, "Patch is empty.",
634  std::logic_error);
635  if (i < this->m_points.size()) {
636  return this->m_points[i];
637  }
638  return this->m_points.back();
639  }
640 
642  void clear() {
643  this->m_points.clear();
644  this->tf.setIdentity();
645  this->penetration_depth = 0;
646  }
647 
652  bool operator==(const ContactPatch& other) const {
653  return this->tf == other.tf && this->direction == other.direction &&
654  this->penetration_depth == other.penetration_depth &&
655  this->points() == other.points();
656  }
657 
660  bool isSame(const ContactPatch& other,
661  const FCL_REAL tol =
662  Eigen::NumTraits<FCL_REAL>::dummy_precision()) const {
663  // The x and y axis of the set are arbitrary, but the z axis is
664  // always the normal. The position of the origin of the frame is also
665  // arbitrary. So we only check if the normals are the same.
666  if (!this->getNormal().isApprox(other.getNormal(), tol)) {
667  return false;
668  }
669 
670  if (std::abs(this->penetration_depth - other.penetration_depth) > tol) {
671  return false;
672  }
673 
674  if (this->direction != other.direction) {
675  return false;
676  }
677 
678  if (this->size() != other.size()) {
679  return false;
680  }
681 
682  // Check all points of the contact patch.
683  for (size_t i = 0; i < this->size(); ++i) {
684  bool found = false;
685  const Vec3f pi = this->getPoint(i);
686  for (size_t j = 0; j < other.size(); ++j) {
687  const Vec3f other_pj = other.getPoint(j);
688  if (pi.isApprox(other_pj, tol)) {
689  found = true;
690  }
691  }
692  if (!found) {
693  return false;
694  }
695  }
696 
697  return true;
698  }
699 };
700 
707  ContactPatch& contact_patch) {
708  contact_patch.penetration_depth = contact.penetration_depth;
709  contact_patch.tf.translation() = contact.pos;
710  contact_patch.tf.rotation() =
712  contact_patch.direction = ContactPatch::PatchDirection::DEFAULT;
713 }
714 
724 
729 
730  protected:
736 
747 
748  public:
763  explicit ContactPatchRequest(size_t max_num_patch = 1,
764  size_t num_samples_curved_shapes =
766  FCL_REAL patch_tolerance = 1e-3)
767  : max_num_patch(max_num_patch) {
768  this->setNumSamplesCurvedShapes(num_samples_curved_shapes);
769  this->setPatchTolerance(patch_tolerance);
770  }
771 
773  explicit ContactPatchRequest(const CollisionRequest& collision_request,
774  size_t num_samples_curved_shapes =
776  FCL_REAL patch_tolerance = 1e-3)
777  : max_num_patch(collision_request.num_max_contacts) {
778  this->setNumSamplesCurvedShapes(num_samples_curved_shapes);
779  this->setPatchTolerance(patch_tolerance);
780  }
781 
783  void setNumSamplesCurvedShapes(const size_t num_samples_curved_shapes) {
784  if (num_samples_curved_shapes < 3) {
786  "`num_samples_curved_shapes` cannot be lower than 3. Setting it to "
787  "3 to prevent bugs.");
788  this->m_num_samples_curved_shapes = 3;
789  } else {
790  this->m_num_samples_curved_shapes = num_samples_curved_shapes;
791  }
792  }
793 
795  size_t getNumSamplesCurvedShapes() const {
796  return this->m_num_samples_curved_shapes;
797  }
798 
800  void setPatchTolerance(const FCL_REAL patch_tolerance) {
801  if (patch_tolerance < 0) {
803  "`patch_tolerance` cannot be negative. Setting it to 0 to prevent "
804  "bugs.");
805  this->m_patch_tolerance = Eigen::NumTraits<FCL_REAL>::dummy_precision();
806  } else {
807  this->m_patch_tolerance = patch_tolerance;
808  }
809  }
810 
812  FCL_REAL getPatchTolerance() const { return this->m_patch_tolerance; }
813 
815  bool operator==(const ContactPatchRequest& other) const {
816  return this->max_num_patch == other.max_num_patch &&
817  this->getNumSamplesCurvedShapes() ==
818  other.getNumSamplesCurvedShapes() &&
819  this->getPatchTolerance() == other.getPatchTolerance();
820  }
821 };
822 
825  using ContactPatchVector = std::vector<ContactPatch>;
826  using ContactPatchRef = std::reference_wrapper<ContactPatch>;
827  using ContactPatchRefVector = std::vector<ContactPatchRef>;
828 
829  protected:
837 
842 
845 
846  public:
848  ContactPatchResult() : m_id_available_patch(0) {
849  const size_t max_num_patch = 1;
850  const ContactPatchRequest request(max_num_patch);
851  this->set(request);
852  }
853 
855  explicit ContactPatchResult(const ContactPatchRequest& request)
856  : m_id_available_patch(0) {
857  this->set(request);
858  };
859 
861  size_t numContactPatches() const { return this->m_contact_patches.size(); }
862 
865  if (this->m_id_available_patch >= this->m_contact_patches_data.size()) {
867  "Trying to get an unused contact patch but all contact patches are "
868  "used. Increasing size of contact patches vector, at the cost of a "
869  "copy. You should increase `max_num_patch` in the "
870  "`ContactPatchRequest`.");
871  this->m_contact_patches_data.emplace_back(
872  this->m_contact_patches_data.back());
873  this->m_contact_patches_data.back().clear();
874  }
875  ContactPatch& contact_patch =
876  this->m_contact_patches_data[this->m_id_available_patch];
877  contact_patch.clear();
878  this->m_contact_patches.emplace_back(contact_patch);
879  ++(this->m_id_available_patch);
880  return this->m_contact_patches.back();
881  }
882 
884  const ContactPatch& getContactPatch(const size_t i) const {
885  if (this->m_contact_patches.empty()) {
887  "The number of contact patches is zero. No ContactPatch can be "
888  "returned.",
889  std::invalid_argument);
890  }
891  if (i < this->m_contact_patches.size()) {
892  return this->m_contact_patches[i];
893  }
894  return this->m_contact_patches.back();
895  }
896 
898  ContactPatch& contactPatch(const size_t i) {
899  if (this->m_contact_patches.empty()) {
901  "The number of contact patches is zero. No ContactPatch can be "
902  "returned.",
903  std::invalid_argument);
904  }
905  if (i < this->m_contact_patches.size()) {
906  return this->m_contact_patches[i];
907  }
908  return this->m_contact_patches.back();
909  }
910 
912  void clear() {
913  this->m_contact_patches.clear();
914  this->m_id_available_patch = 0;
915  for (ContactPatch& patch : this->m_contact_patches_data) {
916  patch.clear();
917  }
918  }
919 
921  void set(const ContactPatchRequest& request) {
922  if (this->m_contact_patches_data.size() < request.max_num_patch) {
923  this->m_contact_patches_data.resize(request.max_num_patch);
924  }
925  for (ContactPatch& patch : this->m_contact_patches_data) {
926  patch.points().reserve(request.getNumSamplesCurvedShapes());
927  }
928  this->clear();
929  }
930 
933  bool check(const ContactPatchRequest& request) const {
934  assert(this->m_contact_patches_data.size() >= request.max_num_patch);
935  if (this->m_contact_patches_data.size() < request.max_num_patch) {
936  return false;
937  }
938 
939  for (const ContactPatch& patch : this->m_contact_patches_data) {
940  if (patch.points().capacity() < request.getNumSamplesCurvedShapes()) {
941  assert(patch.points().capacity() >=
942  request.getNumSamplesCurvedShapes());
943  return false;
944  }
945  }
946  return true;
947  }
948 
950  bool operator==(const ContactPatchResult& other) const {
951  if (this->numContactPatches() != other.numContactPatches()) {
952  return false;
953  }
954 
955  for (size_t i = 0; i < this->numContactPatches(); ++i) {
956  const ContactPatch& patch = this->getContactPatch(i);
957  const ContactPatch& other_patch = other.getContactPatch(i);
958  if (!(patch == other_patch)) {
959  return false;
960  }
961  }
962 
963  return true;
964  }
965 
968  void swapObjects() {
969  // Create new transform: it's the reflection of `tf` along the z-axis.
970  // This corresponds to doing a PI rotation along the y-axis, i.e. the x-axis
971  // becomes -x-axis, y-axis stays the same, z-axis becomes -z-axis.
972  for (size_t i = 0; i < this->numContactPatches(); ++i) {
973  ContactPatch& patch = this->contactPatch(i);
974  patch.tf.rotation().col(0) *= -1.0;
975  patch.tf.rotation().col(2) *= -1.0;
976 
977  for (size_t j = 0; j < patch.size(); ++j) {
978  patch.point(i)(0) *= -1.0; // only invert the x-axis
979  }
980  }
981  }
982 };
983 
984 struct DistanceResult;
985 
992  Nearest points are always computed : they are the points of the shapes
993  that achieve a distance of
995  .\n Use `enable_signed_distance` if you want to compute a signed
996  minimum distance(and thus its corresponding nearest points)
997  .)
998  bool enable_nearest_points;
999 
1012  bool enable_signed_distance;
1013 
1015  FCL_REAL rel_err; // relative error, between 0 and 1
1016  FCL_REAL abs_err; // absolute error
1017 
1024  DistanceRequest(bool enable_nearest_points_ = true,
1025  bool enable_signed_distance_ = true, FCL_REAL rel_err_ = 0.0,
1026  FCL_REAL abs_err_ = 0.0)
1027  : enable_nearest_points(enable_nearest_points_),
1028  enable_signed_distance(enable_signed_distance_),
1029  rel_err(rel_err_),
1030  abs_err(abs_err_) {}
1032 
1033  bool isSatisfied(const DistanceResult& result) const;
1034 
1037  DistanceRequest& operator=(const DistanceRequest& other) = default;
1039 
1041  inline bool operator==(const DistanceRequest& other) const {
1044  return QueryRequest::operator==(other) &&
1045  enable_nearest_points == other.enable_nearest_points &&
1046  enable_signed_distance == other.enable_signed_distance &&
1047  rel_err == other.rel_err && abs_err == other.abs_err;
1049  }
1050 };
1051 
1054  public:
1061 
1064 
1067  std::array<Vec3f, 2> nearest_points;
1068 
1071 
1074 
1079  int b1;
1080 
1085  int b2;
1086 
1088  static const int NONE = -1;
1089 
1091  FCL_REAL min_distance_ = (std::numeric_limits<FCL_REAL>::max)())
1092  : min_distance(min_distance_), o1(NULL), o2(NULL), b1(NONE), b2(NONE) {
1093  const Vec3f nan(
1094  Vec3f::Constant(std::numeric_limits<FCL_REAL>::quiet_NaN()));
1095  nearest_points[0] = nearest_points[1] = normal = nan;
1096  }
1097 
1100  const CollisionGeometry* o2_, int b1_, int b2_) {
1101  if (min_distance > distance) {
1102  min_distance = distance;
1103  o1 = o1_;
1104  o2 = o2_;
1105  b1 = b1_;
1106  b2 = b2_;
1107  }
1108  }
1109 
1112  const CollisionGeometry* o2_, int b1_, int b2_, const Vec3f& p1,
1113  const Vec3f& p2, const Vec3f& normal_) {
1114  if (min_distance > distance) {
1115  min_distance = distance;
1116  o1 = o1_;
1117  o2 = o2_;
1118  b1 = b1_;
1119  b2 = b2_;
1120  nearest_points[0] = p1;
1121  nearest_points[1] = p2;
1122  normal = normal_;
1123  }
1124  }
1125 
1127  void update(const DistanceResult& other_result) {
1128  if (min_distance > other_result.min_distance) {
1129  min_distance = other_result.min_distance;
1130  o1 = other_result.o1;
1131  o2 = other_result.o2;
1132  b1 = other_result.b1;
1133  b2 = other_result.b2;
1134  nearest_points[0] = other_result.nearest_points[0];
1135  nearest_points[1] = other_result.nearest_points[1];
1136  normal = other_result.normal;
1137  }
1138  }
1139 
1141  void clear() {
1142  const Vec3f nan(
1143  Vec3f::Constant(std::numeric_limits<FCL_REAL>::quiet_NaN()));
1144  min_distance = (std::numeric_limits<FCL_REAL>::max)();
1145  o1 = NULL;
1146  o2 = NULL;
1147  b1 = NONE;
1148  b2 = NONE;
1149  nearest_points[0] = nearest_points[1] = normal = nan;
1150  timings.clear();
1151  }
1152 
1154  inline bool operator==(const DistanceResult& other) const {
1155  bool is_same = min_distance == other.min_distance &&
1156  nearest_points[0] == other.nearest_points[0] &&
1157  nearest_points[1] == other.nearest_points[1] &&
1158  normal == other.normal && o1 == other.o1 && o2 == other.o2 &&
1159  b1 == other.b1 && b2 == other.b2;
1160 
1161  // TODO: check also that two GeometryObject are indeed equal.
1162  if ((o1 != NULL) ^ (other.o1 != NULL)) return false;
1163  is_same &= (o1 == other.o1);
1164  // else if (o1 != NULL and other.o1 != NULL) is_same &= *o1 ==
1165  // *other.o1;
1166 
1167  if ((o2 != NULL) ^ (other.o2 != NULL)) return false;
1168  is_same &= (o2 == other.o2);
1169  // else if (o2 != NULL and other.o2 != NULL) is_same &= *o2 ==
1170  // *other.o2;
1171 
1172  return is_same;
1173  }
1174 };
1175 
1176 namespace internal {
1178  CollisionResult& res,
1179  const FCL_REAL sqrDistLowerBound) {
1180  // BV cannot find negative distance.
1181  if (res.distance_lower_bound <= 0) return;
1182  FCL_REAL new_dlb = std::sqrt(sqrDistLowerBound); // - req.security_margin;
1183  if (new_dlb < res.distance_lower_bound) res.distance_lower_bound = new_dlb;
1184 }
1185 
1187  CollisionResult& res,
1188  const FCL_REAL& distance,
1189  const Vec3f& p0, const Vec3f& p1,
1190  const Vec3f& normal) {
1191  if (distance < res.distance_lower_bound) {
1193  res.nearest_points[0] = p0;
1194  res.nearest_points[1] = p1;
1195  res.normal = normal;
1196  }
1197 }
1198 } // namespace internal
1199 
1201  return static_cast<CollisionRequestFlag>(~static_cast<int>(a));
1202 }
1203 
1206  return static_cast<CollisionRequestFlag>(static_cast<int>(a) |
1207  static_cast<int>(b));
1208 }
1209 
1212  return static_cast<CollisionRequestFlag>(static_cast<int>(a) &
1213  static_cast<int>(b));
1214 }
1215 
1218  return static_cast<CollisionRequestFlag>(static_cast<int>(a) ^
1219  static_cast<int>(b));
1220 }
1221 
1224  return (CollisionRequestFlag&)((int&)(a) |= static_cast<int>(b));
1225 }
1226 
1229  return (CollisionRequestFlag&)((int&)(a) &= static_cast<int>(b));
1230 }
1231 
1234  return (CollisionRequestFlag&)((int&)(a) ^= static_cast<int>(b));
1235 }
1236 
1237 } // namespace fcl
1238 
1239 } // namespace hpp
1240 
1241 #endif
The geometry for the object for collision or distance computation.
Definition: collision_object.h:95
Simple transform class used locally by InterpMotion.
Definition: transform.h:56
const Matrix3f & rotation() const
get rotation
Definition: transform.h:114
const Vec3f & translation() const
get translation
Definition: transform.h:105
Vec3f transform(const Eigen::MatrixBase< Derived > &v) const
transform a given vector by the transform
Definition: transform.h:153
Vec3f inverseTransform(const Eigen::MatrixBase< Derived > &v) const
transform a given vector by the inverse of the transform
Definition: transform.h:159
void setIdentity()
set the transform to be identity transform
Definition: transform.h:200
#define HPP_FCL_DLLAPI
Definition: config.hh:88
#define HPP_FCL_DEPRECATED_MESSAGE(message)
Definition: deprecated.hh:38
#define HPP_FCL_ASSERT(check, message, exception)
Definition: fwd.hh:82
#define HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS
Definition: fwd.hh:122
#define HPP_FCL_COMPILER_DIAGNOSTIC_PUSH
Definition: fwd.hh:120
#define HPP_FCL_COMPILER_DIAGNOSTIC_POP
Definition: fwd.hh:121
#define HPP_FCL_THROW_PRETTY(message, exception)
Definition: fwd.hh:64
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.
#define HPP_FCL_LOG_WARNING(message)
Definition: logging.h:50
void updateDistanceLowerBoundFromLeaf(const CollisionRequest &, CollisionResult &res, const FCL_REAL &distance, const Vec3f &p0, const Vec3f &p1, const Vec3f &normal)
Definition: collision_data.h:1186
void updateDistanceLowerBoundFromBV(const CollisionRequest &, CollisionResult &res, const FCL_REAL sqrDistLowerBound)
Definition: collision_data.h:1177
CollisionRequestFlag operator&(CollisionRequestFlag a, CollisionRequestFlag b)
Definition: collision_data.h:1210
Matrix3f constructOrthonormalBasisFromVector(const Vec3f &vec)
Construct othonormal basis from vector. The z-axis is the normalized input vector.
Definition: transform.h:261
CollisionRequestFlag & operator^=(CollisionRequestFlag &a, CollisionRequestFlag b)
Definition: collision_data.h:1232
GJKVariant
Variant to use for the GJK algorithm.
Definition: data_types.h:88
@ DefaultGJK
Definition: data_types.h:88
Eigen::Matrix< FCL_REAL, 3, 1 > Vec3f
Definition: data_types.h:67
CollisionRequestFlag & operator&=(CollisionRequestFlag &a, CollisionRequestFlag b)
Definition: collision_data.h:1227
CollisionRequestFlag operator~(CollisionRequestFlag a)
Definition: collision_data.h:1200
GJKConvergenceCriterionType
Wether the convergence criterion is scaled on the norm of the solution or not.
Definition: data_types.h:98
@ Relative
Definition: data_types.h:98
CollisionRequestFlag
flag declaration for specifying required params in CollisionResult
Definition: collision_data.h:305
@ NO_REQUEST
Definition: collision_data.h:308
@ DISTANCE_LOWER_BOUND
Definition: collision_data.h:307
@ CONTACT
Definition: collision_data.h:306
Eigen::Matrix< FCL_REAL, 2, 1 > Vec2f
Definition: data_types.h:68
void constructContactPatchFrameFromContact(const Contact &contact, ContactPatch &contact_patch)
Construct a frame from a Contact's position and normal. Because both Contact's position and normal ar...
Definition: collision_data.h:706
GJKConvergenceCriterion
Which convergence criterion is used to stop the algorithm (when the shapes are not in collision)....
Definition: data_types.h:94
@ Default
Definition: data_types.h:94
CollisionRequestFlag operator^(CollisionRequestFlag a, CollisionRequestFlag b)
Definition: collision_data.h:1216
GJKInitialGuess
Initial guess to use for the GJK algorithm DefaultGuess: Vec3f(1, 0, 0) CachedGuess: previous vector ...
Definition: data_types.h:85
@ CachedGuess
Definition: data_types.h:85
@ DefaultGuess
Definition: data_types.h:85
constexpr size_t GJK_DEFAULT_MAX_ITERATIONS
GJK.
Definition: narrowphase_defaults.h:47
constexpr size_t EPA_DEFAULT_MAX_ITERATIONS
Definition: narrowphase_defaults.h:60
constexpr FCL_REAL EPA_DEFAULT_TOLERANCE
Definition: narrowphase_defaults.h:61
constexpr FCL_REAL GJK_DEFAULT_TOLERANCE
Definition: narrowphase_defaults.h:48
CollisionRequestFlag operator|(CollisionRequestFlag a, CollisionRequestFlag b)
Definition: collision_data.h:1204
double FCL_REAL
Definition: data_types.h:66
Eigen::Vector2i support_func_guess_t
Definition: data_types.h:77
CollisionRequestFlag & operator|=(CollisionRequestFlag &a, CollisionRequestFlag b)
Definition: collision_data.h:1222
Main namespace.
Definition: broadphase_bruteforce.h:44
Definition: timings.h:17
request to the collision algorithm
Definition: collision_data.h:312
size_t num_max_contacts
The maximum number of contacts that can be returned.
Definition: collision_data.h:314
bool enable_distance_lower_bound
Whether a lower bound on distance is returned when objects are disjoint.
Definition: collision_data.h:322
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:341
FCL_REAL security_margin
Distance below which objects are considered in collision. See Collision.
Definition: collision_data.h:329
bool enable_contact
whether the contact information (normal, penetration depth and contact position) will return.
Definition: collision_data.h:318
bool isSatisfied(const CollisionResult &result) const
bool operator==(const CollisionRequest &other) const
whether two CollisionRequest are the same or not
Definition: collision_data.h:371
CollisionRequest()
Default constructor.
Definition: collision_data.h:359
FCL_REAL break_distance
Distance below which bounding volumes are broken down. See Collision.
Definition: collision_data.h:333
collision result
Definition: collision_data.h:391
std::array< Vec3f, 2 > nearest_points
nearest points. A CollisionResult can have multiple contacts. The nearest points in CollisionResults ...
Definition: collision_data.h:415
void clear()
clear the results obtained
Definition: collision_data.h:483
void updateDistanceLowerBound(const FCL_REAL &distance_lower_bound_)
Update the lower bound only if the distance is inferior.
Definition: collision_data.h:425
void addContact(const Contact &c)
add one contact into result structure
Definition: collision_data.h:431
const Contact & getContact(size_t i) const
get the i-th contact calculated
Definition: collision_data.h:449
bool isCollision() const
return binary collision result
Definition: collision_data.h:443
const std::vector< Contact > & getContacts() const
Definition: collision_data.h:480
Vec3f normal
normal associated to nearest_points. Same as CollisionResult::nearest_points but for the normal.
Definition: collision_data.h:406
void getContacts(std::vector< Contact > &contacts_) const
get all the contacts
Definition: collision_data.h:475
FCL_REAL distance_lower_bound
Definition: collision_data.h:402
void setContact(size_t i, const Contact &c)
set the i-th contact calculated
Definition: collision_data.h:462
bool operator==(const CollisionResult &other) const
whether two CollisionResult are the same or not
Definition: collision_data.h:434
CollisionResult()
Definition: collision_data.h:418
size_t numContacts() const
number of contacts found
Definition: collision_data.h:446
void swapObjects()
reposition Contact objects when fcl inverts them during their construction.
Request for a contact patch computation.
Definition: collision_data.h:726
bool operator==(const ContactPatchRequest &other) const
Whether two ContactPatchRequest are identical or not.
Definition: collision_data.h:815
void setNumSamplesCurvedShapes(const size_t num_samples_curved_shapes)
Maximum samples to compute the support sets of curved shapes, i.e. when the normal is perpendicular t...
Definition: collision_data.h:783
size_t m_num_samples_curved_shapes
Maximum samples to compute the support sets of curved shapes, i.e. when the normal is perpendicular t...
Definition: collision_data.h:735
ContactPatchRequest(const CollisionRequest &collision_request, size_t num_samples_curved_shapes=ContactPatch::default_preallocated_size, FCL_REAL patch_tolerance=1e-3)
Construct a contact patch request from a collision request.
Definition: collision_data.h:773
FCL_REAL m_patch_tolerance
Tolerance below which points are added to a contact patch. In details, given two shapes S1 and S2,...
Definition: collision_data.h:746
size_t getNumSamplesCurvedShapes() const
Maximum samples to compute the support sets of curved shapes, i.e. when the normal is perpendicular t...
Definition: collision_data.h:795
ContactPatchRequest(size_t max_num_patch=1, size_t num_samples_curved_shapes=ContactPatch::default_preallocated_size, FCL_REAL patch_tolerance=1e-3)
Default constructor.
Definition: collision_data.h:763
FCL_REAL getPatchTolerance() const
Tolerance below which points are added to a contact patch. In details, given two shapes S1 and S2,...
Definition: collision_data.h:812
size_t max_num_patch
Maximum number of contact patches that will be computed.
Definition: collision_data.h:728
void setPatchTolerance(const FCL_REAL patch_tolerance)
Tolerance below which points are added to a contact patch. In details, given two shapes S1 and S2,...
Definition: collision_data.h:800
Result for a contact patch computation.
Definition: collision_data.h:824
std::vector< ContactPatch > ContactPatchVector
Definition: collision_data.h:825
std::vector< ContactPatchRef > ContactPatchRefVector
Definition: collision_data.h:827
bool check(const ContactPatchRequest &request) const
Return true if this ContactPatchResult is aligned with the ContactPatchRequest given as input.
Definition: collision_data.h:933
ContactPatchRef getUnusedContactPatch()
Returns a new unused contact patch from the internal data vector.
Definition: collision_data.h:864
ContactPatchRefVector m_contact_patches
Vector of contact patches of the result.
Definition: collision_data.h:844
std::reference_wrapper< ContactPatch > ContactPatchRef
Definition: collision_data.h:826
ContactPatch & contactPatch(const size_t i)
Getter for the i-th contact patch of the result.
Definition: collision_data.h:898
size_t m_id_available_patch
Contact patches in m_contact_patches_data can have two statuses: used or unused. This index tracks th...
Definition: collision_data.h:841
const ContactPatch & getContactPatch(const size_t i) const
Const getter for the i-th contact patch of the result.
Definition: collision_data.h:884
ContactPatchResult()
Default constructor.
Definition: collision_data.h:848
void clear()
Clears the contact patch result.
Definition: collision_data.h:912
ContactPatchVector m_contact_patches_data
Data container for the vector of contact patches.
Definition: collision_data.h:836
size_t numContactPatches() const
Number of contact patches in the result.
Definition: collision_data.h:861
ContactPatchResult(const ContactPatchRequest &request)
Constructor using a ContactPatchRequest.
Definition: collision_data.h:855
void set(const ContactPatchRequest &request)
Set up a ContactPatchResult from a ContactPatchRequest
Definition: collision_data.h:921
bool operator==(const ContactPatchResult &other) const
Whether two ContactPatchResult are identical or not.
Definition: collision_data.h:950
void swapObjects()
Repositions the ContactPatch when they get inverted during their construction.
Definition: collision_data.h:968
This structure allows to encode contact patches. A contact patch is defined by a set of points belong...
Definition: collision_data.h:512
void addPoint(const Vec3f &point_3d)
Add a 3D point to the set, expressed in the world frame.
Definition: collision_data.h:584
Vec3f getNormal() const
Normal of the contact patch, expressed in the WORLD frame.
Definition: collision_data.h:569
Vec3f getPoint(const size_t i) const
Get the i-th point of the set, expressed in the 3D world frame.
Definition: collision_data.h:590
static constexpr size_t default_preallocated_size
Default maximum size of the polygon representing the contact patch. Used to pre-allocate memory for t...
Definition: collision_data.h:549
bool operator==(const ContactPatch &other) const
Whether two contact patches are the same or not.
Definition: collision_data.h:652
Transform3f tf
Frame of the set, expressed in the world coordinates. The z-axis of the frame's rotation is the conta...
Definition: collision_data.h:518
bool isSame(const ContactPatch &other, const FCL_REAL tol=Eigen::NumTraits< FCL_REAL >::dummy_precision()) const
Whether two contact patches are the same or not. Checks for different order of the points.
Definition: collision_data.h:660
PatchDirection direction
Direction of this contact patch.
Definition: collision_data.h:532
size_t size() const
Returns the number of points in the contact patch.
Definition: collision_data.h:577
void clear()
Clear the set.
Definition: collision_data.h:642
const Vec2f & point(const size_t i) const
Const getter for the i-th 2D point in the set.
Definition: collision_data.h:632
Polygon & points()
Getter for the 2D points in the set.
Definition: collision_data.h:616
Vec3f getPointShape1(const size_t i) const
Get the i-th point of the contact patch, projected back onto the first shape of the collision pair....
Definition: collision_data.h:600
ContactPatch(size_t preallocated_size=default_preallocated_size)
Default constructor. Note: the preallocated size does not determine the maximum number of points in t...
Definition: collision_data.h:561
PatchDirection
Direction of ContactPatch. When doing collision detection, the convention of HPP-FCL is that the norm...
Definition: collision_data.h:529
Vec2f & point(const size_t i)
Getter for the i-th 2D point in the set.
Definition: collision_data.h:622
Vec3f getPointShape2(const size_t i) const
Get the i-th point of the contact patch, projected back onto the first shape of the collision pair....
Definition: collision_data.h:609
FCL_REAL penetration_depth
Penetration depth of the contact patch. This value corresponds to the signed distance d between the s...
Definition: collision_data.h:545
const Polygon & points() const
Const getter for the 2D points in the set.
Definition: collision_data.h:619
std::vector< Vec2f > Polygon
Definition: collision_data.h:514
Polygon m_points
Container for the vertices of the set.
Definition: collision_data.h:553
Contact information returned by collision.
Definition: collision_data.h:59
FCL_REAL penetration_depth
penetration depth
Definition: collision_data.h:106
Contact()
Default constructor.
Definition: collision_data.h:112
std::array< Vec3f, 2 > nearest_points
nearest points associated to this contact.
Definition: collision_data.h:100
Vec3f pos
contact position, in world space
Definition: collision_data.h:103
FCL_REAL getDistanceToCollision(const CollisionRequest &request) const
Definition: collision_data.h:385
int b1
contact primitive in object 1 if object 1 is mesh or point cloud, it is the triangle or point id if o...
Definition: collision_data.h:70
Contact(const CollisionGeometry *o1_, const CollisionGeometry *o2_, int b1_, int b2_, const Vec3f &pos_, const Vec3f &normal_, FCL_REAL depth_)
Definition: collision_data.h:126
int b2
contact primitive in object 2 if object 2 is mesh or point cloud, it is the triangle or point id if o...
Definition: collision_data.h:76
bool operator==(const Contact &other) const
Definition: collision_data.h:155
Contact(const CollisionGeometry *o1_, const CollisionGeometry *o2_, int b1_, int b2_, const Vec3f &p1, const Vec3f &p2, const Vec3f &normal_, FCL_REAL depth_)
Definition: collision_data.h:138
const CollisionGeometry * o2
collision object 2
Definition: collision_data.h:64
const CollisionGeometry * o1
collision object 1
Definition: collision_data.h:61
Vec3f normal
contact normal, pointing from o1 to o2. The normal defined as the normalized separation vector: norma...
Definition: collision_data.h:89
bool operator!=(const Contact &other) const
Definition: collision_data.h:163
bool operator<(const Contact &other) const
Definition: collision_data.h:150
Contact(const CollisionGeometry *o1_, const CollisionGeometry *o2_, int b1_, int b2_)
Definition: collision_data.h:118
request to the distance computation
Definition: collision_data.h:987
bool enable_nearest_points
whether to return the nearest points. Nearest points are always computed and are the points of the sh...
Definition: collision_data.h:998
bool enable_signed_distance
whether to compute the penetration depth when objects are in collision. Turning this off can save com...
Definition: collision_data.h:1012
bool operator==(const DistanceRequest &other) const
whether two DistanceRequest are the same or not
Definition: collision_data.h:1041
FCL_REAL rel_err
error threshold for approximate distance
Definition: collision_data.h:1015
bool isSatisfied(const DistanceResult &result) const
DistanceRequest & operator=(const DistanceRequest &other)=default
FCL_REAL abs_err
Definition: collision_data.h:1016
distance result
Definition: collision_data.h:1053
const CollisionGeometry * o2
collision object 2
Definition: collision_data.h:1073
DistanceResult(FCL_REAL min_distance_=(std::numeric_limits< FCL_REAL >::max)())
Definition: collision_data.h:1090
bool operator==(const DistanceResult &other) const
whether two DistanceResult are the same or not
Definition: collision_data.h:1154
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:1099
void update(const DistanceResult &other_result)
add distance information into the result
Definition: collision_data.h:1127
std::array< Vec3f, 2 > nearest_points
nearest points. See CollisionResult::nearest_points.
Definition: collision_data.h:1067
Vec3f normal
normal.
Definition: collision_data.h:1063
const CollisionGeometry * o1
collision object 1
Definition: collision_data.h:1070
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:1111
int b2
information about the nearest point in object 2 if object 2 is mesh or point cloud,...
Definition: collision_data.h:1085
int b1
information about the nearest point in object 1 if object 1 is mesh or point cloud,...
Definition: collision_data.h:1079
void clear()
clear the result
Definition: collision_data.h:1141
FCL_REAL min_distance
minimum distance between two objects. If two objects are in collision and DistanceRequest::enable_sig...
Definition: collision_data.h:1060
base class for all query requests
Definition: collision_data.h:171
GJKVariant gjk_variant
whether to enable the Nesterov accleration of GJK
Definition: collision_data.h:196
Vec3f cached_gjk_guess
the gjk initial guess set by user
Definition: collision_data.h:181
bool operator==(const QueryRequest &other) const
whether two QueryRequest are the same or not
Definition: collision_data.h:254
GJKInitialGuess gjk_initial_guess
Definition: collision_data.h:173
GJKConvergenceCriterion gjk_convergence_criterion
convergence criterion used to stop GJK
Definition: collision_data.h:199
size_t gjk_max_iterations
maximum iteration for the GJK algorithm
Definition: collision_data.h:187
support_func_guess_t cached_support_func_guess
the support function initial guess set by user
Definition: collision_data.h:184
FCL_REAL gjk_tolerance
tolerance for the GJK algorithm. Note: This tolerance determines the precision on the estimated dista...
Definition: collision_data.h:193
size_t epa_max_iterations
max number of iterations for EPA
Definition: collision_data.h:205
void updateGuess(const QueryResult &result) const
Updates the guess for the internal GJK algorithm in order to warm-start it when reusing this collisio...
Definition: collision_data.h:291
QueryRequest & operator=(const QueryRequest &other)=default
Copy assignment operator.
bool enable_timings
enable timings when performing collision/distance request
Definition: collision_data.h:215
FCL_REAL epa_tolerance
tolerance for EPA. Note: This tolerance determines the precision on the estimated distance between tw...
Definition: collision_data.h:212
QueryRequest(const QueryRequest &other)=default
Copy constructor.
bool enable_cached_gjk_guess
whether enable gjk initial guess @Deprecated Use gjk_initial_guess instead
Definition: collision_data.h:178
FCL_REAL collision_distance_threshold
threshold below which a collision is considered.
Definition: collision_data.h:218
GJKConvergenceCriterionType gjk_convergence_criterion_type
convergence criterion used to stop GJK
Definition: collision_data.h:202
base class for all query results
Definition: collision_data.h:276
support_func_guess_t cached_support_func_guess
stores the last support function vertex index, when relevant.
Definition: collision_data.h:281
Vec3f cached_gjk_guess
stores the last GJK ray when relevant.
Definition: collision_data.h:278
QueryResult()
Definition: collision_data.h:286
CPUTimes timings
timings for the given request
Definition: collision_data.h:284