AGX Dynamics  2.35.0.1
MultiCollisionFilterContactHandler.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #pragma once
18 
21 
22 namespace agxSDK
23 {
25 
37  {
38  public:
43 
50  void add( ExecuteFilter* filter, int activationMask );
51 
56  void remove( ExecuteFilter* filter );
57 
63  void setActivationMask( ExecuteFilter* filter, int activationMask );
64 
69  int getActivationMask( const ExecuteFilter* filter ) const;
70 
75 
80 
87  void collectContactIndices( const ExecuteFilter* filter, agx::UInt32Vector& contactIndices ) const;
88 
93  const agx::UInt32Vector& getContactIndices( const ExecuteFilter* filter ) const;
94 
99  void collectSeparations( const ExecuteFilter* filter, agxCollide::GeometryPairVector& separations) const;
100 
105  agxCollide::GeometryContact* getGeometryContact( agx::UInt32 index ) const;
106 
107  public:
109  void addNotification() override;
110 
111  void removeNotification() override;
112 
113  void pre( const agx::TimeStamp& time ) override;
114 
115  void post( const agx::TimeStamp& time ) override;
116 
120  agx::UInt32 getContactIndex( agxCollide::GeometryContact* geometryContact );
122 
123  protected:
128 
129  private:
133  void reset();
134 
135  private:
136  agxCollide::GeometryContactPtrVector m_geometryContacts;
137  agx::HashTable<agxCollide::GeometryContact*, agx::UInt32> m_geometryContactIndexTable;
138  agx::HashVector<const ExecuteFilter*, ContactEventListenerRef> m_contactListeners;
139  agx::UInt32 m_contactPointCounter = 0;
140  };
141 
142  inline agxCollide::GeometryContact* MultiCollisionFilterContactHandler::getGeometryContact( agx::UInt32 index ) const
143  {
144  if ( index >= (agx::UInt32)m_geometryContacts.size() )
145  return nullptr;
146  return m_geometryContacts[ index ];
147  }
148 }
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGXPHYSICS_EXPORT
A contact between two geometries.
Definition: Contacts.h:270
Abstract base class that implements a filter that selects which events should trigger a Listener.
Definition: ExecuteFilter.h:35
A step event listener managing N contact event listeners with different filters.
void remove(ExecuteFilter *filter)
Removes the given filter and its corresponding contact event listener.
int getActivationMask(const ExecuteFilter *filter) const
void collectSeparations(const ExecuteFilter *filter, agxCollide::GeometryPairVector &separations) const
void setActivationMask(ExecuteFilter *filter, int activationMask)
Assign new activation mask to the contact listener representing the given filter.
const agx::UInt32Vector & getContactIndices(const ExecuteFilter *filter) const
void add(ExecuteFilter *filter, int activationMask)
Add a contact filter with an activation mask, e.g., agxSDK::ContactEventListener::IMPACT | agxSDK::Co...
void collectContactIndices(const ExecuteFilter *filter, agx::UInt32Vector &contactIndices) const
Collect geometry contact indices for the given filter.
MultiCollisionFilterContactHandler()
Default constructor.
Derive from this class to implement a listener for simulation step events.
Templated vector class.
Definition: agx/Vector.h:53
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
This namespace consists of a set of classes for handling geometric intersection tests including boole...
agx::VectorPOD< GeometryContact * > GeometryContactPtrVector
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:31
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint32_t UInt32
Definition: Integer.h:40
LinearProbingHashTable< KeyT, DataT, HashT, AllocatorT > HashTable
Definition: HashTable.h:24
agx::Real TimeStamp
Definition: TimeStamp.h:26