Description
Base class for generic collision engine.
#include <ChCollisionSystem.h>


Classes | |
| class | BroadphaseCallback |
| Class to be used as a callback interface for user-defined actions to be performed during broadphase. More... | |
| struct | ChRayhitResult |
| Recover results from RayHit() raycasting. More... | |
| class | NarrowphaseCallback |
| Class to be used as a callback interface for user-defined actions to be performed during narrowphase. More... | |
| class | VisualizationCallback |
| Class to be used as a callback interface for user-defined visualization of collision shapes. More... | |
Public Types | |
| enum | Type { Type::BULLET, Type::MULTICORE } |
| Supported collision systems. More... | |
| enum | VisualizationModes { VIS_None = 0, VIS_Shapes = 1 << 0, VIS_Aabb = 1 << 1, VIS_Contacts = 1 << 2, VIS_MAX_MODES } |
| Enumeration of supported flags for collision debug visualization. More... | |
Public Member Functions | |
| bool | IsInitialized () const |
| Test if the collision system was initialized. | |
| virtual void | Initialize () |
| Initialize the collision system. More... | |
| virtual void | BindAll () |
| Process all collision models in the associated Chrono system. More... | |
| virtual void | BindItem (std::shared_ptr< ChPhysicsItem > item) |
| Process the collision models associated with the specified Chrono physics item. More... | |
| void | UnbindItem (std::shared_ptr< ChPhysicsItem > item) |
| Remove any collision models associated with the specified physics item from the collision engine. | |
| virtual void | Clear ()=0 |
| Clears all data instanced by this algorithm if any. | |
| virtual void | Add (std::shared_ptr< ChCollisionModel > model)=0 |
| Add the specified collision model to the collision engine. | |
| virtual void | Remove (std::shared_ptr< ChCollisionModel > model)=0 |
| Remove the specified collision model from the collision engine. | |
| virtual void | PreProcess () |
| Optional synchronization operations, invoked before running the collision detection. | |
| virtual void | Run ()=0 |
| Run the collision detection and finds the contacts. More... | |
| virtual void | PostProcess () |
| Optional synchronization operations, invoked after running the collision detection. | |
| virtual ChAABB | GetBoundingBox () const =0 |
| Return an AABB bounding all collision shapes in the system. | |
| virtual double | GetTimerCollisionBroad () const =0 |
| Return the time (in seconds) for broadphase collision detection. | |
| virtual double | GetTimerCollisionNarrow () const =0 |
| Return the time (in seconds) for narrowphase collision detection. | |
| virtual void | ResetTimers () |
| Reset any timers associated with collision detection. | |
| virtual void | SetNumThreads (int nthreads) |
| Set the number of OpenMP threads for collision detection. More... | |
| virtual void | ReportContacts (ChContactContainer *contact_container)=0 |
| Report contacts (fill the provided 'contact container'). More... | |
| virtual void | ReportProximities (ChProximityContainer *proximity_container)=0 |
| Report proximities (fill in the provided 'proximity container'). More... | |
| void | RegisterBroadphaseCallback (std::shared_ptr< BroadphaseCallback > callback) |
| Register a broadphase callback object. | |
| void | RegisterNarrowphaseCallback (std::shared_ptr< NarrowphaseCallback > callback) |
| Register a narrowphase callback object. | |
| virtual bool | RayHit (const ChVector3d &from, const ChVector3d &to, ChRayhitResult &result) const =0 |
| Perform a ray-hit test with the collision models. | |
| virtual bool | RayHit (const ChVector3d &from, const ChVector3d &to, ChCollisionModel *model, ChRayhitResult &result) const =0 |
| Perform a ray-hit test with the specified collision model. | |
| virtual void | RegisterVisualizationCallback (std::shared_ptr< VisualizationCallback > callback) |
| Specify a callback object to be used for debug rendering of collision shapes. | |
| virtual void | Visualize (int flags) |
| Method to trigger debug visualization of collision shapes. More... | |
| virtual void | ArchiveOut (ChArchiveOut &archive_out) |
| Method to allow serialization of transient data to archives. | |
| virtual void | ArchiveIn (ChArchiveIn &archive_in) |
| Method to allow de-serialization of transient data from archives. | |
| void | SetSystem (ChSystem *sys) |
| Set associated Chrono system. | |
Protected Attributes | |
| bool | m_initialized |
| ChSystem * | m_system |
| associated Chrono system | |
| std::shared_ptr< BroadphaseCallback > | broad_callback |
| user callback for each near-enough pair of shapes | |
| std::shared_ptr< NarrowphaseCallback > | narrow_callback |
| user callback for each collision pair | |
| std::shared_ptr< VisualizationCallback > | vis_callback |
| user callback for debug visualization | |
| int | m_vis_flags |
Member Enumeration Documentation
◆ Type
|
strong |
◆ VisualizationModes
Member Function Documentation
◆ BindAll()
|
virtual |
Process all collision models in the associated Chrono system.
This function is called by default for a Chrono system attached to this collision system during initialization, but can also be called later if further modifications to collision models occur.
◆ BindItem()
|
virtual |
Process the collision models associated with the specified Chrono physics item.
This function must be called if a new physics item is added to the system or if changes to its collision model occur after the collision system was initialized.
◆ Initialize()
|
virtual |
Initialize the collision system.
This call must trigger a parsing of the associated Chrono system to process all collision models.
◆ ReportContacts()
|
pure virtual |
Report contacts (fill the provided 'contact container').
This function, which should only be called after Run(), must add to the contact container contacts corresponding to all detected pairwise collisions. The basic behavior of the implementation should call in sequence the ChContactContainer functions BeginAddContact(), AddContact() (multiple times), and EndAddContact().
Implemented in chrono::ChCollisionSystemChronoMulticore, chrono::ChCollisionSystemMulticore, and chrono::ChCollisionSystemBullet.
◆ ReportProximities()
|
pure virtual |
Report proximities (fill in the provided 'proximity container').
This function, which should only be called after Run(), must add to the contact container contacts corresponding to all detected pairwise collisions. The basic behavior of the implementation should call in sequence the ChContactContainer functions BeginAddProximities(), AddProximity() (multiple times), and EndAddProximities().
Implemented in chrono::ChCollisionSystemMulticore, chrono::ChCollisionSystemBullet, and chrono::ChCollisionSystemChronoMulticore.
◆ Run()
|
pure virtual |
Run the collision detection and finds the contacts.
This function will be called at each simulation step.
Implemented in chrono::ChCollisionSystemMulticore, and chrono::ChCollisionSystemBullet.
◆ SetNumThreads()
|
inlinevirtual |
Set the number of OpenMP threads for collision detection.
The default implementation does nothing. Derived classes implement this function as applicable.
Reimplemented in chrono::ChCollisionSystemMulticore, chrono::ChCollisionSystemBullet, and chrono::ChCollisionSystemChronoMulticore.
◆ Visualize()
|
inlinevirtual |
Method to trigger debug visualization of collision shapes.
The 'flags' argument can be any of the VisualizationModes enums, or a combination thereof (using bit-wise operators). The calling program must invoke this function from within the simulation loop. A derived class should implement a no-op if a visualization callback was not specified.
Reimplemented in chrono::ChCollisionSystemMulticore, and chrono::ChCollisionSystemBullet.
The documentation for this class was generated from the following files:
- /builds/uwsbel/chrono/src/chrono/collision/ChCollisionSystem.h
- /builds/uwsbel/chrono/src/chrono/collision/ChCollisionSystem.cpp