AGX Dynamics  2.37.3.2
GranularContactMergeSplitAlgorithm.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 
21 
22 namespace agxSDK
23 {
25 
27  {
28  public:
30  {
31  VALID = 1 << 0,
32  IMPACTING = 1 << 1,
33  SLIDING = 1 << 2,
34  ROLLING = 1 << 3,
35  RESTING = 1 << 4
36  };
37  typedef agx::BitState<EContactState, agx::Int32> ContactState;
38 
39  public:
44 
46 
47  static agx::Physics::GranularBodyPtr ConvertRigidBodyGranulateToGranularBody(agxSDK::Simulation * simulation, agx::RigidBody * rb);
48 
49  protected:
50 
51  GranularContactMergeSplitAlgorithm::ContactState findContactState(const agx::Vec3& point,
52  const agx::Vec3f& normal, const agx::Vec3& cmPos1, const agx::Vec3& cmPos2, const agx::Vec3& v1,
53  const agx::Vec3& v2, const agx::Vec3& a1, const agx::Vec3& a2, const agx::Vec3f& u, const agx::Vec3f& v);
54 
56 
58 
59  void postSolveParticlePairContact(const agx::Physics::ParticlePairContactPtr& contact, const agxSDK::MergedState& mergedState, agxSDK::MergeSplitActionContainer& actions);
60 
61  void postSolveParticleGeometryContact(const agx::Physics::ParticleGeometryContactPtr& contact, const agxSDK::MergedState& mergedState, agxSDK::MergeSplitActionContainer& actions);
62 
63  agx::RigidBody * createRigidBodyFromGranulate(agx::Physics::GranularBodyPtr gptr);
64 
65  agxSDK::Simulation * getSimulation();
66  const agxSDK::Simulation * getSimulation() const;
67 
68  agx::Physics::GranularBodySystem * getGranularBodySystem();
69 
70  void destroyMergedParticles();
71 
76 
77  private:
79 
81  // Variables
83  protected:
84  agx::HashSet<agx::Index> m_particlesToDestroy; // Contains particles that are marked for merge and should be removed replaced with rigid bodies
85  };
86 }
Pointer to a entity instance of type Physics.ParticleGeometryContact.
Pointer to a entity instance of type Physics.ParticlePairContact.
Base class for a merge split algorithm handling a set of merged bodies.
Pointer to a entity instance of type Physics.GranularBody.
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
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
agx::BitState< EContactState, agx::Int32 > ContactState
Stateless base class for merge and split of interactions.
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:126
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:30