AGXDynamics  2.35.0.3
ExecuteFilter.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 #ifndef AGXSDK_EXECUTE_FILTER_H
18 #define AGXSDK_EXECUTE_FILTER_H
19 
20 #include <agx/agxPhysics_export.h>
21 
22 #include <agx/Referenced.h>
24 #include <agxCollide/Contacts.h>
25 
26 
27 namespace agxSDK
28 {
30 
35  {
36  public:
44  virtual bool match(const agxCollide::GeometryContact& gc) const;
45 
52  virtual bool match(const agxCollide::GeometryPair& geometryPair) const;
53 
58  virtual bool match(const agxCollide::Geometry* geometry1, const agxCollide::Geometry* geometry2) const;
59 
60  protected:
64  ExecuteFilter();
65 
69  virtual ~ExecuteFilter();
70  };
71 
72 
73 
75  template <typename T>
76  inline bool matchFilter(const agxCollide::Geometry*, const T*);
77 
82  template <typename T1, typename T2>
84  {
85  public:
90  ExecuteFilterT( const T1* t1, const T2* t2 = nullptr );
91 
93  virtual bool match( const agxCollide::Geometry*, const agxCollide::Geometry* ) const override;
94 
96 
97  protected:
98  virtual ~ExecuteFilterT();
99 
100 
101  protected:
104  };
105 
106 
108 
109 
111  {
112  return match(gc.geometry(0), gc.geometry(1));
113  }
114 
115 
117  {
118  return match(geometryPair.first, geometryPair.second);
119  }
120 
122  {
123  return false;
124  }
125 
126 
127  template <typename T1, typename T2>
128  ExecuteFilterT<T1, T2>::ExecuteFilterT( const T1* t1, const T2* t2 )
129  : m_t1( t1 ), m_t2( t2 )
130  {
131  }
132 
133 
134  template <typename T1, typename T2>
136  {
137  const bool f =
138  (matchFilter(geo1, m_t1.get()) && matchFilter(geo2, m_t2.get())) || // Both match
139  (matchFilter(geo2, m_t1.get()) && matchFilter(geo1, m_t2.get())); // Both match
140 
141  return f;
142  }
143 
144 
145  template<typename T1, typename T2>
147  {
148  }
149 
150 
151 } // namespace agxSDK
152 
153 #endif
154 
155 
agxPhysics_export.h
Referenced.h
agxSDK::ExecuteFilter::match
virtual bool match(const agxCollide::GeometryContact &gc) const
Called when narrow phase tests have determined overlap (when we have detailed intersection between th...
Definition: ExecuteFilter.h:110
agxData::GeometryPair
agx::SymmetricPair< agx::Physics::GeometryPtr > GeometryPair
Definition: Geometry.h:66
agxSDK::ExecuteFilter
Abstract base class that implements a filter that selects which events should trigger a Listener.
Definition: ExecuteFilter.h:34
agxSDK::ExecuteFilterT::m_t2
agx::ref_ptr< const T2 > m_t2
Definition: ExecuteFilter.h:103
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agxSDK::ExecuteFilterT::ExecuteFilterT
ExecuteFilterT(const T1 *t1, const T2 *t2=nullptr)
Create an ExecuteFilter with one or two conditions.
Definition: ExecuteFilter.h:128
agx::ref_ptr< const T1 >
agxSDK::ExecuteFilterT::match
virtual bool match(const agxCollide::Geometry *, const agxCollide::Geometry *) const override
Inherited from agxSDK::ExecuteFilter.
Definition: ExecuteFilter.h:135
agxCollide::Geometry
The geometry representation used by the collision detection engine.
Definition: Geometry.h:92
GeometryPair.h
agxCollide::GeometryContact::geometry
agxCollide::Geometry * geometry(size_t ith)
Definition: Contacts.h:636
agxSDK::ExecuteFilterT::m_t1
agx::ref_ptr< const T1 > m_t1
Definition: ExecuteFilter.h:102
agxSDK::ExecuteFilterT::~ExecuteFilterT
virtual ~ExecuteFilterT()
Definition: ExecuteFilter.h:146
agx::Referenced
Base class providing referencing counted objects.
Definition: Referenced.h:113
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
agxCollide::GeometryContact
A contact between two geometries.
Definition: Contacts.h:269
Contacts.h
agxSDK
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:30
agxSDK::matchFilter
bool matchFilter(const agxCollide::Geometry *geo, const agxSDK::Assembly *a)
Definition: AssemblyFilter.h:30
agxSDK::ExecuteFilterT
Templated version of ExecuteFilter, for objects which contain geometries and inherit from agx::Refere...
Definition: ExecuteFilter.h:83
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition: macros.h:58