coal
3.0.1
Coal, The Collision Detection Library. Previously known as HPP-FCL, fork of FCL -- The Flexible Collision Library
|
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 <coal/contact_patch/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, Scalar tol) |
Support set function for shape si. More... | |
Public Member Functions | |
ContactPatchSolver () | |
Default constructor. More... | |
ContactPatchSolver (const ContactPatchRequest &request) | |
Construct the solver with a ContactPatchRequest . 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... | |
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... | |
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 | 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 |
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 | |
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... | |
Scalar | patch_tolerance |
Tolerance below which points are added to the shapes support sets. See ContactPatchRequest::m_patch_tolerance for more details. 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... | |
support_func_guess_t | support_guess |
Guess for the support sets computation. 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... | |
SupportSet | support_set_buffer |
Temporary support set used for the Sutherland-Hodgman algorithm. More... | |
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... | |
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... | |
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).
TODO(louis): algo improvement:
typedef void(* coal::ContactPatchSolver::SupportSetFunction) (const ShapeBase *shape, SupportSet &support_set, int &hint, ShapeSupportData &support_data, size_t num_sampled_supports, Scalar tol) |
Support set function for shape si.
[in] | shape | the 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_supports | for 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] | tol | the "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. |
|
inlineexplicit |
Default constructor.
|
inlineexplicit |
Construct the solver with a ContactPatchRequest
.
|
inlinestatic |
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.
|
inline |
Retrieve result, adds a post-processing step if result has bigger size than this->max_patch_size
.
|
static |
Construct support set function for shape.
|
inline |
|
inline |
Reset the internal quantities of the solver.
|
inline |
Set up the solver using a ContactPatchRequest
.
|
inline |
Sets the support guess used during support set computation of shapes s1 and s2.
|
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
.
|
staticconstexpr |
Number of vectors to pre-allocate in the m_clipping_sets
vectors.
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.
Scalar coal::ContactPatchSolver::patch_tolerance |
Tolerance below which points are added to the shapes support sets. See ContactPatchRequest::m_patch_tolerance for more details.
|
mutable |
Guess for the support sets computation.
|
mutable |
Temporary support set used for the Sutherland-Hodgman algorithm.
|
mutable |
Holder for support set of shape 1, used for internal computation. After computePatch
has been called, this support set is no longer valid.
|
mutable |
Holder for support set of shape 2, used for internal computation. After computePatch
has been called, this support set is no longer valid.
|
mutable |
Support set function for shape s1.
|
mutable |
Support set function for shape s2.
|
mutable |
Temporary data to compute the support sets on each shape.