AGX Dynamics  2.35.0.1
TerrainParticles.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 #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 
78 
82  void setParticleUniqueId( agx::UInt32 uniqueParticleId );
83 
88 
94 
99 
103  void setMergeVelocity( agx::Real velocity );
104 
109 
114 
119 
124 
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 
190 
194  virtual agx::Real getVolume( ) const;
195 
200  void setParent( SoilParticle* parent );
201 
205  void setSeedContact( );
206 
210  bool getSeedContact( ) const;
211 
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
266 #else
270 #endif
271 
272 }
273 
274 #endif //AGXMODEL_TERRAIN_PARTICLES_H
#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
#define AGXMODEL_EXPORT
ConvexSoil(const agx::Vec3Vector *vertices, const agx::UInt32Vector *indices)
Create a convex body representing digged up soil.
virtual agx::Real getVolume() const override
agx::Real getRadius() const
void setParticleYoungsModulusMultiplier(agx::Real multiplier)
Set how much stiffer the particle Young's modulus to be than the terrain material.
agx::Real getMergeVelocity2() const
agx::UInt32 getParticleUniqueId() const
SoilType
Enum for type of soil.
void setMergeVelocity(agx::Real velocity)
Set the merge velocity for soil particles.
agx::Real getCoreRadius() const
agx::Real getVolume() const
void setType(SoilType soilType)
Set the type of soil to be created when it's time to create particles.
void setParticleUniqueId(agx::UInt32 uniqueParticleId)
Set unique Id for soil particles.
void setRadius(agx::Real radius)
Set the soil particle radius.
void setCoreRadius(agx::Real coreRadius)
Set the particle core radius.
agx::Real getParticleYoungsModulusMultiplier() const
agx::Real getAdhesiveOverlap() const
When converting Terrain to particles, we create SoilParticles.
SoilParticle * getParent() const
void setParent(SoilParticle *parent)
Set a parent to the particle in a soil particle contact graph.
virtual agx::Real getVolume() const
SoilParticle(agx::Real radius, ParticleAttributes::SoilType type)
Specifies the type of the SoilParticle.
void setSeedContact()
Set that this particle is a seed.
ParticleAttributes::SoilType m_type
bool hasParent() const
ParticleAttributes::SoilType getType() const
agx::Real getRadius() const
bool getSeedContact() const
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:45
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:55
Templated vector class.
Definition: agx/Vector.h:53
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
Definition: observer_ptr.h:61
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition: FlowUnit.h:37
agx::Vector< SoilParticleRef > SoilParticleRefVector
agx::HashVector< size_t, agx::Real > SizeTRealHashVector
agx::Vector< std::pair< agx::Real, size_t > > RealSizeTPairVector
agx::observer_ptr< SoilParticle > SoilParticleObs
agx::Vector< std::pair< agx::Vec2i, ParticleCoordinateHeightData > > Vec2iHeightDataPairVector
agx::Vec3 ParticleCoordinateHeightData
agx::Vector< std::pair< size_t, size_t > > SizeTPairVector
agx::Vector< SoilParticleObs > SoilParticleObsVector
agx::Vector< SoilParticle * > SoilParticlePtrVector
agx::ref_ptr< SoilParticle > SoilParticleRef
uint32_t UInt32
Definition: Integer.h:40
double Real
Definition: Real.h:42