AGX Dynamics  2.35.0.1
TerrainProperties.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/config/AGX_USE_AGXTERRAIN.h>
20 #include <agxTerrain/export.h>
21 #include <agx/Referenced.h>
22 #include <agx/BitState.h>
23 #include <array>
24 
25 namespace agxTerrain
26 {
32  {
33  public:
34 
39 
44  bool getEnableLockedBorders() const;
45 
50 
54  bool getEnableAvalanching() const;
55 
59  bool getDeleteSoilParticlesOutsideBounds() const;
60 
65 
70  agx::Real getPenetrationForceVelocityScaling() const;
71 
75  agx::Real getAvalancheMaxHeightGrowth() const;
76 
81  agx::Real getAvalancheDecayFraction() const;
82 
88 
98  agx::Real getSoilAggregateLockCompliance(agx::Int dof) const;
99 
103  bool getCreateParticles() const;
104 
108  agx::Real getMaximumParticleActivationVolume() const;
109 
115 
120 
126  bool getEnableCreateDynamicMass() const;
127 
132  bool getEnableDeformation() const;
133 
139  void setSoilMergeSpeedThreshold(agx::Real speedThreshold);
140 
148 
154 
162  void setSoilParticleMergeThreshold( agx::Real radiusFraction );
163 
169 
176 
184 
189  void setAvalancheMaxHeightGrowth(agx::Real maxHeightGrowth);
190 
196  void setAvalancheErrorThreshold( agx::Real errorThreshold );
197 
202  void setCreateParticles(bool enable);
203 
208  void setEnableSoilCompaction(bool enable);
209 
215 
221  void setEnableLockedBorders(bool enable);
222 
227  void setEnableAvalanching(bool enable);
228 
233  void setSoilParticleGrowthRate( agx::Real growthRateFactor );
234 
246 
253  void setPenetrationForceVelocityScaling(agx::Real penetrationForceVelocityScaling);
254 
260 
266  void setEnableCreateDynamicMass( bool enable );
267 
268 
274  void setEnableDeformation( bool enable );
275 
282  void setActivationSpeed( agx::Real activationSpeed );
283 
288 
295  void setSoilParticleSizeScaling(float scalingFactor);
296 
300  bool isDirty() const;
301 
306  void setDirty(bool isDirty);
307 
309 
310 
314 
316 
318  protected:
319  virtual ~TerrainProperties();
320 
322  {
323  LOCKED_BORDERS = 1 << 0,
324  CREATE_PATICLES = 1 << 1,
325  DELETE_PARTICLES_OUTSIDE_BOUNDS = 1 << 2,
326  ENABLE_SOIL_COMPACTION = 1 << 3,
327  ENABLE_AVALANCHING = 1 << 4,
328  ENABLE_DYNAMIC_MASS = 1 << 5,
329  ENABLE_DEFORMATION = 1 << 6,
330  };
331  using Flags = agx::BitState<StateFlags, agx::UInt32>;
332 
333  private:
334  Flags m_flags;
335  agx::Real m_avalancheDecayFraction;
336  agx::Real m_avalancheMaxHeightGrowth;
337  agx::Real m_penetrationForceVelocityScaling;
338  agx::Real m_soilMergeSpeedThreshold;
339  agx::Real m_maximumActivationVolume;
340  agx::Real m_soilParticleLifeTime;
341  agx::Real m_avalancheErrorThreshold;
342  std::array<agx::Real, 6> m_soilAggregateCompliance;
343  agx::Real m_activationSpeed;
344  agx::Real m_particleGrowthRateFactor;
345  agx::Real m_soilParticleMergeRate;
346  agx::Real m_soilParticleMergeThreshold;
347  float m_particleSizeScaling;
348  bool m_isDirty;
349  };
350 
351 
353  {
354  return m_flags.Is( StateFlags::ENABLE_DEFORMATION );
355  }
356 
358  {
359  return m_flags.Is(StateFlags::LOCKED_BORDERS);
360  }
361 
362 
363 
365  {
366  return m_avalancheMaxHeightGrowth;
367  }
368 
369 
370 
372  {
373  return m_avalancheDecayFraction;
374  }
375 
376 
377 
379  {
380  return m_flags.Is(StateFlags::DELETE_PARTICLES_OUTSIDE_BOUNDS);
381  }
382 
383 
384 
386  {
387  return m_penetrationForceVelocityScaling;
388  }
389 
390 
391 
393  {
394  return m_maximumActivationVolume;
395  }
396 
397 
398 
400  {
401  return m_soilAggregateCompliance[dof];
402  }
403 
404 
405 
407  {
408  return m_flags.Is( StateFlags::ENABLE_DYNAMIC_MASS );
409  }
410 
411 
412 }
413 
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGXTERRAIN_STORE_RESTORE_INTERFACE
#define AGXTERRAIN_EXPORT
Class for containing and managing the different agxTerrain::Terrain settings.
void setMaximumParticleActivationVolume(agx::Real volume)
Sets the maximum volume (m3) of active zone wedges that should wake particles.
void setSoilParticleGrowthRate(agx::Real growthRateFactor)
Set the rate factor in the algorithm for growing soil particles from fluid mass and particle resizing...
void setAvalancheDecayFraction(agx::Real decayFraction)
Set the fraction of the height difference that violates the angle of repose condition that will be tr...
agx::Real getSoilParticleLifeTime() const
void setSoilParticleMergeRate(agx::Real mergeRate)
Set the merge rate for soil particles into the terrain.
void setSoilAggregateLockCompliance(agx::Real compliance, agx::Int dof)
Set the compliance of the soil aggregate lock joint the local constraint dimensions to relax or incre...
void setEnableAvalanching(bool enable)
Set whether to enable avalanching in the terrain.
agx::Real getPenetrationForceVelocityScaling() const
agx::Real getAvalancheMaxHeightGrowth() const
Get the maximum allowed height transfer per time step due to avalanching.
agx::BitState< StateFlags, agx::UInt32 > Flags
agx::Real getSoilAggregateLockCompliance(agx::Int dof) const
Set the compliance of the soil aggregate lock joint the local constraint dimensions to relax or incre...
void setActivationSpeed(agx::Real activationSpeed)
Set the shovel speed threshold in the excavation plane when static mass in the active zone is convert...
void setEnableSoilCompaction(bool enable)
Set whether or not to use the soil compaction calculations in the terrain.
void setCreateParticles(bool enable)
Set whether the terrain should create particles or not during shovel interactions.
float getSoilParticleSizeScaling()
Get soil particle size scaling factor.
void setSoilMergeSpeedThreshold(agx::Real speedThreshold)
Set the absolute lower speed (m/s) threshold where soil particles are allowed to merge with the terra...
agx::Real getAvalancheDecayFraction() const
void setSoilParticleLifeTime(agx::Real lifeTime)
Set the lifetime (s) of created soil particles in the terrain.
agx::Real getActivationSpeed() const
Get the shovel speed threshold in the excavation plane of shovel deformers when static mass in the ac...
void setAvalancheErrorThreshold(agx::Real errorThreshold)
Set the fractional error threshold for the height difference that will trigger avalanching in a grid ...
agx::Real getAvalancheErrorThreshold() const
void setEnableDeformation(bool enable)
Sets if terrain deformation should be enabled.
agx::Real getSoilMergeSpeedThreshold() const
void setPenetrationForceVelocityScaling(agx::Real penetrationForceVelocityScaling)
Set the penetration force velocity scaling constant.
void setDirty(bool isDirty)
Set dirty flag on the TerrainProperties.
agx::Real getSoilParticleMergeRate() const
void setEnableCreateDynamicMass(bool enable)
Sets if dynamic mass should be created during excavation.
void setSoilParticleMergeThreshold(agx::Real radiusFraction)
Set the fraction of the particle nominal radius that will trigger instant merge of soil particles int...
void setDeleteSoilParticlesOutsideBounds(bool enable)
Set if terrain should delete soil particles outside of terrain bounds.
agx::Real getSoilParticleMergeThreshold() const
bool getDeleteSoilParticlesOutsideBounds() const
void setSoilParticleSizeScaling(float scalingFactor)
Set soil particle size scaling factor.
agx::Real getSoilParticleGrowthRate() const
agx::Real getMaximumParticleActivationVolume() const
void setAvalancheMaxHeightGrowth(agx::Real maxHeightGrowth)
Set the maximum allowed height (m) transfer per time step due to avalanching.
void setEnableLockedBorders(bool enable)
Set whether to fixate the height of the borders in the terrain.
bool getEnableSoilCompaction() const
Base class providing referencing counted objects.
Definition: Referenced.h:114
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
Definition: Geometry.h:60
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint32_t UInt32
Definition: Integer.h:40
int32_t Int
Definition: Integer.h:35
double Real
Definition: Real.h:42