AGX Dynamics  2.35.0.1
MergedState.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 <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 
72 
76  State getState() const;
77 
81  Actions getAllowedActions() const;
82 
87 
92 
97 
102 
107 
112 
117 
122 
127 
132 
136  agx::Bool isValid() const;
137 
142 
143  protected:
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:
165 
166  public:
173 
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 }
#define AGXPHYSICS_EXPORT
The geometry representation used by the collision detection engine.
Definition: Geometry.h:93
const agxSDK::MergeSplitProperties * getConstraintProperties() const
static ConstraintMergedState invalid()
Creates an invalid merged state.
const agxSDK::MergeSplitProperties * m_constraintProperties
Definition: MergedState.h:180
ConstraintMergedState(const agx::HighLevelConstraintImplementation *constraint, const agxSDK::MergeSplitHandler *handler)
Find merged state given constraint.
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< EState, agx::Int32 > State
Definition: MergedState.h:42
MergedState(agxCollide::Geometry *geometry1, agxCollide::Geometry *geometry2, const agxSDK::MergeSplitHandler *handler)
Find merged state given two geometries.
agx::Bool isValid() const
Definition: MergedState.h:196
State getState() const
Definition: MergedState.h:186
@ VALID
Valid state.
Definition: MergedState.h:33
static MergedState invalid()
Creates an invalid merged state.
Actions m_allowedActions
Definition: MergedState.h:155
const agxSDK::MergeSplitProperties * getProperties2() const
const agxSDK::MergeSplitProperties * getProperties1() const
agx::Bool firstIsMerged() const
agx::MergedBody * getMergedBody2() const
agx::BitState< ActionType, agx::Int16 > Actions
Definition: MergedState.h:50
agx::Bool secondIsMerged() const
agx::MergedBody * m_preferredMergedBody
Definition: MergedState.h:151
agx::RigidBody * getRigidBody1() const
MergedState(agx::RigidBody *rb1, agx::RigidBody *rb2, const agxSDK::MergeSplitHandler *handler)
Find merged state given two rigid bodies.
agx::MergedBody * getMergedBody() const
agx::MergedBody * getMergedBody1() const
agx::RigidBody * getRigidBody2() const
MergedState & update()
Update the current state of how the bodies are merged and return this.
Actions getAllowedActions() const
Definition: MergedState.h:191
void construct(agx::RigidBody *rb1, agx::RigidBody *rb2)
Delegating constructor.
agx::MergedBody * getOtherMergedBody() const
Structure holding several "normal" rigid bodies.
Definition: MergedBody.h:56
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:55
#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 Bool
Definition: Integer.h:48
int16_t Int16
Definition: Integer.h:44