Struct DistanceResult

Inheritance Relationships

Base Type

Struct Documentation

struct DistanceResult : public coal::QueryResult

distance result

Public Functions

inline DistanceResult(Scalar min_distance_ = (std::numeric_limits<Scalar>::max)())

Default constructor.

DistanceResult(const DistanceResult &other) = default

Copy constructor. This constructor does a raw copy of the contact information, including the pointers to the collision geometries.

DistanceResult &operator=(const DistanceResult &other) = default
inline DistanceResult(const DistanceResult &other, std::pair<const CollisionGeometry*, const CollisionGeometry*> new_o1_o2)

Copy constructor using another result and a pair of CollisionGeometry pointers. This constructor allows to copy the contact information from an other contact, 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 contact need to be remapped to the new collision geometries.

inline void resolveReferences(std::pair<const CollisionGeometry*, const CollisionGeometry*> new_o1_o2)

(re)Map the pointers o1/o2 to the provided collision objects. This is useful when deserializing a 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 update(Scalar distance, const CollisionGeometry *o1_, const CollisionGeometry *o2_, int b1_, int b2_)

add distance information into the result

inline void update(Scalar distance, const CollisionGeometry *o1_, const CollisionGeometry *o2_, int b1_, int b2_, const Vec3s &p1, const Vec3s &p2, const Vec3s &normal_)

add distance information into the result

inline void update(const DistanceResult &other_result)

add distance information into the result

inline void clear()

clear the result

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

Whether two DistanceResult are the same or not. This compares the two results terms by terms. Note: two results may be equal even if they point to different collision geometries o1/o2, as long as these geometries are equal.

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

whether two DistanceResult are different or not

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

Prints the distance result to the provided output stream.

Public Members

Scalar min_distance

minimum distance between two objects. If two objects are in collision and DistanceRequest::enable_signed_distance is activated, min_distance <= 0.

Note

The nearest points are the points of the shapes that achieve a distance of DistanceResult::min_distance.

Vec3s normal

normal.

std::array<Vec3s, 2> nearest_points

nearest points. See CollisionResult::nearest_points.

const CollisionGeometry *o1

collision object 1

const CollisionGeometry *o2

collision object 2

int b1

information about the nearest point in object 1 if object 1 is mesh or point cloud, it is the triangle or point id if object 1 is geometry shape, it is NONE (-1), if object 1 is octree, it is the id of the cell

int b2

information about the nearest point in object 2 if object 2 is mesh or point cloud, it is the triangle or point id if object 2 is geometry shape, it is NONE (-1), if object 2 is octree, it is the id of the cell

Public Static Attributes

static const int NONE = -1

invalid contact primitive information

Friends

inline friend std::ostream &operator<<(std::ostream &os, const DistanceResult &result)

Prints the distance result to the provided output stream.