Collision objects

Description

Collaboration diagram for Collision objects:

Classes

class  chrono::collision::ChCAABBGenerator
 Generator for Axis-Aligned Bounding Boxes. More...
 
class  chrono::collision::ChCBroadphase
 Class for performing broad-phase collision detection. More...
 
class  chrono::collision::ChCNarrowphaseDispatch
 Class for performing narrow-phase collision detection. More...
 
class  chrono::collision::ChCollisionShapeParallel
 Class to encapsulate description of a convex collision shape. More...
 
class  chrono::collision::ChCollisionModelParallel
 Class for geometric model for collision detection. More...
 
class  chrono::collision::ChCollisionSystemBulletParallel
 Collision engine based on the 'Bullet' library. More...
 
class  chrono::collision::ChCollisionSystemParallel
 Class for collision engine based on the spatial subdivision method. More...
 
class  chrono::ChContactContainerParallel
 Class representing a container of many contacts, implemented as a linked list of contact tuples. More...
 
class  chrono::ChContactContainerParallelNSC
 Specialization of the parallel contact container for NSC contacts. More...
 
class  chrono::ChContactContainerParallelSMC
 Specialization of the parallel contact container for SMC contacts. More...
 
class  chrono::collision::ConvexBase
 Base class for convex contact shapes. More...
 
class  chrono::collision::ConvexShape
 Convex contact shape. More...
 
class  chrono::collision::ConvexShapeSphere
 Sphere contact shape. More...
 
class  chrono::collision::ConvexShapeCustom
 Custom contact shape. More...
 
class  chrono::collision::ConvexShapeTetrahedron
 Tetrahedron contact shape. More...
 
class  chrono::collision::ConvexShapeTriangle
 Triangle contact shape. More...
 

Functions

template<class T >
vec3 chrono::collision::HashMin (const T &A, const real3 &inv_bin_size_vec)
 Convert a position into a bin index ("lower" corner).
 
template<class T >
vec3 chrono::collision::HashMax (const T &A, const real3 &inv_bin_size_vec)
 Convert a position into a bin index ("upper" corner).
 
CH_PARALLEL_API bool chrono::collision::MPRContact (const ConvexBase *ShapeA, const ConvexBase *ShapeB, const real &envelope, real3 &returnNormal, real3 &point, real &depth)
 
CH_PARALLEL_API bool chrono::collision::MPRCollision (const ConvexBase *ShapeA, const ConvexBase *ShapeB, real envelope, real3 &returnNormal, real3 &pointA, real3 &pointB, real &depth)
 
CH_PARALLEL_API void chrono::collision::MPRGetPoints (const ConvexBase *ShapeA, const ConvexBase *ShapeB, const real &envelope, real3 &N, real3 p0, real3 &p1, real3 &p2)
 
CH_PARALLEL_API bool chrono::collision::MPRSphereSphere (const ConvexBase *ShapeA, const ConvexBase *ShapeB, real3 &N, real &dist, real3 &p1, real3 &p2)
 
bool chrono::collision::sphere_sphere (const real3 &pos1, const real &radius1, const real3 &pos2, const real &radius2, const real &separation, real3 &norm, real &depth, real3 &pt1, real3 &pt2, real &eff_radius)
 Analytical sphere vs. sphere collision function.
 
bool chrono::collision::capsule_sphere (const real3 &pos1, const quaternion &rot1, const real &radius1, const real &hlen1, const real3 &pos2, const real &radius2, const real &separation, real3 &norm, real &depth, real3 &pt1, real3 &pt2, real &eff_radius)
 Analytical capsule vs. sphere collision function.
 
bool chrono::collision::cylinder_sphere (const real3 &pos1, const quaternion &rot1, const real &radius1, const real &hlen1, const real3 &pos2, const real &radius2, const real &separation, real3 &norm, real &depth, real3 &pt1, real3 &pt2, real &eff_radius)
 Analytical cylinder vs. sphere collision function.
 
