AGX Dynamics 2.42.2.1
Loading...
Searching...
No Matches
TerrainGridControl.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
19#include <agxTerrain/export.h>
20#include <agx/Vec3.h>
22
23namespace agxTerrain
24{
25 class Terrain;
26
29
46 {
47 public:
53
60
67 float getOccupancy(const agx::Vec2i& terrainIndex, int z) const;
68
74 float getOccupancy(const agx::Vec3i& voxelIndex) const;
75
82 float getMass(const agx::Vec2i& terrainIndex, int z) const;
83
89 float getMass(const agx::Vec3i& voxelIndex) const;
90
97 float getTotalMass( const agx::Vec3i& voxelIndex ) const;
98
105 float getCompaction(const agx::Vec2i& terrainIndex, int z) const;
106
112 float getCompaction(const agx::Vec3i& terrainIndex) const;
113
119 float getSurfaceOccupancy(const agx::Vec2i& terrainIndex) const;
120
126 float getSurfaceCompaction(const agx::Vec2i& terrainIndex) const;
127
143 const agx::Vec2i& terrainIndex, float compaction, bool compressOccupancy = false, bool compressToBottom = false);
144
155 void setSurfaceCompactionToDepth(const agx::Vec2i& terrainIndex, float compaction, float depth);
156
170 void setCompaction(const agx::Vec2i& terrainIndex, int z, float compaction, bool compressOccupancy = false);
171
182 void setCompaction(const agx::Vec3i& terrainIndex, float compaction, bool compressOccupancy = false);
183
190 void setTerrainMaterial(const agx::Vec2i& terrainIndex, int z, TerrainMaterial* terrainMaterial);
196 void setTerrainMaterial(const agx::Vec3i& terrainIndex, TerrainMaterial* terrainMaterial);
208 const agx::Vec2i& terrainIndex, float mass, float compaction, bool shouldAvalanche = true);
209
218 void addSolidOccupancyInColumns(agx::HashTable<agx::Vec2i, std::pair<float, float>> table, bool shouldAvalanche = true);
219
228 float removeSolidOccupancyInColumn(const agx::Vec2i& terrainIndex, float occupancy, bool shouldAvalanche = true);
229
243 float addSolidOccupancyLayerInColum(const agx::Vec2i& terrainIndex, agx::Real layerHeight, float compaction, bool shouldAvalanche = true);
244
258 float addSolidOccupancyInColumnToHeight(const agx::Vec2i& terrainIndex, agx::Real height, float compaction, bool shouldAvalanche = true);
259
266 float removeFluidOccupancy(const agx::Vec3i& terrainIndex, float fluidOccupancy);
267
275
282 agx::Real getSurfaceAngleOfRepose(const agx::Vec2i& terrainIndex) const;
283
299 bool applySurfaceForce(const agx::Vec2i& terrainIndex, agx::Real surfaceForce, agx::Real contactTime=-1);
300
314 bool applySurfaceStress(const agx::Vec2i& terrainIndex, agx::Real surfaceStress, agx::Real contactTime = -1);
315
321 bool isIndexValid(const agx::Vec3i& voxelIndex) const;
322
329
340
351
358
367
376
382 int findSurfaceIndex(const agx::Vec2i& terrainIndex) const;
383
390 int findIndexFromSurfaceDepth(const agx::Vec2i& terrainIndex, agx::Real depth) const;
391
396
400 agx::Real convertOccupancyToMassKg(float occupancy) const;
401
406
407 public:
411
412 protected:
413 agx::Vec3i convertSurfaceTerrainIndex(const agx::Vec2i& terrainIndex) const;
414
416
417 private:
418 Terrain* m_terrain;
419 };
420}
#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
Interface class for accessing and manipulating the underlying 3D grid data in the terrain using terra...
agx::Real getSurfaceHardnessMultiplier(const agx::Vec2i &terrainIndex) const
Get the surface hardness multiplier, derived from hardness rate and local compaction,...
void setCompaction(const agx::Vec3i &terrainIndex, float compaction, bool compressOccupancy=false)
Set the compaction at an element given a specified 3D index where x,y are the regular terrain coordin...
bool isIndexValid(const agx::Vec3i &voxelIndex) const
Check is the given 3D index coordinate is within terrain bounds.
agx::Real getCurrentStressInTerrainIndex(const agx::Vec3i &terrainIndex) const
Get the current stress in a 3D index that resulted from active TerrainContacts this time-step.
agx::Real getSurfacePreconsolidationStress(const agx::Vec2i &terrainIndex) const
Get the surface pre-consolidation stress in the terrain grid element specified by a 3D terrain index.
float removeSolidOccupancyInColumn(const agx::Vec2i &terrainIndex, float occupancy, bool shouldAvalanche=true)
Remove solid occupancy in the specified surface coordinate.
void setTerrainMaterial(const agx::Vec2i &terrainIndex, int z, TerrainMaterial *terrainMaterial)
Set the terrainMaterial at an element given a specified surface index with a depth index.
agx::Real convertOccupancyToMassKg(float occupancy) const
Utility method used to convert solid occupancy to SI(Kg) units.
int getLowestAllowableDepthIndex() const
Get the lowest allowable depth index in the terrain.
TerrainGridControl(Terrain *terrain)
Construct given terrain instance.
void setTerrainMaterial(const agx::Vec3i &terrainIndex, TerrainMaterial *terrainMaterial)
Set the terrainMaterial at an element given a specified 3D index where x,y are the regular terrain co...
float getTotalMass(const agx::Vec3i &voxelIndex) const
Get the total mass (solid + fluid) in SI units at the specified 3D index coordinate.
bool applySurfaceStress(const agx::Vec2i &terrainIndex, agx::Real surfaceStress, agx::Real contactTime=-1)
Apply a surface stress (Pa) at the specified surface index in order to compact the soil.
bool applySurfaceForce(const agx::Vec2i &terrainIndex, agx::Real surfaceForce, agx::Real contactTime=-1)
Apply a surface force (N) at the specified surface index in order to compact the soil.
agx::Vec3 getGridElementPositionWorld(const agx::Vec3i &terrainIndex) const
Get the world center position of a terrain grid element given a specified 3D index.
float addSolidOccupancyLayerInColum(const agx::Vec2i &terrainIndex, agx::Real layerHeight, float compaction, bool shouldAvalanche=true)
Add solid occupancy layer with specific height and compaction on the terrain surface in the specified...
int findSurfaceIndex(const agx::Vec2i &terrainIndex) const
Find surface depth index given the terrain index x,y coordinates.
float getCompaction(const agx::Vec3i &terrainIndex) const
Get compaction the specified 3D index coordinate.
float getSurfaceCompaction(const agx::Vec2i &terrainIndex) const
Get compaction at the surface element given a specified surface index.
agx::Real getLocalPreconsolidationStress(const agx::Vec3i &terrainIndex) const
Get the local pre-consolidation stress in the terrain grid element specified by a 3D terrain index.
float removeFluidOccupancy(const agx::Vec3i &terrainIndex, float fluidOccupancy)
Remove fluid occupancy in the specified 3D grid coordinate, if any exists.
float getOccupancy(const agx::Vec2i &terrainIndex, int z) const
Get solid occupancy at the specified surface index with a depth index.
void addSolidOccupancyInColumns(agx::HashTable< agx::Vec2i, std::pair< float, float > > table, bool shouldAvalanche=true)
Add solid occupancy in several terrain coordinates on the surface with given compaction.
float getSurfaceOccupancy(const agx::Vec2i &terrainIndex) const
Get solid occupancy at the surface grid element given a surface index.
agx::Real convertFluidMassKgToOccupancy(float mass) const
Utility method used to convert mass (kg) to occupancy.
agx::Real getLocalHardnessMultiplier(const agx::Vec3i &voxelIndex) const
Get the local hardness multiplier, derived from hardness rate and local compaction,...
agx::Real getLocalAngleOfRepose(const agx::Vec3i &voxelIndex) const
Get local angle of repose in the specified 3D index.
float getOccupancy(const agx::Vec3i &voxelIndex) const
Get the solid occupancy at the specified 3D index coordinate.
float getMass(const agx::Vec2i &terrainIndex, int z) const
Get solid mass in SI units at the specified surface index with a depth index.
void setSurfaceCompaction(const agx::Vec2i &terrainIndex, float compaction, bool compressOccupancy=false, bool compressToBottom=false)
Set the compaction at the surface element given a specified surface index.
float addSolidOccupancyInColumn(const agx::Vec2i &terrainIndex, float mass, float compaction, bool shouldAvalanche=true)
Add solid occupancy in the specified terrain coordinate on the surface with given compaction.
float getMass(const agx::Vec3i &voxelIndex) const
Get the solid mass in SI units at the specified 3D index coordinate.
void setCompaction(const agx::Vec2i &terrainIndex, int z, float compaction, bool compressOccupancy=false)
Set the compaction at an element given a specified surface index with a depth index.
agx::Real getSurfaceAngleOfRepose(const agx::Vec2i &terrainIndex) const
Get surface angle of repose in the 2D terrain index.
int findIndexFromSurfaceDepth(const agx::Vec2i &terrainIndex, agx::Real depth) const
Find the depth index under the surface at terrain index x,y coordinates and depth distance.
float getCompaction(const agx::Vec2i &terrainIndex, int z) const
Get compaction at the specified surface index coordinate with a depth index.
float addSolidOccupancyInColumnToHeight(const agx::Vec2i &terrainIndex, agx::Real height, float compaction, bool shouldAvalanche=true)
Add solid occupancy in the specified terrain coordinate on the surface with given compaction up to a ...
void setSurfaceCompactionToDepth(const agx::Vec2i &terrainIndex, float compaction, float depth)
Set the compaction at the surface element given a specified surface index.
This class is used to describe the general material properties of 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.
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.
double Real
Definition: Real.h:41