AGX Dynamics 2.42.3.0
Loading...
Searching...
No Matches
agxTerrain::TerrainGridControl Class Reference

Interface class for accessing and manipulating the underlying 3D grid data in the terrain using terrain index (x,y) as well as depth index (z). More...

#include <TerrainGridControl.h>

+ Inheritance diagram for agxTerrain::TerrainGridControl:

Public Member Functions

 TerrainGridControl ()
 
 TerrainGridControl (Terrain *terrain)
 Construct given terrain instance.
 
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.
 
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 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 specific height.
 
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 terrain coordinate.
 
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.
 
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.
 
agx::Real captureAuthoredAvalancheSlopes (const agx::Vec2iVector &terrainIndices, agx::Real decayFactor=1.0)
 Capture the currently authored height slopes and use them as a setup-time lower bound for avalanche stability without changing terrain material state.
 
void clearAuthoredAvalancheSlopes ()
 Clear all captured authored avalanche slopes.
 
void clearAuthoredAvalancheSlopes (const agx::Vec2iVector &terrainIndices)
 Clear captured authored avalanche slopes in selected columns.
 
agx::Real convertFluidMassKgToOccupancy (float mass) const
 Utility method used to convert mass (kg) to occupancy.
 
agx::Real convertOccupancyToMassKg (float occupancy) const
 Utility method used to convert solid occupancy to SI(Kg) units.
 
void decayAuthoredAvalancheSlopes (const agx::Vec2iVector &terrainIndices)
 Manually apply the configured decay factor to captured authored avalanche slopes.
 
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.
 
int findSurfaceIndex (const agx::Vec2i &terrainIndex) const
 Find surface depth index given the terrain index x,y coordinates.
 
float getCompaction (const agx::Vec2i &terrainIndex, int z) const
 Get compaction at the specified surface index coordinate with a depth index.
 
float getCompaction (const agx::Vec3i &terrainIndex) const
 Get compaction the specified 3D index coordinate.
 
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::Vec3 getGridElementPositionWorld (const agx::Vec3i &terrainIndex) const
 Get the world center position of a terrain grid element given a specified 3D index.
 
agx::Real getLocalAngleOfRepose (const agx::Vec3i &voxelIndex) const
 Get local angle of repose in the specified 3D index.
 
agx::Real getLocalHardnessMultiplier (const agx::Vec3i &voxelIndex) const
 Get the local hardness multiplier, derived from hardness rate and local compaction, that is used to scale the local contact point Young's modulus in a voxel 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.
 
int getLowestAllowableDepthIndex () const
 Get the lowest allowable depth index in the terrain.
 
float getMass (const agx::Vec2i &terrainIndex, int z) const
 Get solid mass in SI units at the specified surface index with a depth index.
 
float getMass (const agx::Vec3i &voxelIndex) const
 Get the solid mass in SI units at the specified 3D index coordinate.
 
float getOccupancy (const agx::Vec2i &terrainIndex, int z) const
 Get solid occupancy at the specified surface index with a depth index.
 
float getOccupancy (const agx::Vec3i &voxelIndex) const
 Get the solid occupancy at the specified 3D index coordinate.
 
agx::Real getSurfaceAngleOfRepose (const agx::Vec2i &terrainIndex) const
 Get surface angle of repose in the 2D terrain index.
 
float getSurfaceCompaction (const agx::Vec2i &terrainIndex) const
 Get compaction at the surface element given a specified surface index.
 
agx::Real getSurfaceHardnessMultiplier (const agx::Vec2i &terrainIndex) const
 Get the surface hardness multiplier, derived from hardness rate and local compaction, that is used to scale the local contact point Young's modulus in a voxel given a specified surface index.
 
float getSurfaceOccupancy (const agx::Vec2i &terrainIndex) const
 Get solid occupancy at the surface grid element given a surface index.
 
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 getTotalMass (const agx::Vec3i &voxelIndex) const
 Get the total mass (solid + fluid) in SI units at the specified 3D index coordinate.
 
bool isIndexValid (const agx::Vec3i &voxelIndex) const
 Check is the given 3D index coordinate is within terrain bounds.
 
float removeFluidOccupancy (const agx::Vec3i &terrainIndex, float fluidOccupancy)
 Remove fluid occupancy in the specified 3D grid coordinate, if any exists.
 