bool chrono::collision::roundedcyl_sphere (const real3 &pos1, const quaternion &rot1, const real &radius1, const real &hlen1, const real &srad1, const real3 &pos2, const real &radius2, const real &separation, real3 &norm, real &depth, real3 &pt1, real3 &pt2, real &eff_radius)
 Analytical rounded cylinder vs. sphere collision function.
 
bool chrono::collision::box_sphere (const real3 &pos1, const quaternion &rot1, const real3 &hdims1, const real3 &pos2, const real &radius2, const real &separation, real3 &norm, real &depth, real3 &pt1, real3 &pt2, real &eff_radius)
 Analytical box vs. sphere collision function.
 
bool chrono::collision::roundedbox_sphere (const real3 &pos1, const quaternion &rot1, const real3 &hdims1, const real &srad1, const real3 &pos2, const real &radius2, const real &separation, real3 &norm, real &depth, real3 &pt1, real3 &pt2, real &eff_radius)
 Analytical rounded box vs. sphere collision function.
 
bool chrono::collision::face_sphere (const real3 &A1, const real3 &B1, const real3 &C1, const real3 &pos2, const real &radius2, const real &separation, real3 &norm, real &depth, real3 &pt1, real3 &pt2, real &eff_radius)
 Analytical triangle face vs. sphere collision function.
 
int chrono::collision::capsule_capsule (const real3 &pos1, const quaternion &rot1, const real &radius1, const real &hlen1, const real3 &pos2, const quaternion &rot2, const real &radius2, const real &hlen2, const real &separation, real3 *norm, real *depth, real3 *pt1, real3 *pt2, real *eff_radius)
 Analytical capsule vs. capsule collision function.
 
int chrono::collision::box_capsule (const real3 &pos1, const quaternion &rot1, const real3 &hdims1, const real3 &pos2, const quaternion &rot2, const real &radius2, const real &hlen2, const real &separation, real3 *norm, real *depth, real3 *pt1, real3 *pt2, real *eff_radius)
 Analytical box vs. capsule collision function.
 
int chrono::collision::box_box (const real3 &pos1, const quaternion &rot1, const real3 &hdims1, const real3 &pos2, const quaternion &rot2, const real3 &hdims2, real3 *norm, real *depth, real3 *pt1, real3 *pt2, real *eff_radius)
 Analytical box vs. box collision function (not yet completed).
 
bool chrono::collision::RCollision (const ConvexBase *shapeA, const ConvexBase *shapeB, real separation, real3 *ct_norm, real3 *ct_pt1, real3 *ct_pt2, real *ct_depth, real *ct_eff_rad, int &nC)
 Dispatcher for analytic collision functions. More...
 
void chrono::collision::SetDefaultEdgeRadius (real radius)
 Set the fictitious radius of curvature used for collision with a corner or an edge.
 
real chrono::collision::GetDefaultEdgeRadius ()
 Return the fictitious radius of curvature used for collisions with a corner or an edge.
 
real3 chrono::collision::face_normal (const real3 &A, const real3 &B, const real3 &C)
 This utility function returns the normal to the triangular face defined by the vertices A, B, and C. More...
 
bool chrono::collision::snap_to_face (const real3 &A, const real3 &B, const real3 &C, const real3 &P, real3 &res)
 This utility function takes the location 'P' and snaps it to the closest point on the triangular face with given vertices (A, B, and C). More...
 
uint chrono::collision::snap_to_cylinder (const real &rad, const real &hlen, real3 &loc)
 This utility function snaps the specified location to a point on a cylinder with given radius and half-length. More...
 
uint chrono::collision::snap_to_box (const real3 &hdims, real3 &loc)
 This utility function snaps the specified location to a point on a box with given half-dimensions. More...
 
real3 chrono::collision::box_farthest_corner (const real3 &hdims, const real3 &dir)
 This utility function returns the corner of a box of given dimensions that if farthest in the direction 'dir', which is assumed to be given in the frame of the box.
 
real3 chrono::collision::box_closest_corner (const real3 &hdims, const real3 &dir)
 This utility function returns the corner of a box of given dimensions that if closest in the direction 'dir', which is assumed to be given in the frame of the box.
 
uint chrono::collision::box_closest_feature (const real3 &dir)
 This utility function returns a code that indicates the closest feature of a box in the specified direction. More...
 
