Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
coal::ContactPatchSolver Struct Reference

Solver to compute contact patches, i.e. the intersection between two contact surfaces projected onto the shapes' separating plane. Otherwise said, a contact patch is simply the intersection between two support sets: the support set of shape S1 in direction n and the support set of shape S2 in direction -n, where n is the contact normal (satisfying the optimality conditions of GJK/EPA). More...

#include <contact_patch_solver.h>

Public Types

using ShapeSupportData = details::ShapeSupportData
 
using SupportSetDirection = SupportSet::PatchDirection
 
typedef void(* SupportSetFunction) (const ShapeBase *shape, SupportSet &support_set, int &hint, ShapeSupportData &support_data, size_t num_sampled_supports, CoalScalar tol)
 Support set function for shape si. More...
 

Public Member Functions

template<typename ShapeType1 , typename ShapeType2 >
void computePatch (const ShapeType1 &s1, const Transform3s &tf1, const ShapeType2 &s2, const Transform3s &tf2, const Contact &contact, ContactPatch &contact_patch) const
 Main API of the solver: compute a contact patch from a contact between shapes s1 and s2. The contact patch is the (triple) intersection between the separating plane passing (by contact.pos and supported by contact.normal) and the shapes s1 and s2. More...
 
 ContactPatchSolver ()
 Default constructor. More...
 
 ContactPatchSolver (const ContactPatchRequest &request)
 Construct the solver with a ContactPatchRequest. More...
 
void getResult (const Contact &contact, const ContactPatch::Polygon *result, ContactPatch &contact_patch) const
 Retrieve result, adds a post-processing step if result has bigger size than this->max_patch_size. More...
 
bool operator== (const ContactPatchSolver &other) const
 
template<typename ShapeType1 , typename ShapeType2 >
void reset (const ShapeType1 &shape1, const Transform3s &tf1, const ShapeType2 &shape2, const Transform3s &tf2, const ContactPatch &contact_patch) const
 Reset the internal quantities of the solver. More...
 
void set (const ContactPatchRequest &request)
 Set up the solver using a ContactPatchRequest. More...
 
void setSupportGuess (const support_func_guess_t guess) const
 Sets the support guess used during support set computation of shapes s1 and s2. More...
 

Static Public Member Functions

static Vec2s computeLineSegmentIntersection (const Vec2s &a, const Vec2s &b, const Vec2s &c, const Vec2s &d)
 
static SupportSetFunction makeSupportSetFunction (const ShapeBase *shape, ShapeSupportData &support_data)
 Construct support set function for shape. More...
 

Public Attributes

std::vector< bool > added_to_patch
 Tracks which point of the Sutherland-Hodgman result have been added to the contact patch. Only used if the post-processing step occurs, i.e. if the result of Sutherland-Hodgman has a size bigger than max_patch_size. More...
 
size_t num_samples_curved_shapes
 Number of points sampled for Cone and Cylinder when the normal is orthogonal to the shapes' basis. See ContactPatchRequest::m_num_samples_curved_shapes for more details. More...
 
CoalScalar patch_tolerance
 Tolerance below which points are added to the shapes support sets. See ContactPatchRequest::m_patch_tolerance for more details. More...
 
support_func_guess_t support_guess
 Guess for the support sets computation. More...
 
SupportSet support_set_buffer
 Temporary support set used for the Sutherland-Hodgman algorithm. More...
 
SupportSet support_set_shape1
 Holder for support set of shape 1, used for internal computation. After computePatch has been called, this support set is no longer valid. More...
 
SupportSet support_set_shape2
 Holder for support set of shape 2, used for internal computation. After computePatch has been called, this support set is no longer valid. More...
 
SupportSetFunction supportFuncShape1
 Support set function for shape s1. More...
 
SupportSetFunction supportFuncShape2
 Support set function for shape s2. More...
 
std::array< ShapeSupportData, 2 > supports_data
 Temporary data to compute the support sets on each shape. More...
 

Static Public Attributes

static constexpr size_t default_num_preallocated_supports = 16
 Number of vectors to pre-allocate in the m_clipping_sets vectors. More...
 

Detailed Description

