Description

Class for performing narrowphase collision detection.

The default is a hybrid approach where pairs of known primitive shapes are treated analytically with fallback to a Minkovski Portal Refinement algorithm for any other pair of shapes.

Currently supported analytical pair-wise interactions:

         |  sphere   box   rbox   capsule   cylinder   rcyl   trimesh
---------+----------------------------------------------------------
sphere   |    Y       Y      Y       Y         Y        Y        Y
box      |            Y      N       Y         N        N        N
rbox     |                   N       N         N        N        N
capsule  |                           Y         N        N        N
cylinder |                                     N        N        N
rcyl     |                                              N        N
trimesh  |                                                       N

#include <ChNarrowphase.h>

Public Types

enum  Algorithm { Algorithm::MPR, Algorithm::PRIMS, Algorithm::HYBRID }
 Narrowphase algorithm. More...
 

Public Member Functions

void ClearContacts ()
 Clear contact data structures.
 
void Process ()
 Perform narrowphase collision detection. More...
 

Static Public Member Functions

static bool MPRCollision (const ConvexBase *ShapeA, const ConvexBase *ShapeB, real envelope, real3 &normal, real3 &pointA, real3 &pointB, real &depth)
 Minkovski Portal Refinement convex-convex collision detection (adapted from Xeno Collide). More...
 
static bool PRIMSCollision (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 between a pair of candidate shapes. More...
 
static void SetDefaultEdgeRadius (real radius)
 Set the fictitious radius of curvature used for collision with a corner or an edge.
 
static real GetDefaultEdgeRadius ()
 Return the fictitious radius of curvature used for collisions with a corner or an edge.
 

Static Public Attributes

static const int max_neighbors = 64
 
static const int max_rigid_neighbors = 32
 

Friends

class ChCollisionSystemChrono
 
class ChCollisionSystemChronoMulticore
 

Member Enumeration Documentation

◆ Algorithm

Narrowphase algorithm.

Enumerator
MPR 

Minkovski Portal Refinement for convex-convex collision.

PRIMS 

Analytical collision algorithms for primitive shapes.

HYBRID 

Analytical collision algorithms with fallback on MPR.

Member Function Documentation

◆ MPRCollision()

bool chrono::collision::ChNarrowphase::MPRCollision ( const ConvexBase ShapeA,
const ConvexBase ShapeB,
real  envelope,
real3 normal,
real3 pointA,
real3 pointB,
real &  depth 
)
static

Minkovski Portal Refinement convex-convex collision detection (adapted from Xeno Collide).

Each candidate pair can result in 0 or 1 contacts. For each contact, the function calculates and returns:

  • pointA: contact point on first shape (in global frame)
  • pointB: contact point on second shape (in global frame)
  • depth: penetration distance (negative if overlap exists)
  • normal: contact normal, from ct_pt2 to ct_pt1 (in global frame)

◆ PRIMSCollision()

bool chrono::collision::ChNarrowphase::PRIMSCollision ( 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 
)
static

Dispatcher for analytic collision functions between a pair of candidate shapes.

Each candidate pair of shapes can result in 0, 1, or more contacts. For each actual contact, the function calculates various geometrical quantities and load them in the output arguments (starting from the given addresses)

  • ct_pt1: contact point on first shape (in global frame)
  • ct_pt2: contact point on second shape (in global frame)
  • ct_depth: penetration distance (negative if overlap exists)
  • ct_norm: contact normal, from ct_pt2 to ct_pt1 (in global frame)
  • ct_eff_rad: effective contact radius

Note that we also report collisions for which the distance between the two shapes is at most 'separation' (typically twice the collision envelope). In these cases, the corresponding ct_depth is a positive value. This function returns true if it was able to determine the collision state for the given pair of shapes and false if the shape types are not supported.

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

◆ Process()

void chrono::collision::ChNarrowphase::Process ( )

Perform narrowphase collision detection.

This function generates rigid-rigid, fluid-fluid, and rigid-fluid collisions, as applicable. Collision detection results are loaded in the shared data object (see ChCollisionData).


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono/collision/chrono/ChNarrowphase.h
  • /builds/uwsbel/chrono/src/chrono/collision/chrono/ChNarrowphase.cpp
  • /builds/uwsbel/chrono/src/chrono/collision/chrono/ChNarrowphaseMPR.cpp
  • /builds/uwsbel/chrono/src/chrono/collision/chrono/ChNarrowphasePRIMS.cpp