AGX Dynamics 2.42.2.1
Loading...
Searching...
No Matches
TerrainProperties.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
20#include <agxTerrain/export.h>
21#include <agx/Referenced.h>
22#include <agx/BitState.h>
23#include <array>
24
25namespace agxTerrain
26{
32 {
33 public:
34
39
44 bool getEnableLockedBorders() const;
45
50
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
140
148
154
163
169
176
184
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
301 void setEnableGroundCollapse( bool enable );
302
307
312 void setAlwaysEnableSoilFailure( bool enable );
313
318
326
332
337
343
347 bool isDirty() const;
348
353 void setDirty( bool isDirty );
354
356
357
361
365 TerrainProperties( const TerrainProperties& other );
366
368
370 protected:
372
373 enum StateFlags : agx::UInt32
374 {
375 LOCKED_BORDERS = 1 << 0,
376 CREATE_PATICLES = 1 << 1,
377 DELETE_PARTICLES_OUTSIDE_BOUNDS = 1 << 2,
378 ENABLE_SOIL_COMPACTION = 1 << 3,
379 ENABLE_AVALANCHING = 1 << 4,
380 ENABLE_DYNAMIC_MASS = 1 << 5,
381 ENABLE_DEFORMATION = 1 << 6,
382 ENABLE_GROUND_COLLAPSE = 1 << 7,
383 ENABLE_ALWAYS_SOIL_FAILURE = 1 << 8,
384 ENABLE_UPDATE_DYNAMIC_BODY_MASS = 1 << 9,
385 };
386 using Flags = agx::BitState<StateFlags, agx::UInt32>;
387
388 private:
389 Flags m_flags;
390 agx::Real m_avalancheDecayFraction;
391 agx::Real m_avalancheMaxHeightGrowth;
392 agx::Real m_penetrationForceVelocityScaling;
393 agx::Real m_soilMergeSpeedThreshold;
394 agx::Real m_maximumActivationVolume;
395 agx::Real m_soilParticleLifeTime;
396 agx::Real m_avalancheErrorThreshold;
397 std::array<agx::Real, 6> m_soilAggregateCompliance;
398 agx::Real m_activationSpeed;
399 agx::Real m_particleGrowthRateFactor;
400 agx::Real m_soilParticleMergeRate;
401 agx::Real m_soilParticleMergeThreshold;
402 float m_particleSizeScaling;
403 bool m_isDirty;
404 };
405
406
408 {
409 return m_flags.Is( StateFlags::ENABLE_DEFORMATION );
410 }
411
413 {
414 return m_flags.Is(StateFlags::LOCKED_BORDERS);
415 }
416
417
418
420 {
421 return m_avalancheMaxHeightGrowth;
422 }
423
424
425
427 {
428 return m_avalancheDecayFraction;
429 }
430
431
432
434 {
436 }
437
438
439
441 {
442 return m_penetrationForceVelocityScaling;
443 }
444
445
446
448 {
449 return m_maximumActivationVolume;
450 }
451
452
453
455 {
456 return m_soilAggregateCompliance[dof];
457 }
458
459
460
462 {
463 return m_flags.Is( StateFlags::ENABLE_DYNAMIC_MASS );
464 }
465
466
467}
468
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#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.
void setAlwaysEnableSoilFailure(bool enable)
Set if soil wedges should always fail.
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...
float getSoilParticleSizeScaling() const
Get soil particle size scaling factor.
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.
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...
bool getAlwaysEnableSoilFailure() const
bool getEnableGroundCollapse() const
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 setFlags(agx::UInt32 flags)
Set state flags for the properties object.
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.
bool getEnableUpdateDynamicBodyMass() const
Get if the terrain should update the mass properties (mass, inertia and center of mass) of the dynami...
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::UInt32 getFlags() const
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 setEnableUpdateDynamicBodyMass(bool enable)
Set if the terrain should update the mass properties (mass, inertia and center of mass) of the dynami...
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
void setEnableGroundCollapse(bool enable)
Set if ground collapse should be enabled.
Base class providing referencing counted objects.
Definition: Referenced.h:120
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:89
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:88
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
Definition: Geometry.h:59
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint32_t UInt32
Definition: Integer.h:32
double Real
Definition: Real.h:41
int64_t Int
Definition: Integer.h:28