bool chrono::collision::box_intersects_box (const real3 &hdims1, const real3 &hdims2, const real3 &pos, const quaternion &rot, real3 &dir)
 This function returns a boolean indicating whether or not a box1 with dimensions hdims1 intersects a second box with the dimensions hdims2. More...
 
real3 chrono::collision::GetSupportPoint_Sphere (const real &radius, const real3 &n)
 Support point for a sphere (for GJK and MPR).
 
real3 chrono::collision::GetSupportPoint_Triangle (const real3 *t, const real3 &n)
 Support point for a triangle (for GJK and MPR).
 
real3 chrono::collision::GetSupportPoint_Box (const real3 &B, const real3 &n)
 Support point for a box (for GJK and MPR).
 
real3 chrono::collision::GetSupportPoint_Ellipsoid (const real3 &B, const real3 &n)
 Support point for an ellipsoid (for GJK and MPR).
 
real3 chrono::collision::GetSupportPoint_Cylinder (const real3 &B, const real3 &n)
 Support point for a cylinder (for GJK and MPR).
 
real3 chrono::collision::GetSupportPoint_Plane (const real3 &B, const real3 &n)
 Support point for a plane (for GJK and MPR).
 
real3 chrono::collision::GetSupportPoint_Cone (const real3 &B, const real3 &n)
 Support point for a cone (for GJK and MPR).
 
real3 chrono::collision::GetSupportPoint_Seg (const real B, const real3 &n)
 Support point for a line segment (for GJK and MPR).
 
real3 chrono::collision::GetSupportPoint_Capsule (const real2 &B, const real3 &n)
 Support point for a capsule (for GJK and MPR).
 
real3 chrono::collision::GetSupportPoint_Disk (const real &B, const real3 &n)
 Support point for a disk (for GJK and MPR).
 
real3 chrono::collision::GetSupportPoint_Rect (const real3 &B, const real3 &n)
 Support point for a rectangle (for GJK and MPR).
 
real3 chrono::collision::GetSupportPoint_RoundedBox (const real4 &B, const real3 &n)
 Support point for a rounded box, i.e. a sphere-swept box (for GJK and MPR).
 
real3 chrono::collision::GetSupportPoint_RoundedCylinder (const real4 &B, const real3 &n)
 Support point for a rounded cylinder, i.e. a sphere-swept cylinder (for GJK and MPR).
 
real3 chrono::collision::GetSupportPoint_RoundedCone (const real4 &B, const real3 &n)
 Support point for a rounded cone, i.e. a sphere-swept cone (for GJK and MPR).
 
real3 chrono::collision::GetSupportPoint_Convex (const int size, const real3 *convex_data, const real3 &n)
 Support point for a gneric convex sphae (for GJK and MPR).
 
real3 chrono::collision::GetSupportPoint_Tetrahedron (const uvec4 indices, const real3 *nodes, const real3 &n)
 Support point for a tetrahedron (for GJK and MPR).
 
real3 chrono::collision::GetCenter_Sphere ()
 
real3 chrono::collision::GetCenter_Triangle (const real3 *t)
 
real3 chrono::collision::GetCenter_Box ()
 
real3 chrono::collision::GetCenter_Ellipsoid ()
 
real3 chrono::collision::GetCenter_Cylinder ()
 
real3 chrono::collision::GetCenter_Plane ()
 
real3 chrono::collision::GetCenter_Cone (const real3 &B)
 
real3 chrono::collision::GetCenter_Convex (const int size, const real3 *convex_data)
 
real3 chrono::collision::GetCenter_Tetrahedron (const uvec4 indices, const real3 *nodes)
 
real3 chrono::collision::SupportVertNoMargin (const chrono::collision::ConvexBase *Shape, const real3 &nv, const real &envelope)
 
real3 chrono::collision::LocalSupportVert (const chrono::collision::ConvexBase *Shape, const real3 &n, const real &envelope)
 
real3 chrono::collision::TransformSupportVert (const chrono::collision::ConvexBase *Shape, const real3 &n, const real &envelope)
 

