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

This class has two main responsibilities: More...

#include <TerrainContactGenerator.h>

+ Inheritance diagram for agxTerrain::TerrainContactGenerator:

Public Member Functions

 TerrainContactGenerator ()
 
 TerrainContactGenerator (Terrain *terrain)
 Default constructor.
 
TerrainContactRefVector & getTerrainContacts ()
 
const TerrainContactRefVector & getTerrainContacts () const
 
TerrainContactRefVector * getTerrainContactVector ()
 
void onPost (agxSDK::Simulation *simulation)
 Do post updates for the contact generator.
 
void onPre (agxSDK::Simulation *simulation)
 Do pre updates for the contact generator.
 
void onRemove (agxSDK::Simulation *simulation)
 Do cleanup when removed from the Simulation.
 
- 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 ~TerrainContactGenerator ()
 Reference counted object - protected destructor.
 
void addNeighborIndex (const agx::Vec2i &index, std::queue< agx::Vec2i > &indicesToCheck, agx::HashSet< agx::Vec2i > &visitedIndices) const
 
void buildTerrainContacts (agxSDK::Simulation *simulation)
 Build the TerrainContact objects used in compaction calculations.
 
void collectTerrainContacts (agxSDK::Simulation *simulation)
 Collect contacts between externally colliding geometries and the terrain (Does not include SoilParticleAggregateContacts).
 
std::tuple< TerrainIndexToDepthTable, agx::Bound3 > findIntersectingIndexInContact (const agxCollide::GeometryContactPtrVector &contacts)
 Find the terrain grid indices intersecting with the colliding geometry via ray intersection tests.
 
TerrainContact * generateTerrainContact (const agxCollide::GeometryContactPtrVector &contacts, agxSDK::Simulation *simulation)
 Get the current generated Terrain contacts.
 
const agxCollide::Geometry * getCollider (const agxCollide::GeometryContact *contact) const
 Get the collider geometry in the geometry contact.
 
agx::Real getCurrentContactTime (const agxCollide::Geometry *geometry) const
 
agx::Real getModifiedYoungsModuls (const agx::Vec3 &position, const agx::ContactMaterial *existingContactMaterial) const
 Get modified Young's Modulus from depending on the compaction of the voxel of the specified position.
 
bool isSoilAggregateContact (agxCollide::GeometryContact *gc) const
 
