AGX Dynamics  2.37.3.2
MergeSplitAction.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. 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 
19 #include <agxSDK/MergedState.h>
20 
21 namespace agxSDK
22 {
28  {
29  public:
33  static MergeSplitAction empty();
34 
41 
47  static MergeSplitAction merge( const agxSDK::MergedState& mergedState, agx::MergedBody::EdgeInteraction* edge );
48 
53  static MergeSplitAction split( agx::RigidBody* rb, const agxSDK::MergeSplitHandler* handler );
54 
60 
68  static MergeSplitAction split( const agxSDK::MergedState& mergedState, agxSDK::MergedState::Actions action, agx::MergedBody::EdgeInteraction* edge = nullptr );
69 
70  public:
78 
84  MergeSplitAction& sync();
85 
89  const agxSDK::MergedState& getMergedState() const;
90 
95 
99  agx::MergedBody::EdgeInteraction* getEdge() const;
100 
104  agx::Bool isValid() const;
105 
106  private:
107  agxSDK::MergedState m_mergedState;
108  agxSDK::MergedState::Actions m_actionType;
110  };
111 
116  {
117  public:
121 
122  public:
126  MergeSplitActionContainer( agx::UInt capacity = agx::UInt( 256 ) );
127 
131  agx::Bool empty() const;
132 
136  ActionsIterator begin();
137 
141  ActionsConstIterator begin() const;
142 
146  ActionsIterator end();
147 
151  ActionsConstIterator end() const;
152 
160  agx::Bool merge( const agxSDK::MergedState& mergedState, agx::MergedBody::EdgeInteraction* edge );
161 
168  agx::Bool split( const agxSDK::MergedState& mergedState );
169 
176  agx::Bool split( const agxSDK::MergedState& mergedState, agxSDK::MergedState::Actions action );
177 
184  agx::Bool split( const MergedState& mergedState, agx::MergedBody::EdgeInteraction* edge );
185 
193  agx::Bool add( const MergeSplitAction& action );
194 
199  void append( const MergeSplitActionContainer& other );
200 
204  void clear();
205 
206  private:
207  Actions m_actions;
208  };
209 
211  {
212  return m_mergedState;
213  }
214 
216  {
217  return m_actionType;
218  }
219 
221  {
222  return m_edge;
223  }
224 
226  {
227  return m_actions.begin();
228  }
229 
231  {
232  return m_actions.begin();
233  }
234 
236  {
237  return m_actions.end();
238  }
239 
241  {
242  return m_actions.end();
243  }
244 }
AGXTERRAIN_EXPORT void clear()
AGXCORE_EXPORT Type * getType(const agx::String &name)
agx::MergedBody::EdgeInteraction * getEdge() const
bool Bool
Definition: Integer.h:48
Base class for a merge split algorithm handling a set of merged bodies.
#define AGXPHYSICS_EXPORT
const MergeSplitAction * const_iterator
Definition: Vector.h:63
#define AGX_FORCE_INLINE
Definition: Object.h:59
MergeSplitAction * iterator
Definition: Vector.h:62
Object containing merge-split actions to be processed by the agxSDK::MergeSplitHandler.
Object holding merged bodies and state given a pair of rigid bodies.
Definition: MergedState.h:28
uint32_t UInt
Definition: Integer.h:34
Data for merge or split actions created in an implementation of an agxSDK::MergeSplitAlgorithm.
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
agx::Vector< MergeSplitAction > Actions
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)
Actions::const_iterator ActionsConstIterator
agx::BitState< ActionType, agx::Int16 > Actions
Definition: MergedState.h:50
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:30
const agxSDK::MergedState & getMergedState() const
agxSDK::MergedState::Actions getType() const
EdgeInteraction(agx::RigidBody *rb1, agx::RigidBody *rb2, InteractionTag tag, agx::Bool valid=true)
Construct given two rigid bodies and a valid flag.