Function Documentation

◆ box_closest_feature()

uint chrono::collision::box_closest_feature ( const real3 dir)

This utility function returns a code that indicates the closest feature of a box in the specified direction.

The direction 'dir' is assumed to be given in the frame of the box. The return code encodes the box axes that define the closest feature:

  • first bit (least significant) corresponds to x-axis
  • second bit corresponds to y-axis
  • third bit corresponds to z-axis

Therefore: code = 0 indicates a degenerate direction (within a threshold) code = 1 or code = 2 or code = 4 indicates a face code = 3 or code = 5 or code = 6 indicates an edge code = 7 indicates a corner

◆ box_intersects_box()

bool chrono::collision::box_intersects_box ( const real3 hdims1,
const real3 hdims2,
const real3 pos,
const quaternion rot,
real3 dir 
)

This function returns a boolean indicating whether or not a box1 with dimensions hdims1 intersects a second box with the dimensions hdims2.

The check is performed in the local frame of box1. The transform from the other box is given through 'pos' and 'rot'. If an intersection exists, the direction of smallest intersection is returned in 'dir'.

This check is performed by testing 15 possible separating planes between the two boxes (Gottschalk, Lin, Manocha - Siggraph96).

◆ face_normal()

real3 chrono::collision::face_normal ( const real3 A,
const real3 B,
const real3 C 
)

This utility function returns the normal to the triangular face defined by the vertices A, B, and C.

The face is assumed to be non-degenerate. Note that order of vertices is important!

◆ RCollision()

CH_PARALLEL_API bool chrono::collision::RCollision ( const ConvexBase shapeA,
const ConvexBase shapeB,
real  separation,
real3 ct_norm,
real3 ct_pt1,
real3 ct_pt2,
real *  ct_depth,
real *  ct_eff_rad,
int &  nC 
)

Dispatcher for analytic collision functions.

Parameters
shapeAfirst candidate shape
shapeBsecond candidate shape
separationmaximum separation
[out]ct_normcontact normal (per contact pair)
[out]ct_pt1point on shape1 (per contact pair)
[out]ct_pt2point on shape2 (per contact pair)
[out]ct_depthpenetration depth (per contact pair)
[out]ct_eff_radeffective contact radius (per contact pair)
[out]nCnumber of contacts found

◆ snap_to_box()

uint chrono::collision::snap_to_box ( const real3 hdims,
real3 loc 
)

This utility function snaps the specified location to a point on a box with given half-dimensions.

The in/out location is assumed to be specified in the frame of the box (which is therefore assumed to be an AABB centered at the origin). The return code indicates the box axes that caused snapping.

  • first bit (least significant) corresponds to x-axis
  • second bit corresponds to y-axis
  • third bit corresponds to z-axis

Therefore: code = 0 indicates an interior point code = 1 or code = 2 or code = 4 indicates snapping to a face code = 3 or code = 5 or code = 6 indicates snapping to an edge code = 7 indicates snapping to a corner

◆ snap_to_cylinder()

uint chrono::collision::snap_to_cylinder ( const real &  rad,
const real &  hlen,
real3 loc 
)

This utility function snaps the specified location to a point on a cylinder with given radius and half-length.

The in/out location is assumed to be specified in the frame of the cylinder (in this frame the cylinder is assumed to be centered at the origin and aligned with the Y axis). The return code indicates the feature of the cylinder that caused snapping. code = 0 indicates and interior point code = 1 indicates snapping to one of the cylinder caps code = 2 indicates snapping to the cylinder side code = 3 indicates snapping to one of the cylinder edges

◆ snap_to_face()

bool chrono::collision::snap_to_face ( const real3 A,
const real3 B,
const real3 C,
const real3 P,
real3 res 
)

This utility function takes the location 'P' and snaps it to the closest point on the triangular face with given vertices (A, B, and C).

The result is returned in 'res'. Both 'P' and 'res' are assumed to be specified in the same frame as the face vertices. This function returns 'true' if the result is on an edge of this face and 'false' if the result is inside the triangle. Code from Ericson, "Real-time collision detection", 2005, pp. 141