AGX Dynamics  2.37.2.0
TerrainParticles.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 #ifndef AGXMODEL_TERRAIN_PARTICLES_H
18 #define AGXMODEL_TERRAIN_PARTICLES_H
19 
20 #include <agxModel/export.h>
21 
22 
23 #include <agxCollide/Contacts.h>
24 #include <agx/Material.h>
25 
26 #include <agxCollide/agxCollide.h>
27 
28 
29 #define TERRAIN_USE_PARTICLE_SYSTEM 0
30 
31 #if TERRAIN_USE_PARTICLE_SYSTEM
32 #include <agx/ParticleSystem.h>
33 #endif
34 
35 namespace agxModel
36 {
37  class Terrain;
38 
40 
42 
44 
46 
48 
54  {
55 
56  public:
57 
61  enum SoilType {
64  CONVEX_BODY
65  };
66 
68 
72  void setType( SoilType soilType );
73 
77  SoilType getType( );
78 
82  void setParticleUniqueId( agx::UInt32 uniqueParticleId );
83 
87  agx::UInt32 getParticleUniqueId() const;
88 
93  void setParticleYoungsModulusMultiplier(agx::Real multiplier);
94 
98  agx::Real getParticleYoungsModulusMultiplier() const;
99 
103  void setMergeVelocity( agx::Real velocity );
104 
108  agx::Real getMergeVelocity2() const;
109 
113  agx::Real getAdhesiveOverlap( ) const;
114 
118  agx::Real getRadius( ) const;
119 
123  agx::Real getCoreRadius( ) const;
124 
128  agx::Real getVolume( ) const;
129 
137  void setRadius( agx::Real radius);
138 
145  void setCoreRadius( agx::Real coreRadius );
146 
150  bool getRadiusIsDirty( ) const;
151 
153 
154  protected:
155  friend class Terrain;
156  private:
157 
158  void setRadiusIsDirty( bool dirty );
159 
160  SoilType m_type;
161  agx::Real m_radius;
162  agx::Real m_coreRadius;
163  agx::Real m_mergeVelocity2;
164  bool m_radiusIsDirty;
165  agx::UInt32 m_uniqueParticleId;
166  agx::Real m_particleYoungsMultiplier;
167  };
168 
175  {
176  public:
177 
180 
185 
189  agx::Real getRadius( ) const;
190 
194  virtual agx::Real getVolume( ) const;
195 
200  void setParent( SoilParticle* parent );
201 
205  void setSeedContact( );
206 
210  bool getSeedContact( ) const;
211 
215  SoilParticle* getParent( ) const;
216 
220  bool hasParent() const;
221 
225  bool isParent() const;
226 
228 
229  protected:
232  private:
233  agx::Real m_radius;
234  SoilParticle* m_parent; //particles
235  bool m_seedContact;
236 
237  };
238 
241 
243  {
244  public:
248  ConvexSoil( const agx::Vec3Vector* vertices, const agx::UInt32Vector* indices );
249 
253  virtual agx::Real getVolume( ) const override;
254 
256  protected:
258  private:
259 
260  };
261 
262 #if TERRAIN_USE_PARTICLE_SYSTEM
264  typedef SoilParticleObsVector SoilParticleRefVector;
265  typedef SoilParticleRefVector SoilParticlePtrVector;
266 #else
270 #endif
271 
272 }
273 
274 #endif //AGXMODEL_TERRAIN_PARTICLES_H
agx::Vector< std::pair< agx::Real, size_t > > RealSizeTPairVector
AGXCORE_EXPORT Type * getType(const agx::String &name)
agx::Vector< SoilParticleObs > SoilParticleObsVector
When converting Terrain to particles, we create SoilParticles.
agx::ref_ptr< SoilParticle > SoilParticleRef
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
Definition: observer_ptr.h:60
agx::Vector< SoilParticle * > SoilParticlePtrVector
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition: FlowUnit.h:36
Templated vector class.
Definition: Vector.h:52
agx::HashVector< size_t, agx::Real > SizeTRealHashVector
agx::Vec3 ParticleCoordinateHeightData
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
SoilType
Enum for type of soil.
ParticleAttributes::SoilType m_type
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
agx::Vector< std::pair< size_t, size_t > > SizeTPairVector
#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
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
#define AGXMODEL_EXPORT
double Real
Definition: Real.h:42
agx::Vector< SoilParticleRef > SoilParticleRefVector
uint32_t UInt32
Definition: Integer.h:40
agx::Vector< std::pair< agx::Vec2i, ParticleCoordinateHeightData > > Vec2iHeightDataPairVector
agx::observer_ptr< SoilParticle > SoilParticleObs