![]() |
AGX Dynamics 2.40.0.0
|
A terrain model based a 3D grid model with overlapping height field that can be deformed by interacting shovels objects performing digging motions, converting solid mass to dynamic mass which can be moved. More...
#include <Terrain.h>
Classes | |
struct | offsetIndexInfo |
Public Types | |
enum class | MassType { SOLID , PARTICLE , FLUID } |
enum class | MaterialType { TERRAIN , PARTICLE , AGGREGATE } |
![]() | |
typedef Event2< Component *, Object * > | ObjectEvent |
Event when adding removing child objects. | |
typedef Callback1< Object * > | TraverseCallback |
![]() | |
typedef agx::observer_ptr< const Event > | EventConstObserver |
typedef agx::ref_ptr< const Event > | EventConstRef |
typedef agx::observer_ptr< Event > | EventObserver |
typedef agx::Vector< EventObserver > | EventObserverVector |
typedef agx::VectorPOD< Event * > | EventPtrVector |
typedef agx::ref_ptr< Event > | EventRef |
typedef agx::Vector< EventRef > | EventRefVector |
Public Member Functions | |
Terrain (size_t resolutionX, size_t resolutionY, agx::Real elementSize, agx::Real maximumDepth) | |
Constructor. | |
Terrain (size_t resolutionX, size_t resolutionY, agx::Real elementSize, const agx::RealVector &heights, bool flipY, agx::Real maximumDepth) | |
Constructor. | |
Terrain (size_t resolutionX, size_t resolutionY, agx::Real elementSize, const agx::RealVector &heights, const agx::RealVector &minimumHeights) | |
Constructor. | |
bool | add (Shovel *shovel) |
bool | addForbiddenBound (IForbiddenBound *bound) |
Add a ForbiddenBound to a terrain that prevents mergining and avalanching for the indices and positions inside the bound. | |
ForbiddenBound * | addNoMergeZoneToGeometry (agxCollide::Geometry *geometry, const agxCollide::BoundingAABB &bound, const agx::AffineMatrix4x4 &localTransform) |
Utility method for creating a forbidden bound that follow the transformation of a specified geometry. | |
bool | addTerrainMaterial (TerrainMaterial *terrainMaterial) |
Add a non default TerrainMaterial to the terrain instance, without designating its domain. | |
int | addTerrainMaterial (TerrainMaterial *terrainMaterial, agxCollide::Geometry *geometry) |
Add a non default TerrainMaterial to the designated region bounded by the overlap between the terrain and the given geometry. | |
agx::Real | calculateTotalDynamicMass () const |
agx::Real | calculateTotalFluidMass () const |
agx::Real | calculateTotalMass () const |
agx::Real | calculateTotalSolidMass () const |
agx::Real | calculateVolume () |
void | clearTerrainMaterials (bool clearAddedMaterials=true) |
bool | contains (const Shovel *shovel) const |
void | convertToDynamicMassInShape (agxCollide::Shape *shape) |
Converts the terrain occupancy that overlaps the specified shape into dynamic mass. | |
bool | exchangeTerrainMaterial (TerrainMaterial *oldTerrainMaterial, TerrainMaterial *newTerrainMaterial) |
Exchange an already added TerrainMaterial with another TerrainMaterial without changing its associated agx::Material or assigned domain. | |
agx::Real | getAggregateTerrainContactArea (const Shovel *shovel, Shovel::ExcavationMode excavationMode) const |
agx::Vec3 | getAggregateTerrainContactForce (const Shovel *shovel, Shovel::ExcavationMode excavationMode) const |
agxCollide::GeometryContactPtrVector | getAggregateTerrainContacts (const Shovel *shovel, Shovel::ExcavationMode excavationMode) const |
agx::Vec3 | getAggregateTerrainNormalForce (const Shovel *shovel, Shovel::ExcavationMode excavationMode) const |
agx::Vec3 | getAggregateTerrainTangentialForce (const Shovel *shovel, Shovel::ExcavationMode excavationMode) const |
agx::Material * | getAssociatedMaterial (TerrainMaterial *terrainMaterial) const |
agx::Real | getAverageSoilParticleRadius () const |
agx::Vec2i | getClosestGridPoint (const agx::Vec3 &worldPosition, bool clampToBound=false) const |
Finds the closes terrain grid point given any point in world. | |
agx::Vec3 | getContactForce (const Shovel *shovel) const |
agx::ContactMaterial * | getContactMaterial (Terrain::MaterialType type1, Terrain::MaterialType type2) |
Returns one of the internal contact materials in agxTerrain. | |
TerrainMaterial * | getDefaultTerrainMaterial () const |
Returns the default terrain material which is used to derive material and contact material parameters. | |
bool | getDeformable () const |
Gets whether or not deformations are enabled for this terrain. | |
agx::Vec3 | getDeformationContactForce (const Shovel *shovel) const |
agx::Real | getDynamicMass (const Shovel *shovel) const |
agx::Real | getElementSize () const |
Returns the element size of a cell in agxTerrain, which is incidentally the distance between the center of each grid point in the surface height field. | |
bool | getEnable () const |
bool | getEnableMinimumHeights () const |
agx::Vec3 | getExcavationModeContactForce (const Shovel *shovel, Shovel::ExcavationMode excavationMode) const |
ExternalDeformerPtrVector | getExternalDeformers () const |
Return the external deformers currently added in the simulation. | |
IForbiddenBoundPtrVector | getForbiddenBounds () |
virtual agxCollide::Geometry * | getGeometry () const override |
agx::Real | getHeight (const agx::Vec2i &terrainIndex, bool includeSurfaceParticles=false) const |
Gets the terrain height at a specific terrain grid node. | |
const agxCollide::HeightField * | getHeightField () const |
agx::Real | getInnerVolume (const Shovel *shovel) const |
bool | getIntersectingActiveGridElements (agxCollide::Geometry *geometry, agx::Vec3iVector &gridPoints, MassType massType, bool onlyMidpoint=false) const |
Get intersecting 3D grid element with specified geometry that is active/occupied with a specified mass type. | |
bool | getIntersectingGridElements (agxCollide::Geometry *geometry, agx::Vec3iVector &gridPoints) const |
Get intersecting 3D grid element with specified geometry. | |
agx::AffineMatrix4x4 | getInverseTransform () const |
agx::Real | getLastDeadLoadFraction (const Shovel *shovel) const |
agx::Real | getLastExcavatedVolume () const |
agx::Material * | getMaterial (Terrain::MaterialType type=Terrain::MaterialType::TERRAIN) const |
Returns one of the internal materials in agxTerrain: MaterialType::TERRAIN - The internal material used on the terrain surface height field structure. | |
agx::RealVector | getMaterialWeightsInGridPoints (const agx::Vec3iVector &gridPoints) const |
Get the material weights in the terrain of the specified grid points. | |
agx::RealVector | getMaterialWeightsInLine (const agx::Line &line) const |
Get the material weights in the terrain of the voxels that intersect the specified line. | |
size_t | getMemoryUsage () |
Returns the memory usage in bytes in agxTerrain. | |
agx::Real | getMinimumAllowedHeight () const |
agx::Real | getMinimumHeight (const agx::Vec2i &terrainIndex) const |
agx::RealVector | getMinimumHeights () const |
Return row major array with dimension (resolutionX * resolutionY) with the minimum height allowed in each grid point. | |
const ModifiedVerticesVector & | getModifiedParticleVertices () const |
Returns the modified terrain height field (including particles) vertices during the last time step. | |
const ModifiedVerticesVector & | getModifiedVertices () const |
Returns the modified terrain height field vertices during the last time step. | |
bool | getNoMerge () |
Return whether this terrain is prevented from merging dynamic mass to it. | |
size_t | getNumCreatedParticles () const |
Return the number of soil particles created during excavation this time step. | |
size_t | getNumSoilParticles () const |
Return the number of soil particles active in the simulation. | |
float | getParticleNominalRadius () const |
Get the soil particle nominal radius from the simulation. | |
const ModifiedVerticesVector & | getParticleVertices () const |
Returns the terrain vertices that contains soil particles during the last time step. | |
bool | getPenetrationForce (const Shovel *shovel, agx::Vec3 &force, agx::Vec3 &torque) const |
agx::Vec3 | getPosition () const |
TerrainProperties * | getProperties () |
TerrainProperties * | getProperties () const |
agx::RealVector | getResizedHeightField (size_t factorX, size_t factorY) const |
Calculate a reduced version of the height field structure. | |
size_t | getResolutionX () const |
size_t | getResolutionY () const |
agx::Quat | getRotation () const |
agx::Vec3 | getSeparationContactForce (const Shovel *shovel) const |
agx::Vec3 | getSeparationFrictionForce (const Shovel *shovel) const |
agx::Vec3 | getSeparationNormalForce (const Shovel *shovel) const |
agx::ContactMaterial * | getShovelAggregateContactMaterial (const Shovel *shovel, Shovel::ExcavationMode mode=Shovel::ExcavationMode::PRIMARY) const |
agxCollide::GeometryContactPtrVector | getShovelAggregateContacts (const Shovel *shovel, Shovel::ExcavationMode excavationMode) const |
ShovelPtrVector | getShovels () const |
Return the shovels currently added in the simulation. | |
agx::Vec2 | getSize () const |
Returns the total surface size of he terrain in X Y coordinate system. | |
agx::Real | getSoilAggregateMass (const Shovel *shovel, Shovel::ExcavationMode excavationMode) const |
const agxCollide::HeightField * | getSoilParticleBoundedHeightField () const |
Get the soil particle height field consisting of the highest point of either the terrain surface or the highest particle position in each terrain index. | |
SoilParticleStatistics | getSoilParticleStatistics () const |
Get basic statistics of the soil particles active in the simulation. | |
SoilSimulationInterface * | getSoilSimulationInterface () const |
Get the soil particle system interface used to represent the dynamic mass in the terrain. | |
agx::Vec3 | getSurfacePosition (const agx::Vec2i &terrainIndex, bool includeSurfaceParticles=false) const |
Finds the terrain surface position, given in local coordinate frame, for a specified terrain index. | |
agx::Vec3 | getSurfacePositionWorld (const agx::Vec2i &terrainIndex, bool includeSurfaceParticles=false) const |
Finds the terrain surface world position for a specified terrain index. | |
const TerrainContactRefVector & | getTerrainContacts () const |
TerrainContactPtrVector | getTerrainContactsPtrVector () const |
TerrainContactRefVector * | getTerrainContactsVector () const |
TerrainGridControl * | getTerrainGridControl () const |
Get control interface of the terrain grid data. | |
TerrainMaterial * | getTerrainMaterial () const |
Returns the default terrain material which is used to derive material and contact material parameters. | |
TerrainMaterial * | getTerrainMaterial (agx::Vec3 position) const |
Returns the terrain material at the specific position which is used to derive material and contact material parameters. | |
deprecated::TerrainToolCollection * | getToolCollection (const Shovel *shovel) const |
deprecated::TerrainToolCollectionRefVector | getToolCollections () const |
agx::Real | getTotalSoilParticleMass () const |
Get the total mass (kg) of the active soil particles in the simulation. | |
agx::AffineMatrix4x4 | getTransform () const |
agx::Vec3 | getUpDirection () const |
Returns the world up direction of the terrain. | |
agx::Real | getVoxelArea () const |
agx::Real | getVoxelVolume () const |
bool | hasOverlap (const agxCollide::Geometry *geometry) const |
Return true if the specified geometry bounding volume overlaps the terrain geometry bounding volume. | |
bool | indexIsInsideForbiddenBounds (const agx::Vec3i &terrainIndex, bool onlyUserDefined=false) |
Check if the specified index is inside the forbidden bounds in the terrain. | |
bool | isBorderIndex (const agx::Vec2i &terrainIndex) const |
Checks if the specified index is at the border of the terrain. | |
bool | isDigging (const Shovel *shovel) const |
bool | isGeometryShovel (const agxCollide::Geometry *geometry) const |
bool | isIndexWithinBounds (const agx::Vec2i &terrainIndex) const |
Checks if the specified index is within bound of the terrain [(0,0) -> (resolutionX, resolutionY)]. | |
bool | isLocalPositionWithinBounds (const agx::Vec3 &position) const |
Checks whether the position is within terrain (x,y) position bounds in local space. | |
bool | isOfHomogeneousTerrainMaterial () const |
bool | isRigidBodyShovel (const agx::RigidBody *body) const |
bool | isWorldPositionWithinBounds (const agx::Vec3 &position) const |
Checks whether the position is within terrain (x,y) position bounds in world space. | |
bool | loadLibraryMaterial (const agx::String &materialName) |
Loads a TerrainMaterial preset in the TerrainMaterialLibrary that contains calibrated bulk and contact properties for a predefined material archetype. | |
bool | loadMaterialFile (const agx::String &filename) |
Load a TerrainMaterial from a specification file in JSON data format. | |
bool | pointIsInsideForbiddenBounds (const agx::Vec3 &positionWorld, bool onlyUserDefined=false) |
Check if the specified points is inside the forbidden bounds in the terrain. | |
agx::Bool | projectPointToSurface (const agx::Vec3 &worldPosition, agx::Vec3 &result) const |
Project a world point to the grid surface. | |
agx::Bool | projectPointToSurfaceInDirection (const agx::Vec3 &worldPosition, const agx::Vec3 &worldDirection, agx::Vec3 &result) const |
Project a world point to the grid surface in a given direction. | |
bool | remove (Shovel *shovel) |
float | removeFluidMassInGeometry (agxCollide::Geometry *geometry, float fluidMass) |
Remove fluid mass (in kg, NOT occupancy) in the intersecting 3D grid element with specified geometry. | |
bool | removeForbiddenBound (IForbiddenBound *bound) |
Remove a ForbiddenBound from a terrain that prevents merging and avalanching for the indices and positions inside the bounds. | |
void | removeModifiedParticleVertice (agx::Vec2i terrainIndex) |
Removes a vertex from the vector with vertices that were modified during the last time step. | |
bool | removeTerrainMaterial (TerrainMaterial *terrainMaterialToRemove) |
bool | removeVolumeInShape (agxCollide::Shape *shape) |
Instantly removes a terrain volume in the speficied shape. | |
bool | setAssociatedMaterial (TerrainMaterial *terrainMaterial, agx::Material *material) |
Set the associated material with the given TerrainMaterial. | |
void | setCompaction (agx::Real compaction, bool replaceCompactedSoil=true) const |
Set a compaction for all current active solid grid elements in the Terrain object. | |
void | setDeformable (bool deformable) |
Sets if deformation should be enabled on this terrain. | |
void | setEnable (bool enable) |
Set if terrain computations should be enabled. | |
void | setEnableMinimumHeights (bool enable) |
void | setHeight (const agx::Vec2i &terrainIndex, agx::Real height) |
Sets Terrain height at a specific terrain grid node. | |
bool | setHeights (const agx::RealVector &heights, bool flipY=false, bool resetCompaction=true) |
Set height values of all sampled points. | |
void | setMaterial (agx::Material *material, Terrain::MaterialType type=Terrain::MaterialType::TERRAIN) |
Assign new material to this terrain. | |
void | setMinimumHeight (const agx::Vec2i &terrainIndex, agx::Real minimumHeight) |
bool | setMinimumHeights (const agx::RealVector &minimumHeights) |
void | setNoMerge (bool noMerge) |
Prevent merge of dynamic mass to this terrain. | |
void | setNoMergeEdgeMargin (size_t noMergeEdgeMargin) |
Add disable merge and avalanche a number of indices from the terrain edge. | |
void | setPosition (const agx::Vec3 &position) |
Set the position of this terrain. | |
void | setProperties (TerrainProperties *properties) |
Set the TerrainProperties of the Terrian object. | |
void | setRotation (const agx::Quat &rotation) |
Set the rotation of this terrain. | |
bool | setShovelAggregateContactMaterial (Shovel *shovel, agx::ContactMaterial *contactMaterial, Shovel::ExcavationMode mode=Shovel::ExcavationMode::PRIMARY) |
void | setTerrainMaterial (TerrainMaterial *terrainMaterial, agx::Material *material=nullptr) |
Set the default terrain material for the bulk of the terrain which is used to derive material and contact material parameters. | |
void | setTransform (const agx::AffineMatrix4x4 &transform) |
Set the transform of this terrain. | |
agx::Vec3 | transformPointToTerrain (const agx::Vec3 point) const |
Transform point given in world coordinate frame to local coordinate frame of this terrain. | |
agx::Vec3 | transformPointToVoxelSpace (const agx::Vec3 point) const |
Transform point given in world coordinate frame to local coordinate frame of this terrain. | |
agx::Vec3 | transformPointToWorld (const agx::Vec3 point) const |
Transform point given in local coordinate frame of this terrain, to world coordinate frame. | |
agx::Vec3 | transformVectorToTerrain (const agx::Vec3 vector) const |
Transform vector given in world coordinate frame to local coordinate frame of this terrain. | |
agx::Vec3 | transformVectorToWorld (const agx::Vec3 vector) const |
Transform vector given in local coordinate frame of this terrain, to world coordinate frame. | |
void | triggerForceAvalancheAll () |
Triggers initial avalanching on all indices in the terrain. | |
![]() | |
void | addEventListener (agxSDK::StepEventListener *listener) |
virtual agxCollide::Geometry * | getGeometry () const |
agxSDK::Simulation * | getSimulation () const |
bool | removeEventListener (agxSDK::StepEventListener *listener) |
![]() | |
Component (const agx::Name &name=agx::Name(), agx::Model *model=agx::Component::ClassModel(), agx::Device *device=nullptr) | |
virtual void | addObject (agx::Object *object, bool assignContext=true) |
Add an object to the component. | |
virtual String | autoComplete (const String &partialName, StringVector &matchingNames) const |
virtual void | buildNavigationTree (agxJson::Value &eNode) const override |
void | configure (Model *model) |
virtual void | configure (TiXmlElement *eComponent) override |
agx::Device * | getDevice () |
template<typename T > | |
T * | getDevice () |
const agx::Device * | getDevice () const |
template<typename T > | |
const T * | getDevice () const |
size_t | getNumObjects (const agx::Name &name) const |
agx::Object * | getObject (const agx::Name &name, agx::Model *model, size_t index=0) |
const agx::Object * | getObject (const agx::Name &name, agx::Model *model, size_t index=0) const |
agx::Object * | getObject (const agx::Name &name, size_t index=0) |
template<typename T > | |
T * | getObject (const agx::Name &name, size_t index=0) |
const agx::Object * | getObject (const agx::Name &name, size_t index=0) const |
template<typename T > | |
const T * | getObject (const agx::Name &name, size_t index=0) const |
const agx::ObjectRefVector & | getObjects () const |
template<typename T > | |
void | getObjects (agx::ObjectPtrVector &result, bool recursive=false) const |
void | getObjects (agx::ObjectPtrVector &result, const agx::Model *model, bool recursive=false) const |
virtual Object * | getResourceImpl (const Path &path, agx::Model *model) override |
virtual void | printSubtree () const override |
void | printSubtree (std::ostream &stream, int depth=0) const |
virtual void | rebind () override |
void | removeAllObjects () |
Remove all components. | |
virtual void | removeObject (agx::Object *object) |
Remove an object from the component. | |
void | removeObject (const agx::Name &name, size_t index=0) |
Remove an object with a specified name (and optional index) from the component. | |
virtual void | snapshot (TiXmlNode *eParent, const String &directory) const override |
void | traverse (ComponentVisitor *) |
void | traverse (const TraverseCallback &callback) |
![]() | |
Object (const Name &name=Name(), Model *model=Object::ClassModel()) | |
void | addListener (EventListener *listener) |
virtual void | buildNavigationTree (agxJson::Value &eNode) const |
virtual void | configure (TiXmlElement *) |
agx::String | fullName () const |
agx::String | fullPath () const |
agx::String | fullPath (const agx::Object *root) const |
template<typename T > | |
T * | getAutoScopedResource (const agx::Path &path) |
template<typename T > | |
const T * | getAutoScopedResource (const agx::Path &path) const |
agx::Object * | getAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr) |
const agx::Object * | getAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr) const |
agx::Object * | getContext () |
template<typename T > | |
T * | getContext () |
const agx::Object * | getContext () const |
template<typename T > | |
const T * | getContext () const |
agx::UInt32 | getId () const |
const agx::Name & | getImplementationName () const |
agx::Model * | getModel () |
const agx::Model * | getModel () const |
const agx::Name & | getName () const |
agx::Object * | getNextSibling () |
const agx::Object * | getNextSibling () const |
agx::Path | getPath () const |
agx::Path | getPath (const agx::Object *root) const |
template<typename T > | |
T * | getResource (const agx::Path &path) |
template<typename T > | |
const T * | getResource (const agx::Path &path) const |
agx::Object * | getResource (const agx::Path &path, agx::Model *model=nullptr) |
const agx::Object * | getResource (const agx::Path &path, agx::Model *model=nullptr) const |
virtual agx::Object * | getResourceImpl (const agx::Path &path, agx::Model *model) |
agx::Object * | getRootContext () |
const agx::Object * | getRootContext () const |
bool | hasListener (EventListener *listener) |
bool | hasParent (const agx::Object *node) const |
bool | isUnique () const |
virtual void | printSubtree () const |
virtual void | rebind () |
void | removeListener (EventListener *listener) |
virtual void | save (TiXmlElement *) const |
virtual void | setContext (agx::Object *context) |
void | setId (UInt32 id) |
void | setModel (agx::Model *model) |
Set the object model (handled automatically). | |
void | setName (const agx::Name &name) |
Set the name of the object. | |
virtual void | snapshot (TiXmlNode *, const String &) const |
![]() | |
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. | |
![]() | |
virtual | ~Serializable () |
Destructor for normal C++ use but hidden from SWIG bindings. | |
virtual const char * | getClassName () const |
bool | getEnableSerialization () const |
bool | getEnableUuidGeneration () |
agx::UInt32 | getIndex () const |
This index is given at creation of this object. | |
virtual StorageAgent * | getStorageAgent () const =0 |
agx::Uuid | getUuid () const |
bool | isFinished () const |
void | setEnableSerialization (bool flag) |
Set to false to disable serialization of this object. | |
void | setFinished () |
Tells this class that it is restored correctly and should not be deleted during destruction of an Archive. | |
void | setUuid (const agx::Uuid &uuid) |
Explicitly set a Uuid on a serializable object. | |
Static Public Member Functions | |
static Terrain * | createFromHeightField (const agxCollide::HeightField *heightField, agx::Real maximumDepth) |
Creates a terrain object by using an existing height field as a basis. | |
static Terrain * | createTerrainBedFromGeometries (size_t resolution, agxCollide::GeometryPtrVector bedGeometries, agx::Real edgeMargin=0.0, agx::Real bedOffset=0.0, bool resolutionAxisIsX=true) |
static Terrain * | createTerrainBedFromGeometry (size_t resolution, agxCollide::Geometry *bedGeometry, agx::Real edgeMargin=0.0, agx::Real bedOffset=0.0, bool resolutionAxisIsX=true) |
static Terrain * | find (const agxSDK::Simulation *simulation, const agx::Name &name) |
Find first terrain with given name. | |
static Terrain * | find (const agxSDK::Simulation *simulation, const agx::Uuid &uuid) |
Find terrain with given UUID. | |
static TerrainPtrVector | findAll (const agxSDK::Simulation *simulation) |
Finds all terrains in the given simulation. | |
static TerrainPtrVector | findAll (const agxSDK::Simulation *simulation, const agx::Name &name) |
Find all terrains with given name. | |
static agx::StringVector | getAvailableLibraryMaterials () |
Get the available TerrainMaterial presets from the TerrainMaterialLibrary that contains calibrated bulk and contact properties for a predefined material archetype. | |
static agx::Bool | getEnableKinematicForParticles (const agx::RigidBody *rb) |
static TerrainMaterial * | getLibraryMaterial (const agx::String &materialName) |
Loads a TerrainMaterial preset in the TerrainMaterialLibrary that contains calibrated bulk and contact properties for a predefined material archetype. | |
static TerrainMaterial * | getMaterialFromFile (const agx::String &filename) |
Load a TerrainMaterial from a specification file in JSON data format. | |
static agx::Real | getTerrainParticlePackingRatio () |
static void | setEnableKinematicForParticles (agx::RigidBody *rb, agx::Bool enable) |
Enable/disable particles to see this rigid body as kinematic regardless of current motion control. | |
![]() | |
static Component * | _load (TiXmlElement *eComponent, Device *device) |
static agx::Model * | ClassModel () |
static Component * | load (const Path &path, const Name &implementation, Device *device, const Path &_namespace=Path()) |
static Component * | load (const String &path, const Path &_namespace=Path()) |
static Component * | load (const String &path, Device *device, const Path &_namespace=Path()) |
static Component * | load (TiXmlElement *eComponent, Device *device) |
![]() | |
static agx::Model * | ClassModel () |
static agx::String | generateName (const agx::String &bindPath) |
static const HashSet< Object * > & | getActiveObjects () |
static bool | getEnableRebind () |
Should rebinding be allowed? Right now a global setting. | |
static Object * | load (const String &path, Device *device, const String &type, const String &attribute, const String &value) |
template<typename T > | |
static T * | load (const String &path, Device *device, const String &type, const String &attribute, const String &value) |
static Object * | load (const String &path, Device *device, const String &type="", size_t instance=0) |
template<typename T > | |
static T * | load (const String &path, Device *device, const String &type="", size_t instance=0) |
static void | load (const String &path, Device *device, ObjectPtrVector &loadedObjects) |
static Object * | load (TiXmlElement *eObject, Device *device) |
template<typename T > | |
static T * | load (TiXmlElement *eObject, Device *device) |
static TiXmlDocument | openDocument (const String &path) |
static void | setEnableRebind (bool flag) |
Sets if rebinding of objects should be allowed (Right now a global setting). | |
![]() | |
template<typename T > | |
static bool | ValidateCast (const Referenced *object) |
![]() | |
static void | setEnableUuidGeneration (bool flag) |
Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled. | |
Protected Types | |
using | GoToStopCondition = std::function< bool(const agx::Vec3i &index)> |
typedef struct agxTerrain::Terrain::offsetIndexInfo | offsetIndexInfo |
using | ParticleIslandVector = agx::Vector< agx::Vector< std::pair< agx::Vec3i, offsetIndexInfo > > > |
Additional Inherited Members | |
![]() | |
ObjectEvent | addObjectEvent |
ObjectEvent | removeObjectEvent |
![]() | |
static DeleteHandler * | getDeleteHandler () |
static void | setDeleteHandler (DeleteHandler *handler) |
Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. | |
![]() | |
Mutex | m_mutex |
ObserverContainer | m_observers |
AtomicValue | m_refCount |
A terrain model based a 3D grid model with overlapping height field that can be deformed by interacting shovels objects performing digging motions, converting solid mass to dynamic mass which can be moved.
The underlying terrain data model consists of a hierarchical sparse 3D grid of cells, containing terrain data such as mass. The terrain surface is represented as a 2D height field that is updated when the underlying grid structure is changed. Mass is moved in the terrain via interacting shovels that converts solid cells to dynamic mass. Each shovel has an "Active Zone" which is defined by specifying two edges on the shovel's constructor, a top edge and a cutting edge. These edges should be perpendicular to the shovel's digging direction and parallel to the shovel's cross section. When the active zone intersects the terrain, dynamic mass is created in the overlapping area.
|
protected |
|
protected |
|
protected |
|
strong |
|
strong |
agxTerrain::Terrain::Terrain | ( | size_t | resolutionX, |
size_t | resolutionY, | ||
agx::Real | elementSize, | ||
agx::Real | maximumDepth | ||
) |
Constructor.
Creates a terrain object with a specific resolution of 2D grid points with elementSize as the length between them. The terrain length in each direction thus becomes (resolution - 1) * elementSize.
resolutionX | - Represents the total count of discrete data points or height points present in the 'X' dimension, rather than indicating the number of sample points per unit length in that dimension. |
resolutionY | - Represents the total count of discrete data points or height points present in the 'Y' dimension, rather than indicating the number of sample points per unit length in that dimension. |
elementSize | - The distance between the height points in the terrain. |
maximumDepth | - The maximum depth that the terrain can have. |
agxTerrain::Terrain::Terrain | ( | size_t | resolutionX, |
size_t | resolutionY, | ||
agx::Real | elementSize, | ||
const agx::RealVector & | heights, | ||
bool | flipY, | ||
agx::Real | maximumDepth | ||
) |
Constructor.
Creates a terrain object with a specific resolution of 2D grid points with elementSize as the length between them. The terrain length in each direction thus becomes (resolution - 1) * elementSize.
resolutionX | - Represents the total count of discrete data points or height points present in the 'X' dimension, rather than indicating the number of sample points per unit length in that dimension. |
resolutionY | - Represents the total count of discrete data points or height points present in the 'Y' dimension, rather than indicating the number of sample points per unit length in that dimension. |
elementSize | - The distance between the height points in the terrain. |
heights | - A row major matrix, containing the specified heights, with dimensions (resolutionX, resolutionY). |
flipY | - set to true if y decreases with increasing indices in heights. |
maximumDepth | - The maximum depth that the terrain can have. |
agxTerrain::Terrain::Terrain | ( | size_t | resolutionX, |
size_t | resolutionY, | ||
agx::Real | elementSize, | ||
const agx::RealVector & | heights, | ||
const agx::RealVector & | minimumHeights | ||
) |
Constructor.
Creates a terrain object with a specific resolution of 2D grid points with elementSize as the length between them. The terrain length in each direction thus becomes (resolution - 1) * elementSize.
resolutionX | - The number of height points to use in the Terrain in the X-direction. |
resolutionY | - The number of height points to use in the Terrain in the Y-direction. |
elementSize | - The distance between the height points in the terrain. |
heights | - A row major matrix, containing the specified heights, with dimensions (resolutionX, resolutionY). |
minimumHeights | - A row major matrix, containing the minimum heights, with dimensions (resolutionX, resolutionY). The surface height field is not allowed to be greater than the local values of these minimum heights. |
|
protected |
Default constructor used in serialization.
|
protectedvirtual |
|
protected |
|
protected |
bool agxTerrain::Terrain::add | ( | Shovel * | shovel | ) |
shovel | - The specified shovel object. |
|
protected |
bool agxTerrain::Terrain::addForbiddenBound | ( | IForbiddenBound * | bound | ) |
Add a ForbiddenBound to a terrain that prevents mergining and avalanching for the indices and positions inside the bound.
bound | - The forbidden bound to be added to the terrain. |
|
protected |
|
protected |
ForbiddenBound * agxTerrain::Terrain::addNoMergeZoneToGeometry | ( | agxCollide::Geometry * | geometry, |
const agxCollide::BoundingAABB & | bound, | ||
const agx::AffineMatrix4x4 & | localTransform | ||
) |
Utility method for creating a forbidden bound that follow the transformation of a specified geometry.
This bound disables merge and avalanche for vertices inside.
geometry | - the specified geometry that the bound will follow. |
bound | - the specified axis-aligned bound. |
localTransform | - the local transform of the bound. |
|
overrideprotectedvirtual |
Add notification executed when terrain is added to a simulation.
Reimplemented from agxSDK::TerrainInstance.
bool agxTerrain::Terrain::addTerrainMaterial | ( | TerrainMaterial * | terrainMaterial | ) |
Add a non default TerrainMaterial to the terrain instance, without designating its domain.
terrainMaterial | - The TerrainMaterial to add. |
int agxTerrain::Terrain::addTerrainMaterial | ( | TerrainMaterial * | terrainMaterial, |
agxCollide::Geometry * | geometry | ||
) |
Add a non default TerrainMaterial to the designated region bounded by the overlap between the terrain and the given geometry.
terrainMaterial | - The TerrainMaterial to add. |
geometry | - The geometry where the TerrainMaterial should be added. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
agx::Real agxTerrain::Terrain::calculateTotalDynamicMass | ( | ) | const |
agx::Real agxTerrain::Terrain::calculateTotalFluidMass | ( | ) | const |
agx::Real agxTerrain::Terrain::calculateTotalMass | ( | ) | const |
agx::Real agxTerrain::Terrain::calculateTotalSolidMass | ( | ) | const |
agx::Real agxTerrain::Terrain::calculateVolume | ( | ) |
void agxTerrain::Terrain::clearTerrainMaterials | ( | bool | clearAddedMaterials = true | ) |
|
protected |
|
protected |
bool agxTerrain::Terrain::contains | ( | const Shovel * | shovel | ) | const |
shovel | - the shovel object that is checked against the terrain. |
|
protected |
|
protected |
|
protected |
|
protected |
void agxTerrain::Terrain::convertToDynamicMassInShape | ( | agxCollide::Shape * | shape | ) |
Converts the terrain occupancy that overlaps the specified shape into dynamic mass.
shape | - The shape within which to convert occupancy into dynamic mass |
|
protected |
|
protected |
|
protected |
|
static |
Creates a terrain object by using an existing height field as a basis.
The height field data is copied into the internal terrain structure. The existing height field MUST have uniform scale in X and Y axis, otherwise the function returns nullptr.
heightField | - The height field object that will be used as a basis for creating |
maximumDepth | - The maximum depth of the terrain. |
|
protected |
|
protected |
|
protected |
|
static |
|
static |
|
protected |
|
protected |
|
protected |
bool agxTerrain::Terrain::exchangeTerrainMaterial | ( | TerrainMaterial * | oldTerrainMaterial, |
TerrainMaterial * | newTerrainMaterial | ||
) |
Exchange an already added TerrainMaterial with another TerrainMaterial without changing its associated agx::Material or assigned domain.
oldTerrainMaterial | - the TerrainMaterial to be replaced |
newTerrainMaterial | - the new TerrainMaterial to put in its place |
|
protected |
|
static |
Find first terrain with given name.
simulation | - simulation the terrain is part of |
name | - name of the terrain |
|
static |
Find terrain with given UUID.
simulation | - simulation the terrain is part of |
uuid | - UUID of the terrain |
|
static |
Finds all terrains in the given simulation.
simulation | - simulation with terrains. |
|
static |
Find all terrains with given name.
simulation | - simulation the terrain is part of |
name | - name of the terrain |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
agx::Real agxTerrain::Terrain::getAggregateTerrainContactArea | ( | const Shovel * | shovel, |
Shovel::ExcavationMode | excavationMode | ||
) | const |
shovel | - the specified shovel |
excavationMode | - the excavation mode that the aggregate belongs too ( PRIMARY, DEFORM_BACK, DEFORM_RIGHT, DEFORM_LEFT ) |
agx::Vec3 agxTerrain::Terrain::getAggregateTerrainContactForce | ( | const Shovel * | shovel, |
Shovel::ExcavationMode | excavationMode | ||
) | const |
shovel | - the specified shovel |
excavationMode | - the excavation mode that the aggregate belongs too ( PRIMARY, DEFORM_BACK, DEFORM_RIGHT, DEFORM_LEFT ) |
agxCollide::GeometryContactPtrVector agxTerrain::Terrain::getAggregateTerrainContacts | ( | const Shovel * | shovel, |
Shovel::ExcavationMode | excavationMode | ||
) | const |
shovel | - the specified shovel |
excavationMode | - the excavation mode that the aggregate belongs too ( PRIMARY, DEFORM_BACK, DEFORM_RIGHT, DEFORM_LEFT ) |
agx::Vec3 agxTerrain::Terrain::getAggregateTerrainNormalForce | ( | const Shovel * | shovel, |
Shovel::ExcavationMode | excavationMode | ||
) | const |
shovel | - the specified shovel |
excavationMode | - the excavation mode that the aggregate belongs too ( PRIMARY, DEFORM_BACK, DEFORM_RIGHT, DEFORM_LEFT ) |
agx::Vec3 agxTerrain::Terrain::getAggregateTerrainTangentialForce | ( | const Shovel * | shovel, |
Shovel::ExcavationMode | excavationMode | ||
) | const |
shovel | - the specified shovel |
excavationMode | - the excavation mode that the aggregate belongs too ( PRIMARY, DEFORM_BACK, DEFORM_RIGHT, DEFORM_LEFT ) |
agx::Material * agxTerrain::Terrain::getAssociatedMaterial | ( | TerrainMaterial * | terrainMaterial | ) | const |
|
static |
Get the available TerrainMaterial presets from the TerrainMaterialLibrary that contains calibrated bulk and contact properties for a predefined material archetype.
|
protected |
agx::Real agxTerrain::Terrain::getAverageSoilParticleRadius | ( | ) | const |
agx::Vec2i agxTerrain::Terrain::getClosestGridPoint | ( | const agx::Vec3 & | worldPosition, |
bool | clampToBound = false |
||
) | const |
Finds the closes terrain grid point given any point in world.
worldPosition | - position in world |
clampToBound | - true if the grid point should be clamped to border if position is outside bounds |
shovel | - interacting shovel |
agx::ContactMaterial * agxTerrain::Terrain::getContactMaterial | ( | Terrain::MaterialType | type1, |
Terrain::MaterialType | type2 | ||
) |
Returns one of the internal contact materials in agxTerrain.
TODO fix this.
Contact materials exist between MaterialType::TERRAIN - MaterialType::PARTICLE MaterialType::PARTICLE - MaterialType::PARTICLE MaterialType::TERRAIN - MaterialType::AGGREGATE
|
inline |
|
inline |
Gets whether or not deformations are enabled for this terrain.
If false, then no dynamic mass particles or fluid mass is created. Additionally, no avalanching or compaction occurs on the terrain.
shovel | - interacting shovel |
shovel | - interacting shovel |
|
protected |
|
inline |
Returns the element size of a cell in agxTerrain, which is incidentally the distance between the center of each grid point in the surface height field.
bool agxTerrain::Terrain::getEnable | ( | ) | const |
|
static |
|
inline |
agx::Vec3 agxTerrain::Terrain::getExcavationModeContactForce | ( | const Shovel * | shovel, |
Shovel::ExcavationMode | excavationMode | ||
) | const |
shovel | - interacting shovel |
excavationMode | - the excavation mode that the specified soil aggregate belongs to |
ExternalDeformerPtrVector agxTerrain::Terrain::getExternalDeformers | ( | ) | const |
Return the external deformers currently added in the simulation.
IForbiddenBoundPtrVector agxTerrain::Terrain::getForbiddenBounds | ( | ) |
|
overridevirtual |
Reimplemented from agxSDK::TerrainInstance.
agx::Real agxTerrain::Terrain::getHeight | ( | const agx::Vec2i & | terrainIndex, |
bool | includeSurfaceParticles = false |
||
) | const |
Gets the terrain height at a specific terrain grid node.
terrainIndex | An (x,y) index specifying the grid point. |
includeSurfaceParticles | - Also consider particles when returning height. Default false. |
const agxCollide::HeightField * agxTerrain::Terrain::getHeightField | ( | ) | const |
bool agxTerrain::Terrain::getIntersectingActiveGridElements | ( | agxCollide::Geometry * | geometry, |
agx::Vec3iVector & | gridPoints, | ||
MassType | massType, | ||
bool | onlyMidpoint = false |
||
) | const |
Get intersecting 3D grid element with specified geometry that is active/occupied with a specified mass type.
The x,y coordinate of the returned 3D points is the terrain index while the z coordinate is a depth index. See the 'TerrainGridControl' class for further explanation.
geometry | - The geometry to test intersection with the terrain grid. |
gridPoints | - Reference to the container where the intersecting terrain grid elements will be put. |
massType | - The specific mass type (SOLID, FLUID or PARTICLE) that is active/occupied in grid points that will be extracted. |
onlyMidpoint | - Should count as intersection only if the voxel midpoint is inside the geometry. |
bool agxTerrain::Terrain::getIntersectingGridElements | ( | agxCollide::Geometry * | geometry, |
agx::Vec3iVector & | gridPoints | ||
) | const |
Get intersecting 3D grid element with specified geometry.
The x,y coordinate of the returned 3D points is the terrain index while the z coordinate is a depth index. See the 'TerrainGridControl' class for further explanation.
geometry | - The geometry to test intersection with the terrain grid. |
gridPoints | - Reference to the container where the intersecting terrain grid elements will be put. |
agx::AffineMatrix4x4 agxTerrain::Terrain::getInverseTransform | ( | ) | const |
shovel | - interacting shovel |
agx::Real agxTerrain::Terrain::getLastExcavatedVolume | ( | ) | const |
|
static |
Loads a TerrainMaterial preset in the TerrainMaterialLibrary that contains calibrated bulk and contact properties for a predefined material archetype.
Note - This method uses the convenience enum MaterialPreset that points to existing preset files.
materialName | - The name of the material preset that should be loaded. |
agx::Material * agxTerrain::Terrain::getMaterial | ( | Terrain::MaterialType | type = Terrain::MaterialType::TERRAIN | ) | const |
Returns one of the internal materials in agxTerrain: MaterialType::TERRAIN - The internal material used on the terrain surface height field structure.
MaterialType::PARTICLE - The internal material used on the terrain particles. MaterialType::AGGREGATE - The internal material used on aggregate used to represent the particle mass.
These materials can be used to configure contact materials for interactions between the terrain and other objects.
|
static |
Load a TerrainMaterial from a specification file in JSON data format.
filename | - the name of the JSON file containing the specified material data. |
agx::RealVector agxTerrain::Terrain::getMaterialWeightsInGridPoints | ( | const agx::Vec3iVector & | gridPoints | ) | const |
Get the material weights in the terrain of the specified grid points.
agx::RealVector agxTerrain::Terrain::getMaterialWeightsInLine | ( | const agx::Line & | line | ) | const |
Get the material weights in the terrain of the voxels that intersect the specified line.
size_t agxTerrain::Terrain::getMemoryUsage | ( | ) |
Returns the memory usage in bytes in agxTerrain.
|
protected |
agx::Real agxTerrain::Terrain::getMinimumAllowedHeight | ( | ) | const |
agx::Real agxTerrain::Terrain::getMinimumHeight | ( | const agx::Vec2i & | terrainIndex | ) | const |
agx::RealVector agxTerrain::Terrain::getMinimumHeights | ( | ) | const |
Return row major array with dimension (resolutionX * resolutionY) with the minimum height allowed in each grid point.
If minimum heights are disabled, this is equivalent to the value of getLowestAllowableHeight in all grid points. If minimum heights are enabled, this can be a varying field.
const ModifiedVerticesVector & agxTerrain::Terrain::getModifiedParticleVertices | ( | ) | const |
Returns the modified terrain height field (including particles) vertices during the last time step.
const ModifiedVerticesVector & agxTerrain::Terrain::getModifiedVertices | ( | ) | const |
Returns the modified terrain height field vertices during the last time step.
bool agxTerrain::Terrain::getNoMerge | ( | ) |
Return whether this terrain is prevented from merging dynamic mass to it.
size_t agxTerrain::Terrain::getNumCreatedParticles | ( | ) | const |
Return the number of soil particles created during excavation this time step.
size_t agxTerrain::Terrain::getNumSoilParticles | ( | ) | const |
Return the number of soil particles active in the simulation.
float agxTerrain::Terrain::getParticleNominalRadius | ( | ) | const |
Get the soil particle nominal radius from the simulation.
The nominal radius is the particle radius that the terrain algorithm will aim for during the dynamic resizing of particles that occur during terrain interaction. This is calculated from the resulting element size upon construction of the terrain object.
const ModifiedVerticesVector & agxTerrain::Terrain::getParticleVertices | ( | ) | const |
Returns the terrain vertices that contains soil particles during the last time step.
bool agxTerrain::Terrain::getPenetrationForce | ( | const Shovel * | shovel, |
agx::Vec3 & | force, | ||
agx::Vec3 & | torque | ||
) | const |
shovel | - interacting shovel |
force | - the penetration force |
torque | - the penetration torque |
force
and torque
- otherwise false agx::Vec3 agxTerrain::Terrain::getPosition | ( | ) | const |
TerrainProperties * agxTerrain::Terrain::getProperties | ( | ) |
TerrainProperties * agxTerrain::Terrain::getProperties | ( | ) | const |
agx::RealVector agxTerrain::Terrain::getResizedHeightField | ( | size_t | factorX, |
size_t | factorY | ||
) | const |
Calculate a reduced version of the height field structure.
Heights in terrain index segments with dimensions [factorX, factorY] are averaged and put into a reduced structure with dimensions [resolutionX/factorX, resolutionY/factorY].
factorX | - The factor to resize the height field in the X dimension. |
factorY | - The factor to resize the height field in the Y dimension. |
|
inline |
|
inline |
agx::Quat agxTerrain::Terrain::getRotation | ( | ) | const |
shovel | - interacting shovel |
shovel | - interacting shovel |
shovel | - interacting shovel |
agx::ContactMaterial * agxTerrain::Terrain::getShovelAggregateContactMaterial | ( | const Shovel * | shovel, |
Shovel::ExcavationMode | mode = Shovel::ExcavationMode::PRIMARY |
||
) | const |
shovel | - The specified shovel. |
mode | - The specified excavation mode that corresponds to the aggregate. |
agxCollide::GeometryContactPtrVector agxTerrain::Terrain::getShovelAggregateContacts | ( | const Shovel * | shovel, |
Shovel::ExcavationMode | excavationMode | ||
) | const |
shovel | - the specified shovel |
excavationMode | - the excavation mode that the soil aggregate belongs too ( PRIMARY, DEFORM_BACK, DEFORM_RIGHT, DEFORM_LEFT ) |
|
protected |
ShovelPtrVector agxTerrain::Terrain::getShovels | ( | ) | const |
Return the shovels currently added in the simulation.
agx::Vec2 agxTerrain::Terrain::getSize | ( | ) | const |
Returns the total surface size of he terrain in X Y coordinate system.
agx::Real agxTerrain::Terrain::getSoilAggregateMass | ( | const Shovel * | shovel, |
Shovel::ExcavationMode | excavationMode | ||
) | const |
shovel | - interacting shovel |
excavationMode | - The excavation mode of the aggregate that will be used to extract the mass. |
const agxCollide::HeightField * agxTerrain::Terrain::getSoilParticleBoundedHeightField | ( | ) | const |
Get the soil particle height field consisting of the highest point of either the terrain surface or the highest particle position in each terrain index.
SoilParticleStatistics agxTerrain::Terrain::getSoilParticleStatistics | ( | ) | const |
Get basic statistics of the soil particles active in the simulation.
SoilSimulationInterface * agxTerrain::Terrain::getSoilSimulationInterface | ( | ) | const |
Get the soil particle system interface used to represent the dynamic mass in the terrain.
This can be used to access and modify soil particle data.
agx::Vec3 agxTerrain::Terrain::getSurfacePosition | ( | const agx::Vec2i & | terrainIndex, |
bool | includeSurfaceParticles = false |
||
) | const |
Finds the terrain surface position, given in local coordinate frame, for a specified terrain index.
- | terrainIndex - the terrain index, going from (0,0) -> (resolutionX-1, resolutionY-1) |
includeSurfaceParticles | - Also consider surface particles when calculating the height, default false. |
agx::Vec3 agxTerrain::Terrain::getSurfacePositionWorld | ( | const agx::Vec2i & | terrainIndex, |
bool | includeSurfaceParticles = false |
||
) | const |
Finds the terrain surface world position for a specified terrain index.
- | terrainIndex - the terrain index, going from (0,0) -> (resolutionX-1, resolutionY-1) |
includeSurfaceParticles | - Also consider surface particles when calculating the height, default false. |
|
protected |
const TerrainContactRefVector & agxTerrain::Terrain::getTerrainContacts | ( | ) | const |
TerrainContactPtrVector agxTerrain::Terrain::getTerrainContactsPtrVector | ( | ) | const |
TerrainContactRefVector * agxTerrain::Terrain::getTerrainContactsVector | ( | ) | const |
TerrainGridControl * agxTerrain::Terrain::getTerrainGridControl | ( | ) | const |
Get control interface of the terrain grid data.
This interface can modify and extract data from the terrain in grid cell level, properties such as mass and compaction.
|
inline |
|
inline |
Returns the terrain material at the specific position which is used to derive material and contact material parameters.
position | - The world position you want to get the terrain material at. |
|
static |
deprecated::TerrainToolCollection * agxTerrain::Terrain::getToolCollection | ( | const Shovel * | shovel | ) | const |
shovel | - shovel instance |
deprecated::TerrainToolCollectionRefVector agxTerrain::Terrain::getToolCollections | ( | ) | const |
agx::Real agxTerrain::Terrain::getTotalSoilParticleMass | ( | ) | const |
Get the total mass (kg) of the active soil particles in the simulation.
agx::AffineMatrix4x4 agxTerrain::Terrain::getTransform | ( | ) | const |
agx::Vec3 agxTerrain::Terrain::getUpDirection | ( | ) | const |
Returns the world up direction of the terrain.
|
protected |
agx::Real agxTerrain::Terrain::getVoxelArea | ( | ) | const |
agx::Real agxTerrain::Terrain::getVoxelVolume | ( | ) | const |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
bool agxTerrain::Terrain::hasOverlap | ( | const agxCollide::Geometry * | geometry | ) | const |
Return true if the specified geometry bounding volume overlaps the terrain geometry bounding volume.
|
protected |
bool agxTerrain::Terrain::indexIsInsideForbiddenBounds | ( | const agx::Vec3i & | terrainIndex, |
bool | onlyUserDefined = false |
||
) |
Check if the specified index is inside the forbidden bounds in the terrain.
terrainIndex | - the 3D terrain index that should be checked against the bounds. |
onlyUserDefined | - true if the check should only include the forbidden bounds added by the user and not the zones created from shovel active zones in the terrain. |
|
protected |
|
protected |
|
protected |
|
protected |
bool agxTerrain::Terrain::isBorderIndex | ( | const agx::Vec2i & | terrainIndex | ) | const |
Checks if the specified index is at the border of the terrain.
terrainIndex | - the terrain index to check |
bool agxTerrain::Terrain::isDigging | ( | const Shovel * | shovel | ) | const |
shovel | - interacting shovel |
|
protected |
|
protected |
bool agxTerrain::Terrain::isGeometryShovel | ( | const agxCollide::Geometry * | geometry | ) | const |
geometry | - the specified geometry for which its body should be checked against the registered shovels. |
bool agxTerrain::Terrain::isIndexWithinBounds | ( | const agx::Vec2i & | terrainIndex | ) | const |
Checks if the specified index is within bound of the terrain [(0,0) -> (resolutionX, resolutionY)].
terrainIndex | - the terrain index to check |
|
protected |
bool agxTerrain::Terrain::isLocalPositionWithinBounds | ( | const agx::Vec3 & | position | ) | const |
Checks whether the position is within terrain (x,y) position bounds in local space.
position | - the position to be checked against the terrain bound. |
bool agxTerrain::Terrain::isOfHomogeneousTerrainMaterial | ( | ) | const |
bool agxTerrain::Terrain::isRigidBodyShovel | ( | const agx::RigidBody * | body | ) | const |
body | - the specified body to check against the registered shovels. |
|
protected |
voxel functions
|
protected |
|
protected |
bool agxTerrain::Terrain::isWorldPositionWithinBounds | ( | const agx::Vec3 & | position | ) | const |
Checks whether the position is within terrain (x,y) position bounds in world space.
position | - the position to be checked against the terrain bound. |
|
overrideprotectedvirtual |
Callback to be executed at the end of the time step.
Reimplemented from agxSDK::TerrainInstance.
bool agxTerrain::Terrain::loadLibraryMaterial | ( | const agx::String & | materialName | ) |
Loads a TerrainMaterial preset in the TerrainMaterialLibrary that contains calibrated bulk and contact properties for a predefined material archetype.
Note - This method uses the convenience enum MaterialPreset that points to existing preset files.
materialName | - The name of the material preset that should be loaded. |
bool agxTerrain::Terrain::loadMaterialFile | ( | const agx::String & | filename | ) |
Load a TerrainMaterial from a specification file in JSON data format.
filename | - the name of the JSON file containing the specified material data. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
bool agxTerrain::Terrain::pointIsInsideForbiddenBounds | ( | const agx::Vec3 & | positionWorld, |
bool | onlyUserDefined = false |
||
) |
Check if the specified points is inside the forbidden bounds in the terrain.
positionWorld | - the point in world coordinates that should be checked against the bounds. |
onlyUserDefined | - true if the check should only include the forbidden bounds added by the user and not the zones created from shovel active zones in the terrain. |
|
overrideprotectedvirtual |
Executes post-step events for agxTerrain in the simulation.
Reimplemented from agxSDK::TerrainInstance.
|
protected |
|
protected |
|
protected |
|
overrideprotectedvirtual |
Executes pre-step events for agxTerrain in the simulation.
Reimplemented from agxSDK::TerrainInstance.
|
overrideprotectedvirtual |
Executes pre-collide events for agxTerrain in the simulation.
Reimplemented from agxSDK::TerrainInstance.
|
overrideprotectedvirtual |
Performs some stuff that is needed before every substep such as preCollide, pre, and post.
Makes license checks.
Reimplemented from agxSDK::TerrainInstance.
|
protected |
|
protected |
agx::Bool agxTerrain::Terrain::projectPointToSurface | ( | const agx::Vec3 & | worldPosition, |
agx::Vec3 & | result | ||
) | const |
Project a world point to the grid surface.
worldPosition | - position in world |
result | - position on this terrain, given in world coordinates |
worldPosition
successfully projected onto this terrain, false if worldPosition
is outside agx::Bool agxTerrain::Terrain::projectPointToSurfaceInDirection | ( | const agx::Vec3 & | worldPosition, |
const agx::Vec3 & | worldDirection, | ||
agx::Vec3 & | result | ||
) | const |
Project a world point to the grid surface in a given direction.
worldPosition | - position in world |
result | - position on this terrain, given in world coordinates |
worldPosition
successfully projected onto this terrain, false if worldPosition
is outside
|
protected |
bool agxTerrain::Terrain::remove | ( | Shovel * | shovel | ) |
shovel | - The specified shovel object. |
|
protected |
Removes terrain material info from the empty voxels that was modified during this pre step.
float agxTerrain::Terrain::removeFluidMassInGeometry | ( | agxCollide::Geometry * | geometry, |
float | fluidMass | ||
) |
Remove fluid mass (in kg, NOT occupancy) in the intersecting 3D grid element with specified geometry.
The x,y coordinate of the returned 3D points is the terrain index while the z coordinate is a depth index. See the 'TerrainGridControl' class for further explanation.
geometry | - The geometry to test intersection with the terrain grid. |
fluidMass | - Amount of mass to be removed |
bool agxTerrain::Terrain::removeForbiddenBound | ( | IForbiddenBound * | bound | ) |
Remove a ForbiddenBound from a terrain that prevents merging and avalanching for the indices and positions inside the bounds.
bound | - The forbidden bound to be removed to the terrain. |
void agxTerrain::Terrain::removeModifiedParticleVertice | ( | agx::Vec2i | terrainIndex | ) |
Removes a vertex from the vector with vertices that were modified during the last time step.
|
overrideprotectedvirtual |
Remove notification executed when terrain is removed to a simulation.
Reimplemented from agxSDK::TerrainInstance.
|
protected |
bool agxTerrain::Terrain::removeTerrainMaterial | ( | TerrainMaterial * | terrainMaterialToRemove | ) |
bool agxTerrain::Terrain::removeVolumeInShape | ( | agxCollide::Shape * | shape | ) |
Instantly removes a terrain volume in the speficied shape.
shape | - The shape within which to remove volume in the terrain |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
bool agxTerrain::Terrain::setAssociatedMaterial | ( | TerrainMaterial * | terrainMaterial, |
agx::Material * | material | ||
) |
Set the associated material with the given TerrainMaterial.
This material is used to configure contact materials between the given terrainMaterial and other materials, for example the shovelMaterial.
terrainMaterial | - the added terrainMaterial with which you want to associate a new material. |
material | - the associated material to the given terrainMaterial. |
void agxTerrain::Terrain::setCompaction | ( | agx::Real | compaction, |
bool | replaceCompactedSoil = true |
||
) | const |
Set a compaction for all current active solid grid elements in the Terrain object.
compaction | - The compaction value to set to every voxel in the terrain (Default: 1.0) |
replaceCompactedSoil | - True if all voxels which already have a compaction value (compaction != 1.0) should get overwritten. |
void agxTerrain::Terrain::setDeformable | ( | bool | deformable | ) |
Sets if deformation should be enabled on this terrain.
If this is set to false no dynamic mass particles or fluid mass is created. Additionally, no avalanching or compaction occurs on the terrain.
deformable | - Whether or not to deformations should occur on this terrain |
void agxTerrain::Terrain::setEnable | ( | bool | enable | ) |
Set if terrain computations should be enabled.
enable | - true if terrain computations should be enabled, false otherwise. |
|
static |
Enable/disable particles to see this rigid body as kinematic regardless of current motion control.
rb | - rigid body |
enable | - true to enable this feature, false to disable |
|
inline |
void agxTerrain::Terrain::setHeight | ( | const agx::Vec2i & | terrainIndex, |
agx::Real | height | ||
) |
Sets Terrain height at a specific terrain grid node.
terrainIndex | An (x,y) index specifying the grid point to set the height to |
height | the new height in the height field. |
bool agxTerrain::Terrain::setHeights | ( | const agx::RealVector & | heights, |
bool | flipY = false , |
||
bool | resetCompaction = true |
||
) |
Set height values of all sampled points.
The height values will be capped by the minimum allowed height for each terrain index. (See getMinimumAllowedHeight, getMinimumHeight).
heights | - must be a row major matrix with dimensions (resolutionX, resolutionY). |
flipY | - set to true if y decreases with increasing indices in heights. ( Default: false ) |
resetCompaction | - Set to true if the compaction data should be erased to default compaction, false if compaction data should be preserved. ( Default: true ) |
void agxTerrain::Terrain::setMaterial | ( | agx::Material * | material, |
Terrain::MaterialType | type = Terrain::MaterialType::TERRAIN |
||
) |
Assign new material to this terrain.
The material instance will be assigned to the specified part of the terrain: MaterialType::Terrain - The geometry holding the height field (getHeightFieldGeometry()) will be assigned the material. MaterialType::Particle - The granular body system simulating dynamic soil particles will be assigned the material. MaterialType::Aggregate - NOT SUPPORTED Internal contact materials terrain <-> particles, terrain <-> soil particle aggregate and particles <-> particles will be updated.
Note that the properties in the material will be overwritten by the terrain based on the assigned TerrainMaterial.
material | - new material for this terrain |
type | - specifies which material to set. |
void agxTerrain::Terrain::setMinimumHeight | ( | const agx::Vec2i & | terrainIndex, |
agx::Real | minimumHeight | ||
) |
bool agxTerrain::Terrain::setMinimumHeights | ( | const agx::RealVector & | minimumHeights | ) |
void agxTerrain::Terrain::setNoMerge | ( | bool | noMerge | ) |
Prevent merge of dynamic mass to this terrain.
void agxTerrain::Terrain::setNoMergeEdgeMargin | ( | size_t | noMergeEdgeMargin | ) |
Add disable merge and avalanche a number of indices from the terrain edge.
void agxTerrain::Terrain::setPosition | ( | const agx::Vec3 & | position | ) |
Set the position of this terrain.
position | - new position of this terrain, given in world coordinate frame |
void agxTerrain::Terrain::setProperties | ( | TerrainProperties * | properties | ) |
Set the TerrainProperties of the Terrian object.
properties | - the properties object to be set on the terrain. |
void agxTerrain::Terrain::setRotation | ( | const agx::Quat & | rotation | ) |
Set the rotation of this terrain.
rotation | - new rotation of this terrain, given in world coordinate frame |
bool agxTerrain::Terrain::setShovelAggregateContactMaterial | ( | Shovel * | shovel, |
agx::ContactMaterial * | contactMaterial, | ||
Shovel::ExcavationMode | mode = Shovel::ExcavationMode::PRIMARY |
||
) |
shovel | - The specified shovel. |
contactMaterial | - The contact material to be set in the aggregate contact. |
mode | - The specified excavation mode that corresponds to the aggregate. |
void agxTerrain::Terrain::setTerrainMaterial | ( | TerrainMaterial * | terrainMaterial, |
agx::Material * | material = nullptr |
||
) |
Set the default terrain material for the bulk of the terrain which is used to derive material and contact material parameters.
terrainMaterial | - The TerrainMaterial to set as default. |
material | - The corresponding agx::Material. Used to setup contact material between this part of the terrain <-> shovel. |
void agxTerrain::Terrain::setTransform | ( | const agx::AffineMatrix4x4 & | transform | ) |
Set the transform of this terrain.
transform | - new transform of this terrain, given in world coordinate frame |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Transform point given in world coordinate frame to local coordinate frame of this terrain.
point | - point in world coordinate frame |
Transform point given in world coordinate frame to local coordinate frame of this terrain.
point | - point in world coordinate frame |
Transform point given in local coordinate frame of this terrain, to world coordinate frame.
point | - point in local coordinate frame of this terrain |
Transform vector given in world coordinate frame to local coordinate frame of this terrain.
vector | - vector in world coordinate frame |
Transform vector given in local coordinate frame of this terrain, to world coordinate frame.
vector | - vector in local coordinate frame of this terrain |
void agxTerrain::Terrain::triggerForceAvalancheAll | ( | ) |
Triggers initial avalanching on all indices in the terrain.
If any height differences in the terrain violates the angle of repose requirement, avalanching will begin on those indices.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |