AGX Dynamics 2.42.2.1
Loading...
Searching...
No Matches
CompactionController.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>
23#include <agx/Vec3.h>
24
25namespace agxCollide
26{
27 class Geometry;
28}
29
30namespace agxTerrain
31{
32 class Terrain;
33 class TerrainDataAtlas;
34 class TerrainMassOccupancyController;
35
38
41
49 {
50 public:
52 {
54 UNIFORM_DISK
55 };
56
58 {
60 VOID_RATIO_LN
61 };
62
63 public:
68
75
79 void onPost();
80
86
91
95 void setCompactionMethod(CompactionMethod compactionMethod);
96
101
109 bool applyCompactionFromSurfaceForce(const agx::Vec2i& terrainIndex, agx::Real surfaceForce, agx::Real contactTime);
110
116 agx::Real getStressInVoxel(const agx::Vec3i& voxelIndex) const;
117
122
123 public:
127
128 protected:
130
134 void updateCompactionFromTerrainContacts(const TerrainContactRefVector& contacts);
135
136 // Compact the terrain using the uniform disk method
137 void handleCompactionFromTerrainContactsUniformDisk(const TerrainContactRefVector& contacts);
138
139 // Compact the terrain using the uniform disk method
140 agx::Bool compactColumnWithPointForcesUniformDiskLoad(
141 const agx::Vec2i& terrainIndex, agx::Real surfaceStress, agx::Real loadRadius, agx::Real currentContactTime);
142
143 // Compact the terrain using the BOUSSINESQ method
144 void handleCompactionFromTerrainContactsBoussinesq(const TerrainContactRefVector& contacts);
145
146 // Compact the terrain using the BOUSSINESQ method
147 agx::Bool compactColumnWithPointForces(const agx::Vec2i& terrainIndex,
148 const TerrainContact::SurfaceForceVector& pointForces,
149 agx::Real surfaceStress,
150 bool voxelSurfacecIsInContactArea,
151 agx::Real minDepth,
152 agx::Real maxDepth,
153 agx::Real currentContactTime);
154
155 // Calculate compaction in voxel given a compaction stress and time factor
156 bool doCompactionInVoxel(const agx::Vec3i& voxelIndex, agx::Real compactionStress, agx::Real timeFactor);
157
158 // Calculate subsoil stress in the BOUSSINESQ method
159 agx::Real calculateTotalSubSoilStress(const agx::Vec3& voxelPoint,
160 bool voxelSurfacecIsInContactArea,
161 const TerrainContact::SurfaceForceVector& pointForces) const;
162
163 void debugRenderStressInNode(const agx::Vec3& position, agx::Real stress) const;
164
165 TerrainMassOccupancyController* getMassOccupancyController() const;
166
167 friend class Terrain;
168
169 private:
170 Terrain* m_terrain;
171 VoxelStressTable m_voxelIndexToStress;
172 agx::HashSet<agx::Vec2i> m_compressedTerrainIndices;
173 StressCalculationMethod m_stressMethod;
174 CompactionMethod m_compactionMethod;
175 };
176}
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#define AGXTERRAIN_STORE_RESTORE_INTERFACE
#define AGXTERRAIN_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: agx/Vector.h:34
Controller that handles compaction in the terrain from generated terrain contacts in TerrainContactGe...
bool applyCompactionFromSurfaceForce(const agx::Vec2i &terrainIndex, agx::Real surfaceForce, agx::Real contactTime)
Create compaction from an artificially applied surface force.
void setStressMethod(StressCalculationMethod stressMethod)
Set the stress method used when calculating compaction.
void onPost()
The onPost function updates compaction from terrain contacts.
agx::Real getStressInVoxel(const agx::Vec3i &voxelIndex) const
Get the current active stress in the specified voxelIndex.
CompactionMethod getCompactionMethod() const
Get the compaction method used when calculating compaction.
CompactionController(Terrain *terrain)
Construct given terrain instance.
StressCalculationMethod getStressMethod() const
Get the stress method used when calculating compaction.
void setCompactionMethod(CompactionMethod compactionMethod)
Set the compaction method used when calculating compaction.
const agx::HashSet< agx::Vec2i > & getCompressedTerrainIndices() const
Get the indices that has been compressed this time step after the post step of the compactionControll...
Class that contains information about a terrain contact between an external object and the terrain ge...
Class that handles and sanity checks the mass logic in the terrain.
A terrain model based a 3D grid model with overlapping height field that can be deformed by interacti...
Definition: Terrain.h:92
Inheritance with partial specialization due to bug with ref_ptr containers.
Definition: agx/HashSet.h:670
Inheritance with partial specialization due to bug with ref_ptr containers.
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
This namespace consists of a set of classes for handling geometric intersection tests including boole...
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
Definition: Geometry.h:59
agx::HashTable< agxCollide::Geometry *, agx::Real > GeometryContactTimeTable
agx::HashTable< agx::Vec3i, agx::Real > VoxelStressTable
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
double Real
Definition: Real.h:41