Go to the documentation of this file.
   37 #ifndef COAL_INTERNAL_SHAPE_SHAPE_CONTACT_PATCH_FUNC_H 
   38 #define COAL_INTERNAL_SHAPE_SHAPE_CONTACT_PATCH_FUNC_H 
   51 template <
typename ShapeType1, 
typename ShapeType2>
 
   64         result.
check(request),
 
   65         "The contact patch result and request are incompatible (issue of " 
   66         "contact patch size or maximum number of contact patches). Make sure " 
   67         "result is initialized with request.",
 
   70     const ShapeType1& s1 = 
static_cast<const ShapeType1&
>(*o1);
 
   71     const ShapeType2& s2 = 
static_cast<const ShapeType2&
>(*o2);
 
   72     for (
size_t i = 0; i < collision_result.
numContacts(); ++i) {
 
   89 template <
bool InvertShapes, 
typename OtherShapeType, 
typename PlaneOrHalfspace>
 
   92                                   const PlaneOrHalfspace& s2,
 
  112       tf1.rotation().transpose() *
 
  121     support_set.
direction = ContactPatch::PatchDirection::INVERTED;
 
  122     details::getShapeSupportSet<SupportOptions::WithSweptSphere>(
 
  126     support_set.
direction = ContactPatch::PatchDirection::DEFAULT;
 
  127     details::getShapeSupportSet<SupportOptions::WithSweptSphere>(
 
  134 #define PLANE_OR_HSPACE_AND_OTHER_SHAPE_CONTACT_PATCH(PlaneOrHspace)          \ 
  135   template <typename OtherShapeType>                                          \ 
  136   struct ComputeShapeShapeContactPatch<OtherShapeType, PlaneOrHspace> {       \ 
  137     static void run(const CollisionGeometry* o1, const Transform3s& tf1,      \ 
  138                     const CollisionGeometry* o2, const Transform3s& tf2,      \ 
  139                     const CollisionResult& collision_result,                  \ 
  140                     const ContactPatchSolver* csolver,                        \ 
  141                     const ContactPatchRequest& request,                       \ 
  142                     ContactPatchResult& result) {                             \ 
  143       if (!collision_result.isCollision()) {                                  \ 
  147           result.check(request),                                              \ 
  148           "The contact patch result and request are incompatible (issue of "  \ 
  149           "contact patch size or maximum number of contact patches). Make "   \ 
  151           "result is initialized with request.",                              \ 
  154       const OtherShapeType& s1 = static_cast<const OtherShapeType&>(*o1);     \ 
  155       const PlaneOrHspace& s2 = static_cast<const PlaneOrHspace&>(*o2);       \ 
  156       for (size_t i = 0; i < collision_result.numContacts(); ++i) {           \ 
  157         if (i >= request.max_num_patch) {                                     \ 
  160         csolver->setSupportGuess(collision_result.cached_support_func_guess); \ 
  161         const Contact& contact = collision_result.getContact(i);              \ 
  162         ContactPatch& contact_patch = result.getUnusedContactPatch();         \ 
  163         computePatchPlaneOrHalfspace<false, OtherShapeType, PlaneOrHspace>(   \ 
  164             s1, tf1, s2, tf2, csolver, contact, contact_patch);               \ 
  169   template <typename OtherShapeType>                                          \ 
  170   struct ComputeShapeShapeContactPatch<PlaneOrHspace, OtherShapeType> {       \ 
  171     static void run(const CollisionGeometry* o1, const Transform3s& tf1,      \ 
  172                     const CollisionGeometry* o2, const Transform3s& tf2,      \ 
  173                     const CollisionResult& collision_result,                  \ 
  174                     const ContactPatchSolver* csolver,                        \ 
  175                     const ContactPatchRequest& request,                       \ 
  176                     ContactPatchResult& result) {                             \ 
  177       if (!collision_result.isCollision()) {                                  \ 
  181           result.check(request),                                              \ 
  182           "The contact patch result and request are incompatible (issue of "  \ 
  183           "contact patch size or maximum number of contact patches). Make "   \ 
  185           "result is initialized with request.",                              \ 
  188       const PlaneOrHspace& s1 = static_cast<const PlaneOrHspace&>(*o1);       \ 
  189       const OtherShapeType& s2 = static_cast<const OtherShapeType&>(*o2);     \ 
  190       for (size_t i = 0; i < collision_result.numContacts(); ++i) {           \ 
  191         if (i >= request.max_num_patch) {                                     \ 
  194         csolver->setSupportGuess(collision_result.cached_support_func_guess); \ 
  195         const Contact& contact = collision_result.getContact(i);              \ 
  196         ContactPatch& contact_patch = result.getUnusedContactPatch();         \ 
  197         computePatchPlaneOrHalfspace<true, OtherShapeType, PlaneOrHspace>(    \ 
  198             s2, tf2, s1, tf1, csolver, contact, contact_patch);               \ 
  206 #define PLANE_HSPACE_CONTACT_PATCH(PlaneOrHspace1, PlaneOrHspace2)           \ 
  208   struct ComputeShapeShapeContactPatch<PlaneOrHspace1, PlaneOrHspace2> {     \ 
  209     static void run(const CollisionGeometry* o1, const Transform3s& tf1,     \ 
  210                     const CollisionGeometry* o2, const Transform3s& tf2,     \ 
  211                     const CollisionResult& collision_result,                 \ 
  212                     const ContactPatchSolver* csolver,                       \ 
  213                     const ContactPatchRequest& request,                      \ 
  214                     ContactPatchResult& result) {                            \ 
  215       COAL_UNUSED_VARIABLE(o1);                                              \ 
  216       COAL_UNUSED_VARIABLE(tf1);                                             \ 
  217       COAL_UNUSED_VARIABLE(o2);                                              \ 
  218       COAL_UNUSED_VARIABLE(tf2);                                             \ 
  219       COAL_UNUSED_VARIABLE(csolver);                                         \ 
  220       if (!collision_result.isCollision()) {                                 \ 
  224           result.check(request),                                             \ 
  225           "The contact patch result and request are incompatible (issue of " \ 
  226           "contact patch size or maximum number of contact patches). Make "  \ 
  228           "result is initialized with request.",                             \ 
  231       for (size_t i = 0; i < collision_result.numContacts(); ++i) {          \ 
  232         if (i >= request.max_num_patch) {                                    \ 
  235         const Contact& contact = collision_result.getContact(i);             \ 
  236         ContactPatch& contact_patch = result.getUnusedContactPatch();        \ 
  237         constructContactPatchFrameFromContact(contact, contact_patch);       \ 
  238         contact_patch.addPoint(contact.pos);                                 \ 
  248 #undef PLANE_OR_HSPACE_AND_OTHER_SHAPE_CONTACT_PATCH 
  249 #undef PLANE_HSPACE_CONTACT_PATCH 
  251 template <
typename ShapeType1, 
typename ShapeType2>
 
  259       o1, 
tf1, o2, 
tf2, collision_result, csolver, request, result);
 
  
support_func_guess_t cached_support_func_guess
stores the last support function vertex index, when relevant.
void computePatchPlaneOrHalfspace(const OtherShapeType &s1, const Transform3s &tf1, const PlaneOrHalfspace &s2, const Transform3s &tf2, const ContactPatchSolver *csolver, const Contact &contact, ContactPatch &contact_patch)
Computes the contact patch between a Plane/Halfspace and another shape.
bool isCollision() const
return binary collision result
#define COAL_ASSERT(check, message, exception)
The geometry for the object for collision or distance computation.
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...
#define COAL_UNUSED_VARIABLE(var)
void ShapeShapeContactPatch(const CollisionGeometry *o1, const Transform3s &tf1, const CollisionGeometry *o2, const Transform3s &tf2, const CollisionResult &collision_result, const ContactPatchSolver *csolver, const ContactPatchRequest &request, ContactPatchResult &result)
const Contact & getContact(size_t i) const
get the i-th contact calculated
SupportOptions
Options for the computation of support points. NoSweptSphere option is used when the support function...
size_t numContacts() const
number of contacts found
hpp-fcl
Author(s): 
autogenerated on Fri Feb 14 2025 03:45:51