float removeSolidOccupancyInColumn (const agx::Vec2i &terrainIndex, float occupancy, bool shouldAvalanche=true)
 Remove solid occupancy in the specified surface 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.
 
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 coordinates while z is the depth index.
 
agx::Real setCompactionFromCurrentHeights (const agx::Vec2iVector &terrainIndices, agx::Real compactionMultiplier=1.0, size_t compactionDepth=3, bool useTaperedProfile=true)
 Compute and apply the compaction required for the selected surface columns to preserve their current tangent slopes during avalanching.
 
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.
 
void setSurfaceCompactionToDepth (const agx::Vec2i &terrainIndex, float compaction, float depth)
 Set the compaction at the surface element given a specified surface index.
 
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.
 
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 coordinates while z is the depth index.
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 

Protected Member Functions

virtual ~TerrainGridControl ()
 
agx::Vec3i convertSurfaceTerrainIndex (const agx::Vec2i &terrainIndex) const
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 

Additional Inherited Members

- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

Interface class for accessing and manipulating the underlying 3D grid data in the terrain using terrain index (x,y) as well as depth index (z).

This is the primary user-interface by which to access the underlying grid data, such as solid occupancy and compaction, in the terrain structure.

The basic element in the terrain grid is a uniform 3D voxel with the dimension of getElementSize() given by the terrain object. These grid elements contains the solid occupancy in the Terrain which is bounded by the surface height field. The solid occupancy can be compacted by stress generated by external contacts or by applying external forces via the interface class. Compacted solid occupancy occupy less space in a voxel element and thus voxels with compaction can carry more solid occupancy. Soil compaction affects physical parameters such as angle of repose, stiffness and local soil density. The maximum compaction of an element is given by the maximum density in the BulkMaterial instance.

The solid occupancy of a grid element is the unit used when interacting with the terrain interface methods is , i.e given nominal compaction 1.0, a solid occupancy of 1.0 is enough to occupy a whole voxel element in the Terrain. A solid occupancy of 1.0 with compaction 2.0 occupy half the space is a voxel. Utility methods exists to convert occupancy to mass in SI units.

Definition at line 46 of file TerrainGridControl.h.

Constructor & Destructor Documentation

◆ TerrainGridControl() [1/2]

agxTerrain::TerrainGridControl::TerrainGridControl ( Terrain *  terrain)

Construct given terrain instance.

Parameters
terrain- terrain instance

◆ TerrainGridControl() [2/2]

agxTerrain::TerrainGridControl::TerrainGridControl ( )

◆ ~TerrainGridControl()

virtual agxTerrain::TerrainGridControl::~TerrainGridControl ( )
protectedvirtual

Member Function Documentation

◆ addSolidOccupancyInColumn()

float agxTerrain::TerrainGridControl::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.

The solid occupancy is added on the surface of the terrain, successively filling up grid elements column wise.

Parameters
terrainIndex- The specified terrain index.
mass- The solid mass that should be added at the surface index.
compaction- The compaction of the occupancy that should be added to the column.
shouldAvalanche- True if the terrainIndex should be queried for avalanching.
Returns
The solid occupancy that have been added to the surface index.

◆ addSolidOccupancyInColumns()

void agxTerrain::TerrainGridControl::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.

The solid occupancy is added on the surface of the terrain, successively filling up grid elements column wise.

Parameters
table- Hashtable containing all terrain coordinates and data to add occupancy. The elements of the table contains terrain coordinate, occupancy and compaction, respectively.
shouldAvalanche- True if the terrainIndex should be queried for avalanching.

◆ addSolidOccupancyInColumnToHeight()

float agxTerrain::TerrainGridControl::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 specific height.

The solid occupancy is added on the surface of the terrain, successively filling up grid elements column wise until the specified height in the terrain is reached.

Note
- If the supplied height is lower than the height field at that grid index, the method will return zero added solid occupancy.
Parameters
terrainIndex- The specified terrain index.
height- The specified height that solid occupancy is added at the surface index to reach.
compaction- The compaction of the occupancy that should be added to the column.
shouldAvalanche- True if the terrainIndex should be queried for avalanching.
Returns
The solid occupancy that have been added to the surface index up to the specific height.

◆ addSolidOccupancyLayerInColum()

float agxTerrain::TerrainGridControl::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 terrain coordinate.

The solid occupancy is added on top of the surface of the terrain, successively filling up grid elements column wise up to layer height.

