AGX Dynamics  2.35.0.1
MergeSplitAction.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 
19 #include <agxSDK/MergedState.h>
20 
21 namespace agxSDK
22 {
28  {
29  public:
34 
41 
48 
54 
60 
69 
70  public:
78 
85 
89  const agxSDK::MergedState& getMergedState() const;
90 
95 
99  agx::MergedBody::EdgeInteraction* getEdge() const;
100 
105 
106  private:
107  agxSDK::MergedState m_mergedState;
108  agxSDK::MergedState::Actions m_actionType;
110  };
111 
116  {
117  public:
121 
122  public:
127 
131  agx::Bool empty() const;
132 
137 
141  ActionsConstIterator begin() const;
142 
147 
151  ActionsConstIterator end() const;
152 
161 
168  agx::Bool split( const agxSDK::MergedState& mergedState );
169 
177 
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 }
#define AGXPHYSICS_EXPORT
Object containing merge-split actions to be processed by the agxSDK::MergeSplitHandler.
agx::Bool add(const MergeSplitAction &action)
Adds the action to the container.
MergeSplitActionContainer(agx::UInt capacity=agx::UInt(256))
Default constructor.
agx::Vector< MergeSplitAction > Actions
void append(const MergeSplitActionContainer &other)
Append actions to this container.
agx::Bool split(const agxSDK::MergedState &mergedState, agxSDK::MergedState::Actions action)
Split given action mask.
Actions::const_iterator ActionsConstIterator
agx::Bool merge(const agxSDK::MergedState &mergedState, agx::MergedBody::EdgeInteraction *edge)
Merge given merged state and an edge.
agx::Bool split(const agxSDK::MergedState &mergedState)
Split given allowed actions in the merged state.
agx::Bool split(const MergedState &mergedState, agx::MergedBody::EdgeInteraction *edge)
Split a single edge.
Data for merge or split actions created in an implementation of an agxSDK::MergeSplitAlgorithm.
MergeSplitAction(const agxSDK::MergedState &mergedState, agxSDK::MergedState::Actions actionType, agx::MergedBody::EdgeInteraction *edge=nullptr)
Construct given merged state, type of action and (optional) an edge to add or remove.
static MergeSplitAction merge(const agxSDK::MergedState &mergedState, agx::MergedBody::EdgeInteraction *edge)
Creates a merge action given a merged state and an edge.
agx::MergedBody::EdgeInteraction * getEdge() const
static MergeSplitAction merge(agx::MergedBody::EdgeInteraction *edge, const agxSDK::MergeSplitHandler *handler)
Creates a merge action given an edge and the merge split handler.
static MergeSplitAction empty()
Creates an empty action.
static MergeSplitAction split(agx::RigidBody *rb, const agxSDK::MergeSplitHandler *handler)
Creates a split action given a rigid body and the merge split handler.
const agxSDK::MergedState & getMergedState() const
static MergeSplitAction split(const agxSDK::MergedState &mergedState, agxSDK::MergedState::Actions action, agx::MergedBody::EdgeInteraction *edge=nullptr)
Creates a split action given a merged state and action.
agxSDK::MergedState::Actions getType() const
static MergeSplitAction split(agx::MergedBody::EdgeInteraction *edge, const agxSDK::MergeSplitHandler *handler)
Creates a split action given an edge and the merge split handler (to fetch allowed actions,...
MergeSplitAction & sync()
Synchronizes data to current state, e.g., bodies that has been merged or splitted after this action w...
agx::Bool isValid() const
Base class for a merge split algorithm handling a set of merged bodies.
Object holding merged bodies and state given a pair of rigid bodies.
Definition: MergedState.h:29
agx::BitState< ActionType, agx::Int16 > Actions
Definition: MergedState.h:50
EdgeInteraction(agx::RigidBody *rb1, agx::RigidBody *rb2, InteractionTag tag, agx::Bool valid=true)
Construct given two rigid bodies and a valid flag.
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:55
iterator end()
Definition: agx/Vector.h:1044
const MergeSplitAction * const_iterator
Definition: agx/Vector.h:63
iterator begin()
Definition: agx/Vector.h:1041
MergeSplitAction * iterator
Definition: agx/Vector.h:62
#define AGX_FORCE_INLINE
Definition: macros.h:58
AGXCORE_EXPORT Type * getType(const agx::String &name)
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:31
bool Bool
Definition: Integer.h:48
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
uint32_t UInt
Definition: Integer.h:34
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)