Struct ContactPatchResult

Struct Documentation

struct ContactPatchResult

Result for a contact patch computation.

Public Types

using ContactPatchVector = std::vector<ContactPatch>
using ContactPatchRef = std::reference_wrapper<ContactPatch>
using ContactPatchRefVector = std::vector<ContactPatchRef>

Public Functions

inline ContactPatchResult()

Default constructor.

inline explicit ContactPatchResult(const ContactPatchRequest &request)

Constructor using a ContactPatchRequest.

inline size_t numContactPatches() const

Number of contact patches in the result.

inline ContactPatchRef getUnusedContactPatch()

Returns a new unused contact patch from the internal data vector.

inline const ContactPatch &getContactPatch(const size_t i) const

Const getter for the i-th contact patch of the result.

inline ContactPatch &contactPatch(const size_t i)

Getter for the i-th contact patch of the result.

inline void clear()

Clears the contact patch result.

inline void set(const ContactPatchRequest &request)

Set up a ContactPatchResult from a ContactPatchRequest

inline bool check(const ContactPatchRequest &request) const

Return true if this ContactPatchResult is aligned with the ContactPatchRequest given as input.

inline bool operator==(const ContactPatchResult &other) const

Whether two ContactPatchResult are identical or not.

inline void swapObjects()

Repositions the ContactPatch when they get inverted during their construction.

Protected Attributes

ContactPatchVector m_contact_patches_data

Data container for the vector of contact patches.

Note

Contrary to CollisionResult or DistanceResult, which have a very small memory footprint, contact patches can contain relatively large polytopes. In order to reuse a ContactPatchResult while avoiding successive mallocs, we have a data container and a vector which points to the currently active patches in this data container.

size_t m_id_available_patch

Contact patches in m_contact_patches_data can have two statuses: used or unused. This index tracks the first unused patch in the m_contact_patches_data vector.

ContactPatchRefVector m_contact_patches

Vector of contact patches of the result.