Note
- Function will not execute on negative layer heights.
Parameters
terrainIndex- The specified terrain index.
layerHeight-The specified height of the solid occupancy layer to be added at the surface index.
compaction- The compaction of the occupancy that should be added to the column.
shouldAvalanche- True if the terrainIndex should be queried for avalanching.
Returns
The solid occupancy of the layer that have been added to the surface index up to the layer height.

◆ applySurfaceForce()

bool agxTerrain::TerrainGridControl::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.

The surface force will be converted to a surface stress of the grid element area.

Note
- If the force is insufficient to compress the soil, i.e the resulting stress is under the pre-consolidation stress in any of the affected grid points, nothing will happen.
Parameters
terrainIndex- The specified surface index.
surfaceForce- The specified surface force (N) to be applied.
contactTime- The time that the force is active, which is used to calculate the time relaxation of the compaction. The longer the contact time, the more compaction will occur. See BulkMaterial for the compaction relaxation constant.
Returns
True if the force was enough to compact the soil.

◆ applySurfaceStress()

bool agxTerrain::TerrainGridControl::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.

Note
- If the force is insufficient to compress the soil, i.e under the pre-consolidation stress in any of the affected grid points, nothing will happen.
Parameters
terrainIndex- The specified surface index.
surfaceStress- The specified surface stress (Pa) to be applied.
contactTime- The time that the force is active, which is used calculate the time relaxation of the compaction. The longer the contact time, the more compaction will occur. See BulkMaterial for the compaction relaxation constant.
Returns
True if the force was enough to compact the soil.

◆ captureAuthoredAvalancheSlopes()

agx::Real agxTerrain::TerrainGridControl::captureAuthoredAvalancheSlopes ( const agx::Vec2iVector &  terrainIndices,
agx::Real  decayFactor = 1.0 
)

Capture the currently authored height slopes and use them as a setup-time lower bound for avalanche stability without changing terrain material state.

The captured value is the maximum tangent slope from each selected column to its lower neighboring columns. During avalanching the effective local tangent of repose becomes max(material/compaction tangent of repose, captured authored tangent slope).

Parameters
terrainIndices- The selected surface columns.
decayFactor- Multiplier applied to the captured tangent slope when the column is modified. Range [0, 1]. A value of 1 keeps the authored slope indefinitely. A value of 0 clears it on first modification.
Returns
The maximum authored tangent slope captured for any selected column.

◆ clearAuthoredAvalancheSlopes() [1/2]

void agxTerrain::TerrainGridControl::clearAuthoredAvalancheSlopes ( )

Clear all captured authored avalanche slopes.

◆ clearAuthoredAvalancheSlopes() [2/2]

void agxTerrain::TerrainGridControl::clearAuthoredAvalancheSlopes ( const agx::Vec2iVector &  terrainIndices)

Clear captured authored avalanche slopes in selected columns.

◆ convertFluidMassKgToOccupancy()

agx::Real agxTerrain::TerrainGridControl::convertFluidMassKgToOccupancy ( float  mass) const

Utility method used to convert mass (kg) to occupancy.

◆ convertOccupancyToMassKg()

agx::Real agxTerrain::TerrainGridControl::convertOccupancyToMassKg ( float  occupancy) const

Utility method used to convert solid occupancy to SI(Kg) units.

◆ convertSurfaceTerrainIndex()

agx::Vec3i agxTerrain::TerrainGridControl::convertSurfaceTerrainIndex ( const agx::Vec2i &  terrainIndex) const
protected

◆ decayAuthoredAvalancheSlopes()

void agxTerrain::TerrainGridControl::decayAuthoredAvalancheSlopes ( const agx::Vec2iVector &  terrainIndices)

Manually apply the configured decay factor to captured authored avalanche slopes.

◆ findIndexFromSurfaceDepth()

int agxTerrain::TerrainGridControl::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.

Parameters
terrainIndex- The specified terrainIndex.
depth- depth distance
Returns
The depth index at specific depth under the surface as the specified terrain index.

◆ findSurfaceIndex()

int agxTerrain::TerrainGridControl::findSurfaceIndex ( const agx::Vec2i &  terrainIndex) const

Find surface depth index given the terrain index x,y coordinates.

Parameters
terrainIndex- The specified terrainIndex.
Returns
The terrain depth index at the surface.

◆ getCompaction() [1/2]

float agxTerrain::TerrainGridControl::getCompaction ( const agx::Vec2i &  terrainIndex,
int  z 
) const

Get compaction at the specified surface index coordinate with a depth index.