void modifyTerrainGeometryContacts ()
 Modifies current geometry contacts with updated parameters (such as Young's Modulus among others) for each point depending on the compaction of the voxel.
 
bool raycastTerrainVertexToGeometry (const agxCollide::Geometry *collider, const agx::Vec2i &hfIndex, agx::Real &depth)
 Raycast in a terrain index in order to find intersection with a colliding geometry.
 
void registerContactingGeometry (const agxCollide::Geometry *geometry, agxSDK::Simulation *simulation)
 
void unRegisterContactingGeometry (const agxCollide::Geometry *geometry)
 
void unRegisterGeometriesNotInContact (const agxCollide::GeometryHashSet &geometriesInContact)
 
void updateTerrainContactsWithForceData ()
 Update the TerrainContact objects with force data.
 
- 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

This class has two main responsibilities:

  • Generate TerrainContact objects between the terrain and externally colliding geometries. Primary used in compaction calculation.
  • Replace existing geometry contacts with contacts containing modified Young's Modulus depending on compaction of voxel in contact point.

The generated TerrainContact objects contains information about approximative area and volume overlap which is used in compaction and deformation calculations.

Definition at line 60 of file TerrainContactGenerator.h.

Constructor & Destructor Documentation

◆ TerrainContactGenerator() [1/2]

agxTerrain::TerrainContactGenerator::TerrainContactGenerator ( Terrain *  terrain)

Default constructor.

◆ TerrainContactGenerator() [2/2]

agxTerrain::TerrainContactGenerator::TerrainContactGenerator ( )

◆ ~TerrainContactGenerator()

virtual agxTerrain::TerrainContactGenerator::~TerrainContactGenerator ( )
protectedvirtual

Reference counted object - protected destructor.

Member Function Documentation

◆ addNeighborIndex()

void agxTerrain::TerrainContactGenerator::addNeighborIndex ( const agx::Vec2i &  index,
std::queue< agx::Vec2i > &  indicesToCheck,
agx::HashSet< agx::Vec2i > &  visitedIndices 
) const
protected

◆ buildTerrainContacts()

void agxTerrain::TerrainContactGenerator::buildTerrainContacts ( agxSDK::Simulation *  simulation)
protected

Build the TerrainContact objects used in compaction calculations.

◆ collectTerrainContacts()

void agxTerrain::TerrainContactGenerator::collectTerrainContacts ( agxSDK::Simulation *  simulation)
protected

Collect contacts between externally colliding geometries and the terrain (Does not include SoilParticleAggregateContacts).

◆ findIntersectingIndexInContact()

std::tuple< TerrainIndexToDepthTable, agx::Bound3 > agxTerrain::TerrainContactGenerator::findIntersectingIndexInContact ( const agxCollide::GeometryContactPtrVector &  contacts)
protected

Find the terrain grid indices intersecting with the colliding geometry via ray intersection tests.

Parameters
contacts- The geometry contacts associated with the contact between the collider and the terrain object
Returns
table containing the terrain indices intersecting the geometry volume mapped to the depth of the intersection.

◆ generateTerrainContact()

TerrainContact * agxTerrain::TerrainContactGenerator::generateTerrainContact ( const agxCollide::GeometryContactPtrVector &  contacts,
agxSDK::Simulation *  simulation 
)
protected

Get the current generated Terrain contacts.

◆ getCollider()

const agxCollide::Geometry * agxTerrain::TerrainContactGenerator::getCollider ( const agxCollide::GeometryContact *  contact) const
protected

Get the collider geometry in the geometry contact.

◆ getCurrentContactTime()

agx::Real agxTerrain::TerrainContactGenerator::getCurrentContactTime ( const agxCollide::Geometry *  geometry) const
protected

◆ getModifiedYoungsModuls()

agx::Real agxTerrain::TerrainContactGenerator::getModifiedYoungsModuls ( const agx::Vec3 &  position,
const agx::ContactMaterial *  existingContactMaterial 
) const
protected

Get modified Young's Modulus from depending on the compaction of the voxel of the specified position.

Parameters
position- The world position.
existingContactMaterial- the existing contact material.
Returns
The modified Young's Modulus from the position.

◆ getTerrainContacts() [1/2]

TerrainContactRefVector & agxTerrain::TerrainContactGenerator::getTerrainContacts ( )
Returns
the current generated Terrain contacts.

◆ getTerrainContacts() [2/2]

const TerrainContactRefVector & agxTerrain::TerrainContactGenerator::getTerrainContacts ( ) const
Returns
the current generated Terrain contacts.

◆ getTerrainContactVector()

TerrainContactRefVector * agxTerrain::TerrainContactGenerator::getTerrainContactVector ( )

◆ isSoilAggregateContact()

bool agxTerrain::TerrainContactGenerator::isSoilAggregateContact ( agxCollide::GeometryContact *  gc) const
protected

◆ modifyTerrainGeometryContacts()

void agxTerrain::TerrainContactGenerator::modifyTerrainGeometryContacts ( )
protected

Modifies current geometry contacts with updated parameters (such as Young's Modulus among others) for each point depending on the compaction of the voxel.

◆ onPost()

void agxTerrain::TerrainContactGenerator::onPost ( agxSDK::Simulation *  simulation)

Do post updates for the contact generator.

This does the following:

◆ onPre()

void agxTerrain::TerrainContactGenerator::onPre ( agxSDK::Simulation *  simulation)

Do pre updates for the contact generator.

This does the following:

  • Build Terrain contact objects from colliding objects
  • Generate new geometry contacts between colliders and the Terrain with updated Young's Modulus

◆ onRemove()

void agxTerrain::TerrainContactGenerator::onRemove ( agxSDK::Simulation *  simulation)

Do cleanup when removed from the Simulation.

◆ raycastTerrainVertexToGeometry()

bool agxTerrain::TerrainContactGenerator::raycastTerrainVertexToGeometry ( const agxCollide::Geometry *  collider,
const agx::Vec2i &  hfIndex,
agx::Real &  depth 
)
protected

Raycast in a terrain index in order to find intersection with a colliding geometry.

Parameters
collider- The colliding geometry to test ray intersection against.
hfIndex- The index to raycast in.
depth- The depth of the intersection of the geometry in the grid point.
Returns
true if the line intersects with the collider below the height field.

◆ registerContactingGeometry()

void agxTerrain::TerrainContactGenerator::registerContactingGeometry ( const agxCollide::Geometry *  geometry,
agxSDK::Simulation *  simulation 
)
protected

◆ unRegisterContactingGeometry()

void agxTerrain::TerrainContactGenerator::unRegisterContactingGeometry ( const agxCollide::Geometry *  geometry)
protected

◆ unRegisterGeometriesNotInContact()

void agxTerrain::TerrainContactGenerator::unRegisterGeometriesNotInContact ( const agxCollide::GeometryHashSet &  geometriesInContact)
protected

◆ updateTerrainContactsWithForceData()

void agxTerrain::TerrainContactGenerator::updateTerrainContactsWithForceData ( )
protected

Update the TerrainContact objects with force data.


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