AGX Dynamics  2.38.0.2
MergedState.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 <agx/MergedBody.h>
20 
21 namespace agxSDK
22 {
23  class MergeSplitProperties;
24 
29  {
30  public:
31  enum EState
32  {
33  VALID = 1 << 0,
34  BOTH_ARE_NULL = 1 << 1,
35  ONE_IS_NULL = 1 << 2,
36  BOTH_ARE_VALID = 1 << 3,
37  MERGED_BODIES_ARE_SAME = 1 << 4,
38  MERGED_BODIES_ARE_DIFFERENT = 1 << 5,
39  WIRE_BODY_INCLUDED = 1 << 6,
40  GRANULATE_BODY_INCLUDED = 1 << 7
41  };
42  typedef agx::BitState< EState, agx::Int32 > State;
43 
45  {
46  MERGE = 1 << 0,
47  SPLIT_FIRST = 1 << 1,
48  SPLIT_SECOND = 1 << 2
49  };
50  typedef agx::BitState< ActionType, agx::Int16 > Actions;
51 
52  public:
56  static MergedState invalid();
57 
58  public:
65 
71  MergedState( agxCollide::Geometry* geometry1, agxCollide::Geometry* geometry2, const agxSDK::MergeSplitHandler* handler );
72 
76  State getState() const;
77 
81  Actions getAllowedActions() const;
82 
86  agx::MergedBody* getMergedBody() const;
87 
91  agx::MergedBody* getOtherMergedBody() const;
92 
96  agx::MergedBody* getMergedBody1() const;
97 
101  agx::MergedBody* getMergedBody2() const;
102 
106  agx::RigidBody* getRigidBody1() const;
107 
111  agx::RigidBody* getRigidBody2() const;
112 
116  const agxSDK::MergeSplitProperties* getProperties1() const;
117 
121  const agxSDK::MergeSplitProperties* getProperties2() const;
122 
126  agx::Bool firstIsMerged() const;
127 
131  agx::Bool secondIsMerged() const;
132 
136  agx::Bool isValid() const;
137 
141  MergedState& update();
142 
143  protected:
147  void construct( agx::RigidBody* rb1, agx::RigidBody* rb2 );
148 
149  protected:
150  agx::MergedBody* m_mergedBody[2];
152  agx::RigidBody* m_rigidBodies[2];
153  const agxSDK::MergeSplitProperties* m_properties[2];
156  };
157 
159  {
160  public:
164  static ConstraintMergedState invalid();
165 
166  public:
173 
177  const agxSDK::MergeSplitProperties* getConstraintProperties() const;
178 
179  protected:
181 
182  private:
184  };
185 
187  {
188  return m_state;
189  }
190 
192  {
193  return m_allowedActions;
194  }
195 
197  {
198  return m_state.Is( VALID );
199  }
200 }
agxSDK::MergeSplitProperties
Definition: MergeSplitProperties.h:38
agx::Int16
int16_t Int16
Definition: Integer.h:36
agx::RigidBody
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:51
agxSDK::MergedState::EState
EState
Definition: MergedState.h:31
agxSDK::MergedState::m_state
State m_state
Definition: MergedState.h:154
agxSDK::MergedState::getState
State getState() const
Definition: MergedState.h:186
agxSDK::MergedState::m_preferredMergedBody
agx::MergedBody * m_preferredMergedBody
Definition: MergedState.h:151
agxSDK::ConstraintMergedState
Definition: MergedState.h:158
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agxSDK::MergedState::Actions
agx::BitState< ActionType, agx::Int16 > Actions
Definition: MergedState.h:50
agxSDK::MergeSplitHandler
Base class for a merge split algorithm handling a set of merged bodies.
Definition: MergeSplitHandler.h:34
agxSDK::MergedState
Object holding merged bodies and state given a pair of rigid bodies.
Definition: MergedState.h:28
agxSDK::MergedState::VALID
@ VALID
Valid state.
Definition: MergedState.h:33
agxSDK::MergedState::State
agx::BitState< EState, agx::Int32 > State
Definition: MergedState.h:42
agxSDK::MergedState::ActionType
ActionType
Definition: MergedState.h:44
MergedBody.h
agxCollide::Geometry
The geometry representation used by the collision detection engine.
Definition: Geometry.h:91
agx::HighLevelConstraintImplementation
Definition: ConstraintImplementation.h:1028
agx::Bool
bool Bool
Definition: Integer.h:40
agxSDK::MergedState::getAllowedActions
Actions getAllowedActions() const
Definition: MergedState.h:191
agxSDK::ConstraintMergedState::m_constraintProperties
const agxSDK::MergeSplitProperties * m_constraintProperties
Definition: MergedState.h:180
agxSDK
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:30
agxSDK::MergedState::m_allowedActions
Actions m_allowedActions
Definition: MergedState.h:155
agxSDK::MergedState::isValid
agx::Bool isValid() const
Definition: MergedState.h:196
agx::MergedBody
Structure holding several "normal" rigid bodies.
Definition: MergedBody.h:55
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition: macros.h:58