Parameters
terrainIndex- The specified terrain surface index.
z- The specified depth index.
Returns
The compaction at the specified surface index and depth index.

◆ getCompaction() [2/2]

float agxTerrain::TerrainGridControl::getCompaction ( const agx::Vec3i &  terrainIndex) const

Get compaction the specified 3D index coordinate.

x,y are the regular terrain coordinate while z is the depth index.

Parameters
terrainIndex- The specified 3D index, containing surface coordinates and depth index.
Returns
The compaction in the 3D terrain index.

◆ getCurrentStressInTerrainIndex()

agx::Real agxTerrain::TerrainGridControl::getCurrentStressInTerrainIndex ( const agx::Vec3i &  terrainIndex) const

Get the current stress in a 3D index that resulted from active TerrainContacts this time-step.

Parameters
terrainIndex- The specified 3D index.
Returns
The current stress in the grid element given by the specified index.

◆ getGridElementPositionWorld()

agx::Vec3 agxTerrain::TerrainGridControl::getGridElementPositionWorld ( const agx::Vec3i &  terrainIndex) const

Get the world center position of a terrain grid element given a specified 3D index.

Parameters
terrainIndex- the specified 3D terrain grid element index
Returns
the world position of the center point of the grid element with specified index

◆ getLocalAngleOfRepose()

agx::Real agxTerrain::TerrainGridControl::getLocalAngleOfRepose ( const agx::Vec3i &  voxelIndex) const

Get local angle of repose in the specified 3D index.

Note
- The angle of repose in a terrain grid element is dependent on the compaction in the element as well as the material properties.
Parameters
voxelIndex- The specified 3D index.
Returns
The local angle of repose in the grid element given by the specified 3D terrain index.

◆ getLocalHardnessMultiplier()

agx::Real agxTerrain::TerrainGridControl::getLocalHardnessMultiplier ( const agx::Vec3i &  voxelIndex) const

Get the local hardness multiplier, derived from hardness rate and local compaction, that is used to scale the local contact point Young's modulus in a voxel given a specified surface index.

The hardness multiplier is a function of the bulk material hardening rate and the voxel compaction.

Parameters
voxelIndex- the specified 3D terrain grid element index for the voxel.
Returns
the local hardness multiplier given a specified voxel compaction and bulk material hardening rate.

◆ getLocalPreconsolidationStress()

agx::Real agxTerrain::TerrainGridControl::getLocalPreconsolidationStress ( const agx::Vec3i &  terrainIndex) const

Get the local pre-consolidation stress in the terrain grid element specified by a 3D terrain index.

The pre-consolidation stress is the most recent stress that has been used to compress the solid occupancy in the grid element, which is either given by the BulkMaterial when the grid element is in nominal compaction, by the compaction stress generated from the terrain contacts or by the user via the grid interface. In order to compress the terrain further, the stress applied has to exceed the pre-consolidation stress.

Parameters
terrainIndex- The specified 3D terrain index.
Returns
The pre-consolidation stress of the grid element given by the specified terrain index.

◆ getLowestAllowableDepthIndex()

int agxTerrain::TerrainGridControl::getLowestAllowableDepthIndex ( ) const

Get the lowest allowable depth index in the terrain.

This is dependent on the terrain depth and the element size.

◆ getMass() [1/2]

float agxTerrain::TerrainGridControl::getMass ( const agx::Vec2i &  terrainIndex,
int  z 
) const

Get solid mass in SI units at the specified surface index with a depth index.

Parameters
terrainIndex- The specified x,y terrain coordinate.
z- The specified depth index.
Returns
The solid mass at the specified 3D terrain index.

◆ getMass() [2/2]

float agxTerrain::TerrainGridControl::getMass ( const agx::Vec3i &  voxelIndex) const

Get the solid mass in SI units at the specified 3D index coordinate.

(x,y) are the regular terrain surface coordinates while z is the depth index.

Parameters
voxelIndex- The specified 3D index, containing surface coordinates and depth index.
Returns
The solid mass at the specified 3D terrain index.

◆ getOccupancy() [1/2]

float agxTerrain::TerrainGridControl::getOccupancy ( const agx::Vec2i &  terrainIndex,
int  z 
) const

Get solid occupancy at the specified surface index with a depth index.

Parameters
terrainIndex- The specified x,y terrain coordinate.
z- The specified depth index.
Returns
The solid occupancy at the specified 3D terrain index.

◆ getOccupancy() [2/2]