Solver to compute contact patches, i.e. the intersection between two contact surfaces projected onto the shapes' separating plane. Otherwise said, a contact patch is simply the intersection between two support sets: the support set of shape S1 in direction n and the support set of shape S2 in direction -n, where n is the contact normal (satisfying the optimality conditions of GJK/EPA).

Note
A contact patch is not the support set of the Minkowski Difference in the direction of the normal. A contact patch is actually the support set of the Minkowski difference in the direction of the normal, i.e. the instersection of the shapes support sets as mentioned above.

TODO(louis): algo improvement:

Definition at line 59 of file coal/contact_patch/contact_patch_solver.h.

Member Typedef Documentation

◆ ShapeSupportData

Definition at line 62 of file coal/contact_patch/contact_patch_solver.h.

◆ SupportSetDirection

Definition at line 63 of file coal/contact_patch/contact_patch_solver.h.

◆ SupportSetFunction

typedef void(* coal::ContactPatchSolver::SupportSetFunction) (const ShapeBase *shape, SupportSet &support_set, int &hint, ShapeSupportData &support_data, size_t num_sampled_supports, CoalScalar tol)

Support set function for shape si.

Parameters
[in]shapethe shape.
[in/out]support_set a support set of the shape. A support set is attached to a frame. All the points of the set computed by this function will be expressed in the local frame of the support set. The support set is computed in the direction of the positive z-axis if its direction is DEFAULT, negative z-axis if its direction is INVERTED.
[in/out]hint for the support computation of ConvexBase shapes. Gets updated after calling the function onto ConvexBase shapes.
[in/out]support_data for the support computation of ConvexBase shapes. Gets updated with visited vertices after calling the function onto ConvexBase shapes.
[in]num_sampled_supportsfor shapes like cone or cylinders which have smooth non-strictly convex sides (their bases are circles), we need to know how many supports we sample from these sides. For any other shape, this parameter is not used.
[in]tolthe "thickness" of the support plane. Any point v which satisfies max_{x in shape}(x.dot(dir)) - v.dot(dir) <= tol is tol distant from the support plane and is added to the support set.

Definition at line 84 of file coal/contact_patch/contact_patch_solver.h.

Constructor & Destructor Documentation

◆ ContactPatchSolver() [1/2]

coal::ContactPatchSolver::ContactPatchSolver ( )
inlineexplicit

Default constructor.

Definition at line 133 of file coal/contact_patch/contact_patch_solver.h.

◆ ContactPatchSolver() [2/2]

coal::ContactPatchSolver::ContactPatchSolver ( const ContactPatchRequest request)
inlineexplicit

Construct the solver with a ContactPatchRequest.

Definition at line 144 of file coal/contact_patch/contact_patch_solver.h.

Member Function Documentation

◆ computeLineSegmentIntersection()

static Vec2s coal::ContactPatchSolver::computeLineSegmentIntersection ( const Vec2s a,
const Vec2s b,
const Vec2s c,
const Vec2s d 
)
static
Returns
the intersecting point between line defined by ray (a, b) and the segment [c, d].
Note
we make the following hypothesis: 1) c != d (should be when creating initial polytopes) 2) (c, d) is not parallel to ray -> if so, we return d.

◆ computePatch()

template<typename ShapeType1 , typename ShapeType2 >
void coal::ContactPatchSolver::computePatch ( const ShapeType1 &  s1,
const Transform3s tf1,
const ShapeType2 &  s2,
const Transform3s tf2,
const Contact contact,
ContactPatch contact_patch 
) const

Main API of the solver: compute a contact patch from a contact between shapes s1 and s2. The contact patch is the (triple) intersection between the separating plane passing (by contact.pos and supported by contact.normal) and the shapes s1 and s2.

◆ getResult()

void coal::ContactPatchSolver::getResult ( const Contact contact,
const ContactPatch::Polygon result,
ContactPatch contact_patch 
) const

Retrieve result, adds a post-processing step if result has bigger size than this->max_patch_size.

◆ makeSupportSetFunction()

ContactPatchSolver::SupportSetFunction coal::ContactPatchSolver::makeSupportSetFunction ( const ShapeBase shape,
ShapeSupportData support_data 
)
static

Construct support set function for shape.

