chrono::collision::ChCollisionSystem Class Referenceabstract

Description

Base class for generic collision engine.

Most methods are 'pure virtual': they need to be implemented by child classes.

#include <ChCCollisionSystem.h>

Inheritance diagram for chrono::collision::ChCollisionSystem:
Collaboration diagram for chrono::collision::ChCollisionSystem:

Classes

struct  ChRayhitResult
 This will be used to recover results from RayHit() raycasting. More...
 

Public Member Functions

 ChCollisionSystem (unsigned int max_objects=16000, double scene_size=500)
 
virtual void Clear (void)=0
 Clears all data instanced by this algorithm if any (like persistent contact manifolds)
 
virtual void Add (ChCollisionModel *model)=0
 Adds a collision model to the collision engine (custom data may be allocated). More...
 
virtual void Remove (ChCollisionModel *model)=0
 Removes a collision model from the collision engine (custom data may be deallocated). More...
 
virtual void Run ()=0
 Removes all collision models from the collision engine (custom data may be deallocated). More...
 
virtual void ReportContacts (ChContactContainerBase *mcontactcontainer)=0
 After the Run() has completed, you can call this function to fill a 'contact container', that is an object inherited from class ChContactContainerBase. More...
 
virtual void ReportProximities (ChProximityContainerBase *mproximitycontainer)=0
 After the Run() has completed, you can call this function to fill a 'proximity container' (container of narrow phase pairs), that is an object inherited from class ChProximityContainerBase. More...
 
void SetBroadPhaseCallback (ChBroadPhaseCallback *mcallback)
 Sets the user ChBroadPhaseCallback to be used to tell the near-enough pairs found during the Run() execution. More...
 
void SetNarrowPhaseCallback (ChNarrowPhaseCallback *mcallback)
 Sets the used ChNarrowPhaseCallback to be used to report the contacts found during the Run() execution. More...
 
virtual bool RayHit (const ChVector<> &from, const ChVector<> &to, ChRayhitResult &mresult)=0
 Perform a ray-hit test with the collision models.
 
virtual void ArchiveOUT (ChArchiveOut &marchive)
 
virtual void ArchiveIN (ChArchiveIn &marchive)
 

Protected Attributes

ChBroadPhaseCallbackbroad_callback
 
ChNarrowPhaseCallbacknarrow_callback
 

Member Function Documentation

virtual void chrono::collision::ChCollisionSystem::Add ( ChCollisionModel model)
pure virtual
virtual void chrono::collision::ChCollisionSystem::Remove ( ChCollisionModel model)
pure virtual
virtual void chrono::collision::ChCollisionSystem::ReportContacts ( ChContactContainerBase mcontactcontainer)
pure virtual

After the Run() has completed, you can call this function to fill a 'contact container', that is an object inherited from class ChContactContainerBase.

For instance ChSystem, after each Run() collision detection, calls this method multiple times for all contact containers in the system, Children classes must implement this. The basic behavior of the implementation should be the following: collision system will call in sequence the functions BeginAddContact(), AddContact() (x n times), EndAddContact() of the contact container. In case a specialized implementation (ex. a GPU parallel collision engine) finds that the contact container is a specialized one (ex with a GPU buffer) it can call more performant methods to add directly the contacts in batches, for instance by recognizing that he can call, say, some special AddAllContactsAsGpuBuffer() instead of many AddContact().

Implemented in chrono::collision::ChCollisionSystemSpheres, chrono::collision::ChCollisionSystemBulletParallel, chrono::collision::ChCollisionSystemBulletParallel, chrono::collision::ChCollisionSystemParallel, chrono::collision::ChCollisionSystemBullet, and chrono::collision::ChCollisionSystemParallel.

virtual void chrono::collision::ChCollisionSystem::ReportProximities ( ChProximityContainerBase mproximitycontainer)
pure virtual

After the Run() has completed, you can call this function to fill a 'proximity container' (container of narrow phase pairs), that is an object inherited from class ChProximityContainerBase.

For instance ChSystem, after each Run() collision detection, calls this method multiple times for all proximity containers in the system, Children classes must implement this. The basic behavior of the implementation should be the following: collision system will call in sequence the functions BeginAddProximities(), AddProximity() (x n times), EndAddProximities() of the proximity container. In case a specialized implementation (ex. a GPU parallel collision engine) finds that the proximity container is a specialized one (ex with a GPU buffer) it can call more performant methods to add directly the proximities in batches, for instance by recognizing that he can call, say, some special AddAllProximitiesAsGpuBuffer() instead of many AddProximity().

Implemented in chrono::collision::ChCollisionSystemSpheres, chrono::collision::ChCollisionSystemBulletParallel, chrono::collision::ChCollisionSystemBulletParallel, chrono::collision::ChCollisionSystemParallel, chrono::collision::ChCollisionSystemBullet, and chrono::collision::ChCollisionSystemParallel.

virtual void chrono::collision::ChCollisionSystem::Run ( )
pure virtual

Removes all collision models from the collision engine (custom data may be deallocated).

RUN THE ALGORITHM and finds the contacts. This is the most important function - it will be called at each simulation step. Children classes must implement this.

Implemented in chrono::collision::ChCollisionSystemSpheres, chrono::collision::ChCollisionSystemBulletParallel, chrono::collision::ChCollisionSystemBulletParallel, chrono::collision::ChCollisionSystemParallel, chrono::collision::ChCollisionSystemBullet, and chrono::collision::ChCollisionSystemParallel.

void chrono::collision::ChCollisionSystem::SetBroadPhaseCallback ( ChBroadPhaseCallback mcallback)

Sets the user ChBroadPhaseCallback to be used to tell the near-enough pairs found during the Run() execution.

It will be executed for near enough pair of bodies.

void chrono::collision::ChCollisionSystem::SetNarrowPhaseCallback ( ChNarrowPhaseCallback mcallback)

Sets the used ChNarrowPhaseCallback to be used to report the contacts found during the Run() execution.

It will be executed for each contact point.