float agxTerrain::TerrainGridControl::getOccupancy ( const agx::Vec3i &  voxelIndex) const

Get the solid occupancy at the specified 3D index coordinate.

(x,y) are the regular terrain surface coordinates while z is the depth index.

Parameters
voxelIndex- The specified 3D index, containing surface coordinates and depth index.
Returns
The solid occupancy at the specified 3D terrain index.

◆ getSurfaceAngleOfRepose()

agx::Real agxTerrain::TerrainGridControl::getSurfaceAngleOfRepose ( const agx::Vec2i &  terrainIndex) const

Get surface angle of repose in the 2D terrain index.

Note
- The angle of repose in a terrain grid element is dependent on the compaction in the element as well as the material properties.
Parameters
terrainIndex- The specified surface index.
Returns
The angle of repose in the surface grid element given by the specified index.

◆ getSurfaceCompaction()

float agxTerrain::TerrainGridControl::getSurfaceCompaction ( const agx::Vec2i &  terrainIndex) const

Get compaction at the surface element given a specified surface index.

Parameters
terrainIndex- The specified terrain index.
Returns
The compaction at the specified terrain index.

◆ getSurfaceHardnessMultiplier()

agx::Real agxTerrain::TerrainGridControl::getSurfaceHardnessMultiplier ( const agx::Vec2i &  terrainIndex) const

Get the surface hardness multiplier, derived from hardness rate and local compaction, that is used to scale the local contact point Young's modulus in a voxel given a specified surface index.

The hardness multiplier is a function of the bulk material hardening rate and the voxel compaction.

Parameters
terrainIndex- the specified 2D surface index
Returns
the surface hardness multiplier given a specified voxel compaction and bulk material hardening rate.

◆ getSurfaceOccupancy()

float agxTerrain::TerrainGridControl::getSurfaceOccupancy ( const agx::Vec2i &  terrainIndex) const

Get solid occupancy at the surface grid element given a surface index.

Parameters
terrainIndex- The specified terrain index.
Returns
The solid occupancy at the specified terrain index

◆ getSurfacePreconsolidationStress()

agx::Real agxTerrain::TerrainGridControl::getSurfacePreconsolidationStress ( const agx::Vec2i &  terrainIndex) const

Get the surface pre-consolidation stress in the terrain grid element specified by a 3D terrain index.

The pre-consolidation stress is the most recent stress that has been used to compress the solid occupancy in the grid element, which is either given by the BulkMaterial when the grid element is in nominal compaction, by the compaction stress generated from the terrain contacts or by the user via the grid interface. In order to compress the terrain further, the stress applied has to exceed the pre-consolidation stress.

Parameters
terrainIndex- The specified surface index.
Returns
The pre-consolidation stress of the surface grid element given by the specified surface index.

◆ getTotalMass()

float agxTerrain::TerrainGridControl::getTotalMass ( const agx::Vec3i &  voxelIndex) const

Get the total mass (solid + fluid) in SI units at the specified 3D index coordinate.

(x,y) are the regular terrain surface coordinates while z is the depth index.

Parameters
voxelIndex- The specified 3D index, containing surface coordinates and depth index.
Returns
The total mass at the specified 3D terrain index.

◆ isIndexValid()

bool agxTerrain::TerrainGridControl::isIndexValid ( const agx::Vec3i &  voxelIndex) const

Check is the given 3D index coordinate is within terrain bounds.

Parameters
voxelIndex- The specified 3D index.
Returns
True if the specified terrain index is within terrain bounds.

◆ removeFluidOccupancy()

float agxTerrain::TerrainGridControl::removeFluidOccupancy ( const agx::Vec3i &  terrainIndex,
float  fluidOccupancy 
)

Remove fluid occupancy in the specified 3D grid coordinate, if any exists.

Parameters
terrainIndex- The specified 3D index, containing surface coordinates and depth index.
fluidOccupancy- The fluid occupancy that should be removed in the grid point.
Returns
The fluid occupancy that was removed from the grid point.

◆ removeSolidOccupancyInColumn()

float agxTerrain::TerrainGridControl::removeSolidOccupancyInColumn ( const agx::Vec2i &  terrainIndex,
float  occupancy,
bool  shouldAvalanche = true 
)

Remove solid occupancy in the specified surface coordinate.

The occupancy is removed from the surface of the terrain, successively removing occupancy from grid elements column wise.