Definition at line 59 of file contact_patch_solver.cpp.

◆ operator==()

bool coal::ContactPatchSolver::operator== ( const ContactPatchSolver other) const
inline

Definition at line 190 of file coal/contact_patch/contact_patch_solver.h.

◆ reset()

template<typename ShapeType1 , typename ShapeType2 >
void coal::ContactPatchSolver::reset ( const ShapeType1 &  shape1,
const Transform3s tf1,
const ShapeType2 &  shape2,
const Transform3s tf2,
const ContactPatch contact_patch 
) const

Reset the internal quantities of the solver.

◆ set()

void coal::ContactPatchSolver::set ( const ContactPatchRequest request)

Set up the solver using a ContactPatchRequest.

◆ setSupportGuess()

void coal::ContactPatchSolver::setSupportGuess ( const support_func_guess_t  guess) const
inline

Sets the support guess used during support set computation of shapes s1 and s2.

Definition at line 153 of file coal/contact_patch/contact_patch_solver.h.

Member Data Documentation

◆ added_to_patch

std::vector<bool> coal::ContactPatchSolver::added_to_patch
mutable

Tracks which point of the Sutherland-Hodgman result have been added to the contact patch. Only used if the post-processing step occurs, i.e. if the result of Sutherland-Hodgman has a size bigger than max_patch_size.

Definition at line 130 of file coal/contact_patch/contact_patch_solver.h.

◆ default_num_preallocated_supports

constexpr size_t coal::ContactPatchSolver::default_num_preallocated_supports = 16
staticconstexpr

Number of vectors to pre-allocate in the m_clipping_sets vectors.

Definition at line 91 of file coal/contact_patch/contact_patch_solver.h.

◆ num_samples_curved_shapes

size_t coal::ContactPatchSolver::num_samples_curved_shapes

Number of points sampled for Cone and Cylinder when the normal is orthogonal to the shapes' basis. See ContactPatchRequest::m_num_samples_curved_shapes for more details.

Definition at line 97 of file coal/contact_patch/contact_patch_solver.h.

◆ patch_tolerance

CoalScalar coal::ContactPatchSolver::patch_tolerance

Tolerance below which points are added to the shapes support sets. See ContactPatchRequest::m_patch_tolerance for more details.

Definition at line 101 of file coal/contact_patch/contact_patch_solver.h.

◆ support_guess

support_func_guess_t coal::ContactPatchSolver::support_guess
mutable

Guess for the support sets computation.

Definition at line 113 of file coal/contact_patch/contact_patch_solver.h.

◆ support_set_buffer

SupportSet coal::ContactPatchSolver::support_set_buffer
mutable

Temporary support set used for the Sutherland-Hodgman algorithm.

Definition at line 124 of file coal/contact_patch/contact_patch_solver.h.

◆ support_set_shape1

SupportSet coal::ContactPatchSolver::support_set_shape1
mutable

Holder for support set of shape 1, used for internal computation. After computePatch has been called, this support set is no longer valid.

Definition at line 117 of file coal/contact_patch/contact_patch_solver.h.

◆ support_set_shape2

SupportSet coal::ContactPatchSolver::support_set_shape2
mutable

Holder for support set of shape 2, used for internal computation. After computePatch has been called, this support set is no longer valid.

Definition at line 121 of file coal/contact_patch/contact_patch_solver.h.

◆ supportFuncShape1

SupportSetFunction coal::ContactPatchSolver::supportFuncShape1
mutable

Support set function for shape s1.

Definition at line 104 of file coal/contact_patch/contact_patch_solver.h.

◆ supportFuncShape2

SupportSetFunction coal::ContactPatchSolver::supportFuncShape2
mutable

Support set function for shape s2.

Definition at line 107 of file coal/contact_patch/contact_patch_solver.h.

◆ supports_data

std::array<ShapeSupportData, 2> coal::ContactPatchSolver::supports_data
mutable

Temporary data to compute the support sets on each shape.

Definition at line 110 of file coal/contact_patch/contact_patch_solver.h.


The documentation for this struct was generated from the following files:


hpp-fcl
Author(s):
autogenerated on Sat Nov 23 2024 03:45:00