coal
3.0.1
Coal, The Collision Detection Library. Previously known as HPP-FCL, fork of FCL -- The Flexible Collision Library
|
Classes | |
struct | UpdateBoundingVolume |
struct | UpdateBoundingVolume< AABB > |
struct | GJK |
class for GJK algorithm More... | |
struct | EPA |
class for EPA algorithm More... | |
struct | MinkowskiDiff |
Minkowski difference class of two shapes. More... | |
struct | ShapeSupportData |
Stores temporary data for the computation of support points. More... | |
struct | LargeConvex |
Cast a ConvexBase to a LargeConvex to use the log version of getShapeSupport . This is much faster than the linear version of getShapeSupport when a ConvexBase has more than a few dozen of vertices. More... | |
struct | SmallConvex |
See LargeConvex. More... | |
Enumerations | |
enum | SupportOptions { NoSweptSphere = 0 , WithSweptSphere = 0x1 } |
Options for the computation of support points. NoSweptSphere option is used when the support function is called by GJK or EPA. In this case, the swept sphere radius is not taken into account in the support function. It is used by GJK and EPA after they have converged to correct the solution. WithSweptSphere option is used when the support function is called directly by the user. In this case, the swept sphere radius is taken into account in the support function. More... | |
Functions | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
Vec3s | getSupport (const ShapeBase *shape, const Vec3s &dir, int &hint) |
the support function for shape. The output support point is expressed in the local frame of the shape. More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupport (const TriangleP *triangle, const Vec3s &dir, Vec3s &support, int &, ShapeSupportData &) |
Triangle support function. More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupport (const Box *box, const Vec3s &dir, Vec3s &support, int &, ShapeSupportData &) |
Box support function. More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupport (const Sphere *sphere, const Vec3s &dir, Vec3s &support, int &, ShapeSupportData &) |
Sphere support function. More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupport (const Ellipsoid *ellipsoid, const Vec3s &dir, Vec3s &support, int &, ShapeSupportData &) |
Ellipsoid support function. More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupport (const Capsule *capsule, const Vec3s &dir, Vec3s &support, int &, ShapeSupportData &) |
Capsule support function. More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupport (const Cone *cone, const Vec3s &dir, Vec3s &support, int &, ShapeSupportData &) |
Cone support function. More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupport (const Cylinder *cylinder, const Vec3s &dir, Vec3s &support, int &, ShapeSupportData &) |
Cylinder support function. More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupport (const ConvexBase *convex, const Vec3s &dir, Vec3s &support, int &hint, ShapeSupportData &) |
ConvexBase support function. More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupport (const SmallConvex *convex, const Vec3s &dir, Vec3s &support, int &hint, ShapeSupportData &data) |
Support function for large ConvexBase (>32 vertices). More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupport (const LargeConvex *convex, const Vec3s &dir, Vec3s &support, int &hint, ShapeSupportData &support_data) |
Support function for small ConvexBase (<32 vertices). More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getSupportSet (const ShapeBase *shape, SupportSet &support_set, int &hint, size_t num_sampled_supports=6, Scalar tol=Scalar(1e-3)) |
Computes the support set for shape. This function assumes the frame of the support set has already been computed and that this frame is expressed w.r.t the local frame of the shape (i.e. the local frame of the shape is the WORLD frame of the support set). The support direction used to compute the support set is the positive z-axis if the support set has the DEFAULT direction; negative z-axis if it has the INVERTED direction. (In short, a shape's support set is has the DEFAULT direction if the shape is the first shape in a collision pair. It has the INVERTED direction if the shape is the second one in the collision pair). More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getSupportSet (const ShapeBase *shape, const Vec3s &dir, SupportSet &support_set, int &hint, size_t num_sampled_supports=6, Scalar tol=Scalar(1e-3)) |
Same as getSupportSet(const ShapeBase*, const Scalar, SupportSet&, const int) but also constructs the support set frame from dir . More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupportSet (const TriangleP *triangle, SupportSet &support_set, int &, ShapeSupportData &, size_t num_sampled_supports=6, Scalar tol=Scalar(1e-3)) |
Triangle support set function. Assumes the support set frame has already been computed. More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupportSet (const Box *box, SupportSet &support_set, int &, ShapeSupportData &support_data, size_t num_sampled_supports=6, Scalar tol=Scalar(1e-3)) |
Box support set function. Assumes the support set frame has already been computed. More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupportSet (const Sphere *sphere, SupportSet &support_set, int &, ShapeSupportData &, size_t num_sampled_supports=6, Scalar tol=Scalar(1e-3)) |
Sphere support set function. Assumes the support set frame has already been computed. More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupportSet (const Ellipsoid *ellipsoid, SupportSet &support_set, int &, ShapeSupportData &, size_t num_sampled_supports=6, Scalar tol=Scalar(1e-3)) |
Ellipsoid support set function. Assumes the support set frame has already been computed. More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupportSet (const Capsule *capsule, SupportSet &support_set, int &, ShapeSupportData &, size_t num_sampled_supports=6, Scalar tol=Scalar(1e-3)) |
Capsule support set function. Assumes the support set frame has already been computed. More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupportSet (const Cone *cone, SupportSet &support_set, int &, ShapeSupportData &, size_t num_sampled_supports=6, Scalar tol=Scalar(1e-3)) |
Cone support set function. Assumes the support set frame has already been computed. More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupportSet (const Cylinder *cylinder, SupportSet &support_set, int &, ShapeSupportData &, size_t num_sampled_supports=6, Scalar tol=Scalar(1e-3)) |
Cylinder support set function. Assumes the support set frame has already been computed. More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupportSet (const ConvexBase *convex, SupportSet &support_set, int &hint, ShapeSupportData &support_data, size_t num_sampled_supports=6, Scalar tol=Scalar(1e-3)) |
ConvexBase support set function. Assumes the support set frame has already been computed. More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupportSet (const SmallConvex *convex, SupportSet &support_set, int &, ShapeSupportData &, size_t num_sampled_supports=6, Scalar tol=Scalar(1e-3)) |
Support set function for large ConvexBase (>32 vertices). Assumes the support set frame has already been computed. More... | |
template<int _SupportOptions = SupportOptions::NoSweptSphere> | |
void | getShapeSupportSet (const LargeConvex *convex, SupportSet &support_set, int &hint, ShapeSupportData &support_data, size_t num_sampled_supports=6, Scalar tol=Scalar(1e-3)) |
Support set function for small ConvexBase (<32 vertices). Assumes the support set frame has already been computed. More... | |
void | computeSupportSetConvexHull (SupportSet::Polygon &cloud, SupportSet::Polygon &cvx_hull) |
Computes the convex-hull of support_set. For now, this function is only needed for Box and ConvexBase. More... | |
Scalar | sphereCapsuleDistance (const Sphere &s1, const Transform3s &tf1, const Capsule &s2, const Transform3s &tf2, Vec3s &p1, Vec3s &p2, Vec3s &normal) |
Scalar | sphereCylinderDistance (const Sphere &s1, const Transform3s &tf1, const Cylinder &s2, const Transform3s &tf2, Vec3s &p1, Vec3s &p2, Vec3s &normal) |
Scalar | sphereSphereDistance (const Sphere &s1, const Transform3s &tf1, const Sphere &s2, const Transform3s &tf2, Vec3s &p1, Vec3s &p2, Vec3s &normal) |
Scalar | segmentSqrDistance (const Vec3s &from, const Vec3s &to, const Vec3s &p, Vec3s &nearest) |
the minimum distance from a point to a line More... | |
bool | projectInTriangle (const Vec3s &p1, const Vec3s &p2, const Vec3s &p3, const Vec3s &normal, const Vec3s &p) |
Whether a point's projection is in a triangle. More... | |
Scalar | sphereTriangleDistance (const Sphere &s, const Transform3s &tf1, const TriangleP &tri, const Transform3s &tf2, Vec3s &p1, Vec3s &p2, Vec3s &normal) |
Scalar | halfspaceDistance (const Halfspace &h, const Transform3s &tf1, const ShapeBase &s, const Transform3s &tf2, Vec3s &p1, Vec3s &p2, Vec3s &normal) |
Scalar | planeDistance (const Plane &plane, const Transform3s &tf1, const ShapeBase &s, const Transform3s &tf2, Vec3s &p1, Vec3s &p2, Vec3s &normal) |
Scalar | boxSphereDistance (const Box &b, const Transform3s &tfb, const Sphere &s, const Transform3s &tfs, Vec3s &pb, Vec3s &ps, Vec3s &normal) |
Scalar | halfspaceHalfspaceDistance (const Halfspace &s1, const Transform3s &tf1, const Halfspace &s2, const Transform3s &tf2, Vec3s &p1, Vec3s &p2, Vec3s &normal) |
return distance between two halfspaces More... | |
Scalar | halfspacePlaneDistance (const Halfspace &s1, const Transform3s &tf1, const Plane &s2, const Transform3s &tf2, Vec3s &p1, Vec3s &p2, Vec3s &normal) |
return distance between plane and halfspace. More... | |
Scalar | planePlaneDistance (const Plane &s1, const Transform3s &tf1, const Plane &s2, const Transform3s &tf2, Vec3s &p1, Vec3s &p2, Vec3s &normal) |
return distance between two planes More... | |
Scalar | computePenetration (const Vec3s &P1, const Vec3s &P2, const Vec3s &P3, const Vec3s &Q1, const Vec3s &Q2, const Vec3s &Q3, Vec3s &normal) |
See the prototype below. More... | |
Scalar | computePenetration (const Vec3s &P1, const Vec3s &P2, const Vec3s &P3, const Vec3s &Q1, const Vec3s &Q2, const Vec3s &Q3, const Transform3s &tf1, const Transform3s &tf2, Vec3s &normal) |
Options for the computation of support points. NoSweptSphere
option is used when the support function is called by GJK or EPA. In this case, the swept sphere radius is not taken into account in the support function. It is used by GJK and EPA after they have converged to correct the solution. WithSweptSphere
option is used when the support function is called directly by the user. In this case, the swept sphere radius is taken into account in the support function.
Enumerator | |
---|---|
NoSweptSphere | |
WithSweptSphere |
|
inline |
Taken from book Real Time Collision Detection, from Christer Ericson
pb | the witness point on the box surface |
ps | the witness point on the sphere. |
normal | pointing from box to sphere |
|
inline |
|
inline |
See the prototype below.
void coal::details::computeSupportSetConvexHull | ( | SupportSet::Polygon & | cloud, |
SupportSet::Polygon & | cvx_hull | ||
) |
Computes the convex-hull of support_set. For now, this function is only needed for Box and ConvexBase.
[in] | cloud | data which contains the 2d points of the support set which convex-hull we want to compute. |
[out] | 2d | points of the the support set's convex-hull. |
void coal::details::getShapeSupport | ( | const Box * | box, |
const Vec3s & | dir, | ||
Vec3s & | support, | ||
int & | , | ||
ShapeSupportData & | |||
) |
Box support function.
void coal::details::getShapeSupport | ( | const Capsule * | capsule, |
const Vec3s & | dir, | ||
Vec3s & | support, | ||
int & | , | ||
ShapeSupportData & | |||
) |
Capsule support function.
void coal::details::getShapeSupport | ( | const Cone * | cone, |
const Vec3s & | dir, | ||
Vec3s & | support, | ||
int & | , | ||
ShapeSupportData & | |||
) |
Cone support function.
void coal::details::getShapeSupport | ( | const ConvexBase * | convex, |
const Vec3s & | dir, | ||
Vec3s & | support, | ||
int & | hint, | ||
ShapeSupportData & | |||
) |
ConvexBase support function.
void coal::details::getShapeSupport | ( | const Cylinder * | cylinder, |
const Vec3s & | dir, | ||
Vec3s & | support, | ||
int & | , | ||
ShapeSupportData & | |||
) |
Cylinder support function.
void coal::details::getShapeSupport | ( | const Ellipsoid * | ellipsoid, |
const Vec3s & | dir, | ||
Vec3s & | support, | ||
int & | , | ||
ShapeSupportData & | |||
) |
Ellipsoid support function.
void coal::details::getShapeSupport | ( | const LargeConvex * | convex, |
const Vec3s & | dir, | ||
Vec3s & | support, | ||
int & | hint, | ||
ShapeSupportData & | support_data | ||
) |
Support function for small ConvexBase (<32 vertices).
void coal::details::getShapeSupport | ( | const SmallConvex * | convex, |
const Vec3s & | dir, | ||
Vec3s & | support, | ||
int & | hint, | ||
ShapeSupportData & | data | ||
) |
Support function for large ConvexBase (>32 vertices).
void coal::details::getShapeSupport | ( | const Sphere * | sphere, |
const Vec3s & | dir, | ||
Vec3s & | support, | ||
int & | , | ||
ShapeSupportData & | |||
) |
Sphere support function.
void coal::details::getShapeSupport | ( | const TriangleP * | triangle, |
const Vec3s & | dir, | ||
Vec3s & | support, | ||
int & | , | ||
ShapeSupportData & | |||
) |
Triangle support function.
void coal::details::getShapeSupportSet | ( | const Box * | box, |
SupportSet & | support_set, | ||
int & | , | ||
ShapeSupportData & | support_data, | ||
size_t | num_sampled_supports = 6 , |
||
Scalar | tol = Scalar(1e-3) |
||
) |
Box support set function. Assumes the support set frame has already been computed.
void coal::details::getShapeSupportSet | ( | const Capsule * | capsule, |
SupportSet & | support_set, | ||
int & | , | ||
ShapeSupportData & | , | ||
size_t | num_sampled_supports = 6 , |
||
Scalar | tol = Scalar(1e-3) |
||
) |
Capsule support set function. Assumes the support set frame has already been computed.
void coal::details::getShapeSupportSet | ( | const Cone * | cone, |
SupportSet & | support_set, | ||
int & | , | ||
ShapeSupportData & | , | ||
size_t | num_sampled_supports = 6 , |
||
Scalar | tol = Scalar(1e-3) |
||
) |
Cone support set function. Assumes the support set frame has already been computed.
void coal::details::getShapeSupportSet | ( | const ConvexBase * | convex, |
SupportSet & | support_set, | ||
int & | hint, | ||
ShapeSupportData & | support_data, | ||
size_t | num_sampled_supports = 6 , |
||
Scalar | tol = Scalar(1e-3) |
||
) |
ConvexBase support set function. Assumes the support set frame has already been computed.
void coal::details::getShapeSupportSet | ( | const Cylinder * | cylinder, |
SupportSet & | support_set, | ||
int & | , | ||
ShapeSupportData & | , | ||
size_t | num_sampled_supports = 6 , |
||
Scalar | tol = Scalar(1e-3) |
||
) |
Cylinder support set function. Assumes the support set frame has already been computed.
void coal::details::getShapeSupportSet | ( | const Ellipsoid * | ellipsoid, |
SupportSet & | support_set, | ||
int & | , | ||
ShapeSupportData & | , | ||
size_t | num_sampled_supports = 6 , |
||
Scalar | tol = Scalar(1e-3) |
||
) |
Ellipsoid support set function. Assumes the support set frame has already been computed.
void coal::details::getShapeSupportSet | ( | const LargeConvex * | convex, |
SupportSet & | support_set, | ||
int & | hint, | ||
ShapeSupportData & | support_data, | ||
size_t | num_sampled_supports = 6 , |
||
Scalar | tol = Scalar(1e-3) |
||
) |
Support set function for small ConvexBase (<32 vertices). Assumes the support set frame has already been computed.
void coal::details::getShapeSupportSet | ( | const SmallConvex * | convex, |
SupportSet & | support_set, | ||
int & | , | ||
ShapeSupportData & | , | ||
size_t | num_sampled_supports = 6 , |
||
Scalar | tol = Scalar(1e-3) |
||
) |
Support set function for large ConvexBase (>32 vertices). Assumes the support set frame has already been computed.
void coal::details::getShapeSupportSet | ( | const Sphere * | sphere, |
SupportSet & | support_set, | ||
int & | , | ||
ShapeSupportData & | , | ||
size_t | num_sampled_supports = 6 , |
||
Scalar | tol = Scalar(1e-3) |
||
) |
Sphere support set function. Assumes the support set frame has already been computed.
void coal::details::getShapeSupportSet | ( | const TriangleP * | triangle, |
SupportSet & | support_set, | ||
int & | , | ||
ShapeSupportData & | , | ||
size_t | num_sampled_supports = 6 , |
||
Scalar | tol = Scalar(1e-3) |
||
) |
Triangle support set function. Assumes the support set frame has already been computed.
Vec3s coal::details::getSupport | ( | const ShapeBase * | shape, |
const Vec3s & | dir, | ||
int & | hint | ||
) |
the support function for shape. The output support point is expressed in the local frame of the shape.
shape | the shape. |
dir | support direction. |
hint | used to initialize the search when shape is a ConvexBase object. |
_SupportOptions | is a value of the SupportOptions enum. If set to WithSweptSphere , the support functions take into account the shapes' swept sphere radii. Please see MinkowskiDiff::set(const ShapeBase*, const ShapeBase*) for more details. |
void coal::details::getSupportSet | ( | const ShapeBase * | shape, |
const Vec3s & | dir, | ||
SupportSet & | support_set, | ||
int & | hint, | ||
size_t | num_sampled_supports = 6 , |
||
Scalar | tol = Scalar(1e-3) |
||
) |
Same as getSupportSet(const ShapeBase*, const Scalar, SupportSet&, const int) but also constructs the support set frame from dir
.
dir
is expressed in the local frame of the shape. direction
of the SupportSet. void coal::details::getSupportSet | ( | const ShapeBase * | shape, |
SupportSet & | support_set, | ||
int & | hint, | ||
size_t | num_sampled_supports = 6 , |
||
Scalar | tol = Scalar(1e-3) |
||
) |
Computes the support set for shape. This function assumes the frame of the support set has already been computed and that this frame is expressed w.r.t the local frame of the shape (i.e. the local frame of the shape is the WORLD frame of the support set). The support direction used to compute the support set is the positive z-axis if the support set has the DEFAULT direction; negative z-axis if it has the INVERTED direction. (In short, a shape's support set is has the DEFAULT direction if the shape is the first shape in a collision pair. It has the INVERTED direction if the shape is the second one in the collision pair).
[in] | shape | the shape. |
[in/out] | support_set of shape. | |
[in/out] | hint used to initialize the search when shape is a ConvexBase object. | |
[in] | num_sampled_supports | is only used for shapes with smooth non-strictly convex bases like cones and cylinders (their bases are circles). In such a case, if the support direction points to their base, we have to choose which points we want to add to the set. This is not needed for boxes or ConvexBase for example. Indeed, because their support sets are always polygons, we can characterize the entire support set with the vertices of the polygon. |
[in] | tol | given a point v on the shape, if max_{p in shape}(p.dot(dir)) - v.dot(dir) <= tol , where dir is the set's support direction, then v is added to the support set. Otherwise said, if a point p of the shape is at a distance tol from the support plane, it is added to the set. Thus, tol can be seen as the "thickness" of the support plane. |
_SupportOptions | is a value of the SupportOptions enum. If set to WithSweptSphere , the support functions take into account the shapes' swept sphere radii. |
|
inline |
p1 | closest (or most penetrating) point on the Halfspace, |
p2 | closest (or most penetrating) point on the shape, |
normal | the halfspace normal. |
|
inline |
return distance between two halfspaces
p1 | the witness point on the first halfspace. |
p2 | the witness point on the second halfspace. |
normal | pointing from first to second halfspace. |
|
inline |
return distance between plane and halfspace.
p1 | the witness point on the halfspace. |
p2 | the witness point on the plane. |
normal | pointing from halfspace to plane. |
|
inline |
p1 | closest (or most penetrating) point on the Plane, |
p2 | closest (or most penetrating) point on the shape, |
normal | the halfspace normal. |
|
inline |
return distance between two planes
p1 | the witness point on the first plane. |
p2 | the witness point on the second plane. |
normal | pointing from first to second plane. |
|
inline |
Whether a point's projection is in a triangle.
|
inline |
the minimum distance from a point to a line
|
inline |
|
inline |
|
inline |
|
inline |