Parameters
terrainIndex- The specified surface index.
occupancy- The solid occupancy that should be removed in the column.
shouldAvalanche- True if the terrainIndex should be queried for avalanching.
Returns
The solid occupancy that have been removed at the column of the surface index.

◆ setCompaction() [1/2]

void agxTerrain::TerrainGridControl::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.

Note
- Default behavior is that the amount of solid occupancy in the voxel is scaled so that the total occupancy in the element is kept the same, i.e the surface profile is not changed.
Parameters
terrainIndex- The specified terrain index.
z- Index of the cell in the z-coord.
compaction- The specified compaction.
compressOccupancy- Set to True if the solid occupancy of the grid element should be compressed. This will keep the amount of solid occupancy in the voxel but will change the surface profile of the terrain as occupancy is lowered.

◆ setCompaction() [2/2]

void agxTerrain::TerrainGridControl::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 coordinates while z is the depth index.

Note
- Default behavior is that the amount of solid occupancy in the voxel is scaled so that the total occupancy in the element is kept the same, i.e the surface profile is not changed.
Parameters
terrainIndex- The specified 3D index, containing surface coordinates and depth index.
compaction- The specified compaction.
compressOccupancy- Set to True if the solid occupancy of the grid element should be compressed.

◆ setCompactionFromCurrentHeights()

agx::Real agxTerrain::TerrainGridControl::setCompactionFromCurrentHeights ( const agx::Vec2iVector &  terrainIndices,
agx::Real  compactionMultiplier = 1.0,
size_t  compactionDepth = 3,
bool  useTaperedProfile = true 
)

Compute and apply the compaction required for the selected surface columns to preserve their current tangent slopes during avalanching.

The required compaction for preserving the current tangent slopes is computed from the current height difference to lower neighboring columns and the material's uncompressed repose angle. The resulting surface compaction is multiplied by compactionMultiplier and applied down into the column. By default the compaction profile is tapered, with max value at the surface and lower values beneath the ground. The tapered profile can be disabled if a constructed volume should be compacted fully through the given depth.

Note
This is intended as a setup-time authoring operation. It preserves the current height field by changing compaction without compressing the visible surface profile.
Parameters
terrainIndices- The selected surface columns.
compactionMultiplier- Multiplier applied to the minimum required compaction. Must be > 0.
compactionDepth- Number of voxels, including the surface voxel, receiving authored compaction.
useTaperedProfile- If true, gradually reduces the authored compaction with depth. If false, applies the same authored compaction through the selected depth.
Returns
The maximum surface compaction applied to any selected column.

◆ setSurfaceCompaction()

void agxTerrain::TerrainGridControl::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.

Note
- Default behavior is that the amount of solid occupancy in the voxel is scaled so that the total occupancy in the element is kept the same, i.e the surface profile is not changed.
Parameters
terrainIndex- The specified surface index.
compaction- The specified compaction.
compressOccupancy- Set to True if the solid occupancy of the surface grid element should be compressed. This will keep the amount of solid occupancy in the voxel but will change the surface profile of the terrain as occupancy is lowered.
compressToBottom- Set to True if the compression value should be set to each soild grid element down to maximum terrain depth.

◆ setSurfaceCompactionToDepth()

void agxTerrain::TerrainGridControl::setSurfaceCompactionToDepth ( const agx::Vec2i &  terrainIndex,
float  compaction,
float  depth 
)

Set the compaction at the surface element given a specified surface index.

Note
- Default behavior is that the amount of solid occupancy in the voxel is scaled so that the total occupancy in the element is kept the same, i.e the surface profile is not changed.
Parameters
terrainIndex- The specified surface index.
compaction- The specified compaction.
depth- The depth that the compression should be set under the surface

◆ setTerrainMaterial() [1/2]

void agxTerrain::TerrainGridControl::setTerrainMaterial ( const agx::Vec2i &  terrainIndex,
int  z,
TerrainMaterial *  terrainMaterial 
)

Set the terrainMaterial at an element given a specified surface index with a depth index.

Parameters
terrainIndex- The specified terrain index.
z- Index of the cell in the z-coord.
terrainMaterial- the specified TerrainMaterial.

◆ setTerrainMaterial() [2/2]

void agxTerrain::TerrainGridControl::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 coordinates while z is the depth index.

Parameters
terrainIndex- The specified 3D index, containing surface coordinates and depth index.
terrainMaterial- the specified TerrainMaterial.

The documentation for this class was generated from the following file: