AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
ExecuteFilter.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
20
21#include <agx/Referenced.h>
23#include <agxCollide/Contacts.h>
24
25
26namespace agxSDK
27{
29
34 {
35 public:
43 virtual bool match(const agxCollide::GeometryContact& gc) const;
44
51 virtual bool match(const agxCollide::GeometryPair& geometryPair) const;
52
57 virtual bool match(const agxCollide::Geometry* geometry1, const agxCollide::Geometry* geometry2) const;
58
59 protected:
64
68 virtual ~ExecuteFilter();
69 };
70
71
72
74 template <typename T>
75 inline bool matchFilter(const agxCollide::Geometry*, const T*);
76
81 template <typename T1, typename T2>
83 {
84 public:
89 ExecuteFilterT( const T1* t1, const T2* t2 = nullptr );
90
92 virtual bool match( const agxCollide::Geometry*, const agxCollide::Geometry* ) const override;
93
95
96 protected:
97 virtual ~ExecuteFilterT();
98
99
100 protected:
103 };
104
105
107
108
110 {
111 return match(gc.geometry(0), gc.geometry(1));
112 }
113
114
115 AGX_FORCE_INLINE bool ExecuteFilter::match(const agxCollide::GeometryPair& geometryPair) const
116 {
117 return match(geometryPair.first, geometryPair.second);
118 }
119
121 {
122 return false;
123 }
124
125
126 template <typename T1, typename T2>
127 ExecuteFilterT<T1, T2>::ExecuteFilterT( const T1* t1, const T2* t2 )
128 : m_t1( t1 ), m_t2( t2 )
129 {
130 }
131
132
133 template <typename T1, typename T2>
135 {
136 const bool f =
137 (matchFilter(geo1, m_t1.get()) && matchFilter(geo2, m_t2.get())) || // Both match
138 (matchFilter(geo2, m_t1.get()) && matchFilter(geo1, m_t2.get())); // Both match
139
140 return f;
141 }
142
143
144 template<typename T1, typename T2>
148
149
150} // namespace agxSDK
151
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXPHYSICS_EXPORT
A contact between two geometries.
Definition Contacts.h:271
agxCollide::Geometry * geometry(size_t ith)
Definition Contacts.h:637
The geometry representation used by the collision detection engine.
Definition Geometry.h:92
Templated version of ExecuteFilter, for objects which contain geometries and inherit from agx::Refere...
ExecuteFilterT(const T1 *t1, const T2 *t2=nullptr)
Create an ExecuteFilter with one or two conditions.
virtual bool match(const agxCollide::Geometry *, const agxCollide::Geometry *) const override
Inherited from agxSDK::ExecuteFilter.
agx::ref_ptr< const T2 > m_t2
agx::ref_ptr< const T1 > m_t1
Abstract base class that implements a filter that selects which events should trigger a Listener.
virtual ~ExecuteFilter()
Destructor.
virtual bool match(const agxCollide::GeometryContact &gc) const
Called when narrow phase tests have determined overlap (when we have detailed intersection between th...
ExecuteFilter()
Default, hidden constructor.
Base class providing referencing counted objects.
Definition Referenced.h:120
Smart pointer for handling referenced counted objects.
Definition ref_ptr.h:30
#define AGX_FORCE_INLINE
Definition macros.h:58
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition Constraint.h:31
bool matchFilter(const agxCollide::Geometry *geo, const agxSDK::Assembly *a)