AGXDynamics  2.35.0.3
SoilSimulationInterface.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 <agxTerrain/export.h>
20 
22 
23 namespace agxTerrain
24 {
25  class Terrain;
26 
29 
31 
37  {
38  public:
44 
51 
58  agx::Physics::GranularBodyPtr createSoilParticle(const agx::Vec3& position = agx::Vec3(), const agx::Vec3& velocity = agx::Vec3());
59 
67  agx::Physics::GranularBodyPtr createSoilParticle(agx::Real radius, const agx::Vec3& position = agx::Vec3(), const agx::Vec3& velocity = agx::Vec3());
68 
72  void removeSoilParticle( agx::Physics::GranularBodyPtr ptr );
73 
77  bool isValid( agx::Physics::GranularBodyPtr ptr ) const;
78 
79 #if (!defined SWIG ) || ( defined SWIGCSHARP || defined SWIGJAVA)
80 
84  SoilParticleArray getSoilParticles() const;
85 #endif
86 
90  agx::Real calculateSoilParticleSpecificVolume() const;
91 
97  agx::Real calculateSoilParticleBulkVolume() const;
98 
107  void addCollisionGroup(agx::UInt32 id);
108  void addCollisionGroup(const agx::Name& name);
109 
114  void removeCollisionGroup(agx::UInt32 id);
115  void removeCollisionGroup(const agx::Name& name);
116 
120  size_t getNumSoilParticles() const;
121 
125  agx::Bound3 getSoilParticleBound() const;
126 
130  const agxCollide::ParticleGeometryContactVector& getParticleGeometryContacts() const;
131 
135  const agxCollide::ParticlePairContactVector& getParticleParticleContacts() const;
136 
141  agx::Physics::GranularBodySystem* getGranularBodySystem() const;
142 
146  bool isParticleGeometryContactValid(agx::Physics::ParticleGeometryContactPtr contact);
147 
151  bool isParticlePairContactValid(agx::Physics::ParticlePairContactPtr contact);
152 
156  bool isGeometryPtrValid( agx::Physics::GeometryPtr geometry ) const;
157 
158  public:
160  void onAddNotification();
161  void onRemoveNotification();
162 
165 
166  protected:
168 
169  agx::Physics::GranularBodyPtr _createSoilParticle( agx::Real radius, const agx::Vec3& position, const agx::Vec3& velocity, agx::Material* material );
170  void initGranularBodySystem();
171  bool isLastTerrain();
172  bool isTerrainPagerActive();
173 
174  private:
175  Terrain* m_terrain;
176  agx::Physics::GranularBodySystemRef m_soilParticleSystem;
177  };
178 
180  {
181  return m_soilParticleSystem != nullptr ? m_soilParticleSystem->isValid(ptr) : false;
182  }
183 }
agx::Physics::GranularBodyPtr
Pointer to a entity instance of type Physics.GranularBody.
Definition: GranularBodyEntity.h:190
AGXTERRAIN_STORE_RESTORE_INTERFACE
#define AGXTERRAIN_STORE_RESTORE_INTERFACE
Definition: agxTerrain/export.h:64
agxTerrain::Terrain
A terrain model based a 3D grid model with overlapping height field that can be deformed by interacti...
Definition: agxTerrain/Terrain.h:85
agx::Real
double Real
Definition: Real.h:42
agx::Vector< agx::Physics::ParticleGeometryContactPtr >
agxTerrain
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
Definition: Geometry.h:59
DOXYGEN_END_INTERNAL_BLOCK
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
agxTerrain::SoilParticleArray
agx::Physics::GranularBodyPtrArray SoilParticleArray
Definition: SoilSimulationInterface.h:28
DOXYGEN_START_INTERNAL_BLOCK
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
agx::Physics::ParticlePairContactPtr
Pointer to a entity instance of type Physics.ParticlePairContact.
Definition: ParticlePairContactEntity.h:240
agx::VectorPOD
Vector containing 'raw' data.
Definition: Vector.h:245
export.h
agx::BoundT< Vec3 >
agxData::Array
Type-specific Array used for fast access into the data held by a Buffer.
Definition: agxData.h:30
agx::ref_ptr< GranularBodySystem >
agx::Physics::ParticleGeometryContactPtr
Pointer to a entity instance of type Physics.ParticleGeometryContact.
Definition: ParticleGeometryContactEntity.h:267
agxTerrain::SoilSimulationInterface::isValid
bool isValid(agx::Physics::GranularBodyPtr ptr) const
Definition: SoilSimulationInterface.h:179
agxTerrain::SoilParticleVector
agx::Physics::GranularBodyPtrVector SoilParticleVector
Definition: SoilSimulationInterface.h:25
agx::Physics::GranularBodySystem
Definition: GranularBodySystem.h:32
agx::Name
Representation of a name string.
Definition: Name.h:32
agxTerrain::SoilSimulationInterface
Interface class for accessing data and functions for the internal soil particle simulation used in ag...
Definition: SoilSimulationInterface.h:36
agx::Physics::GeometryPtr
Pointer to a entity instance of type Physics.Geometry.
Definition: GeometryEntity.h:269
agx::Referenced
Base class providing referencing counted objects.
Definition: Referenced.h:113
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
AGXTERRAIN_EXPORT
#define AGXTERRAIN_EXPORT
Definition: agxTerrain/export.h:41
agx::Material
Main material class which acts as a holder of a Surface Material and a Bulk material.
Definition: Material.h:387
agx::Vec3T< Real >
agx::UInt32
uint32_t UInt32
Definition: Integer.h:40
GranularBodySystem.h
agx::ref_ptr::isValid
bool isValid() const
Definition: ref_ptr.h:268
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition: macros.h:58