Struct CollisionResult

Inheritance Relationships

Base Type

Struct Documentation

struct CollisionResult : public coal::QueryResult

collision result

Public Functions

inline CollisionResult()

Default constructor.

CollisionResult(const CollisionResult &other) = default

Copy constructor.

CollisionResult &operator=(const CollisionResult &other) = default
inline CollisionResult(const CollisionResult &other, const std::vector<std::pair<const CollisionGeometry*, const CollisionGeometry*>> &new_geometries)

Copy constructor from an other CollisionResult and two vectors of CollisionGeometry pointers. This constructor allows to copy the collision result information from an other collision result, but remap the pointers to the collision geometries to the provided ones. This is usefull in a deep-copy context, when the collision geometries are also copied and the pointers in the collision result need to be remapped to the new collision geometries.

inline void resolveReferences(const std::vector<std::pair<const CollisionGeometry*, const CollisionGeometry*>> &new_geometries)

Resolve the internal points the pointers in the contacts to the provided pairs of collision geometries. This is useful when deep-copying or deserializing a collision result, as the pointers to the collision objects are not valid anymore and need to be remapped to the collision objects in the current context.

inline void updateDistanceLowerBound(const Scalar &distance_lower_bound_)

Update the lower bound only if the distance is inferior.

inline void addContact(const Contact &c)

add one contact into result structure

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

whether two CollisionResult are the same or not

inline bool operator!=(const CollisionResult &other) const

whether two CollisionResult are the same or not

inline bool isCollision() const

return binary collision result

inline size_t numContacts() const

number of contacts found

inline const Contact &getContact(size_t i) const

get the i-th contact calculated

inline void setContact(size_t i, const Contact &c)

set the i-th contact calculated

inline void getContacts(std::vector<Contact> &contacts_) const

get all the contacts

inline const std::vector<Contact> &getContacts() const
inline void clear()

clear the results obtained

void swapObjects()

reposition Contact objects when fcl inverts them during their construction.

inline void disp(std::ostream &os, const std::string &prefix = "") const

Prints the result to the provided output stream.

Public Members

Scalar distance_lower_bound

Lower bound on distance between objects if they are disjoint. See Collision

Note

Always computed. If CollisionRequest::distance_upper_bound is set to infinity, distance_lower_bound is the actual distance between the shapes.

Vec3s normal

normal associated to nearest_points. Same as CollisionResult::nearest_points but for the normal.

std::array<Vec3s, 2> nearest_points

nearest points. A CollisionResult can have multiple contacts. The nearest points in CollisionResults correspond to the witness points associated with the smallest distance i.e the distance_lower_bound. For bounding volumes and BVHs, these nearest points are available only when distance_lower_bound is inferior to CollisionRequest::break_distance.

Friends

inline friend std::ostream &operator<<(std::ostream &os, const CollisionResult &res)

Prints the result to the provided output stream.