19 #include <agx/config/AGX_USE_AGXTERRAIN.h>
309 inline bool getDeformable()
const;
377 size_t getResolutionX()
const;
382 size_t getResolutionY()
const;
903 size_t getNumActiveVoxels();
906 size_t getNumModifiedVoxels();
915 bool verifyMassColumnIntegrity(const
agx::
Vec2i& terrainIndex);
920 bool isVoxelIndexBelowMaximumDepth(const
agx::
Vec3i& index) const;
941 bool isVoxelIndexInsideGeometryBound(const
agx::
Vec3i& index) const;
946 bool isBorderIndexAndBordersLocked(const
agx::
Vec2i& terrainIndex) const;
952 virtual
void runBuildIslandsTask() override;
954 void clearAllSoilParticles();
963 float addFluidMassToColumn(const
agx::
Vec2i& terrainIndex,
float fluidMass) const;
972 float removeFluidMassFromColumn(const
agx::
Vec2i& terrainIndex,
float fluidMass);
981 float addFluidMass(const
agx::
Vec3i& voxelIndex,
float fluidMass) const;
990 float removeFluidMass(const
agx::
Vec3i& voxelIndex,
float fluidMass);
998 agx::
Real calculateFluidOccupancy() const;
1006 agx::
Real getTotalSoilParticleOccupancy() const;
1013 agx::
Vec3 getLocalPositionFromVoxelIndex(const
agx::
Vec3i& voxelIndex) const;
1020 agx::
Vec3 getWorldPositionFromVoxelIndex(const
agx::
Vec3i& voxelIndex) const;
1034 agx::
Vec3i getVoxelIndexFromWorldPosition(const
agx::
Vec3& position) const;
1041 agx::
Vec3i getSurfaceVoxelIndexFromTerrainIndex(const
agx::
Vec2i& terrainIndex) const;
1048 agx::
Vec3 getSurfacePositionFromVoxelXY(const
agx::
Vec2i& voxelXY) const;
1055 agx::
Vec3 getSurfacePositionWorldFromVoxelXY(const
agx::
Vec2i& voxelXY) const;
1062 agx::
Vec2i getTerrainIndexFromVoxelIndexXY(const
agx::
Vec2i& voxelXY) const;
1069 agx::
Vec2i getVoxelIndexXYFromTerrainIndex(const
agx::
Vec2i& terrainIndex) const;
1076 agx::
Vec3i getSurfaceVoxelIndexFromVoxelXY(const
agx::
Vec2i& voxelXY) const;
1083 bool voxelContainsShovel(const
agx::
Vec3i& voxelIndex) const;
1091 bool hasCreatedParticle(
agx::Physics::ParticlePtr particle ) const;
1100 bool hasSameParticleMaterial(
agx::Physics::ParticlePtr particle) const;
1136 void adjustFluidMassInGrid(
agx::
Vec3i binIndex,
int binVoxels,
float availableFluidMass,
float remainingFluidMass);
1140 bool voxelHasParticles(const
agx::
Vec3i& voxelIndex) const;
1142 bool isForbiddenIndex(const
agx::
Vec3i& index);
1144 void addTerrainIndexToAvalanche(const
agx::
Vec2i& index);
1146 int getLowestAllowableVoxelIndexZ() const;
1148 agx::
Vec3 constructHeightFieldOffset() const;
1150 void setIsTerrainPagerTile(
bool isPagerTile);
1152 bool getIsTerrainPagerTile() const;
1154 bool hasEnabledToolCollections() const;
1156 bool shouldUpdateTerrain() const;
1158 bool hasParticlesInTerrain() const;
1160 void debugRenderFluidMass();
1162 void clampHeights(
agx::
Real minValue);
1175 virtual
void addNotification() override;
1180 virtual
void removeNotification() override;
1185 virtual
void preCollide() override;
1190 virtual
void pre() override;
1195 virtual
void post() override;
1200 virtual
void last() override;
1262 bool isOccupied =
true)
const;
1381 float m_nominalSoilParticleRadius;
1387 agx::Vec2i m_voxelToHeightFieldIndexSpaceOffset;
1410 size_t m_noMergeEdgeMargin;
1427 size_t m_numCreatedParticles;
1428 float m_averageSoilParticleRadius;
1443 bool m_isTerrainPagerTile;
1461 agx::Job m_updateHeightfieldsJobs[2];
1464 bool m_enableFluidMerge;
1472 position *= (1.0 / m_voxelSize);
1475 (
agx::Int)std::floor(position.
y() + 0.5),
1476 (
agx::Int)std::floor(position.
z() + 0.5));
1480 inline TerrainDataAtlas* Terrain::getTerrainDataAtlas()
const
1482 return m_terrainDataAtlas;
1488 return m_terrainMaterial;
1494 return m_surfaceHeightField->getResolutionX();
1500 return m_surfaceHeightField->getResolutionY();
1512 return voxelXY + m_voxelToHeightFieldIndexSpaceOffset;
1516 inline agx::Vec2i Terrain::getVoxelIndexXYFromTerrainIndex(
const agx::Vec2i& terrainIndex)
const
1518 return terrainIndex - m_voxelToHeightFieldIndexSpaceOffset;
1531 return m_invTransform;
1535 inline agx::Vec3i Terrain::getSurfaceVoxelIndexFromTerrainIndex(
const agx::Vec2i& terrainIndex)
const
1537 agx::Vec2i voxelXY = getVoxelIndexXYFromTerrainIndex(terrainIndex);
1539 auto solidGrid =
static_cast<ColumnHeightGrid*
>(m_terrainDataAtlas->getGridMassData(TerrainDataAtlas::MassType::SOLID));
1542 return agx::Vec3i(voxelXY.
x(), voxelXY.
y(), voxelHeight);
1546 inline agx::Vec3 Terrain::getSurfacePositionFromVoxelXY(
const agx::Vec2i& voxelXY )
const
1552 inline agx::Vec3 Terrain::getSurfacePositionWorldFromVoxelXY(
const agx::Vec2i& voxelXY )
const
1558 inline bool Terrain::getIsTerrainPagerTile()
const
1560 return m_isTerrainPagerTile;
1565 return m_properties->getEnableDeformation();
#define AGX_DECLARE_POINTER_TYPES(type)
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXTERRAIN_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
The geometry representation used by the collision detection engine.
A HeightField is a collision shape that can be created from a grid structure, like an image.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
agxTerrain::Terrain instance in a simulation, receiving step and contact callbacks in a controllable ...
Pure virtual interface class for the data storage grid classes we have.
Class implementing the BasicGrid interface.
int getSurfaceHeightIndex(const agx::Vec2i terrainIndex)
Controller that handles compaction in the terrain from generated terrain contacts in TerrainContactGe...
ExcavationMode
Enum for describing the different excavation modes of a shovel: PRIMARY - The primary mode of excavat...
Interface class for accessing data and functions for the internal soil particle simulation used in ag...
The TerrainCache is used internally by the TerrainPager to provide requested terrain tiles.
Interface class for accessing and manipulating the underlying 3D grid data in the terrain using terra...
Class that handles and sanity checks the mass logic in the terrain.
This class is used to describe the general material properties of the Terrain.
Utility class where most of the physics calculation used in agxTerrain is gathered.
Class for containing and managing the different agxTerrain::Terrain settings.
A terrain model based a 3D grid model with overlapping height field that can be deformed by interacti...
void triggerForceAvalancheAll()
Triggers initial avalanching on all indices in the terrain.
void addModifiedParticleTerrainIndex(const agx::Vec2i &terrainIndex)
bool isSolidVoxel(const agx::Vec3i &index) const
void initializeFromHeightField()
float convertParticleRadiusToOccupancy(float radius) const
static TerrainPtrVector findAll(const agxSDK::Simulation *simulation)
Finds all terrains in the given simulation.
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.
bool getNoMerge()
Return whether this terrain is prevented from merging dynamic mass to it.
void sanitizeMaxDepthData(agx::Real maximumDepth)
const agx::AffineMatrix4x4 & _getTransform() const
void postUpdateCompaction()
void updateSurfaceHeightFieldFromVoxelIndices(const agxData::LocalVector< agx::Vec3i > &updateIndices)
void preSortSynchronizeParticleHeightField()
bool getSurfaceVoxel(const agx::Vec3i &voxelIndex, agx::Vec3i &result) const
bool addNoMergeZoneToGeometry(agxCollide::Geometry *geometry, agx::Real extensionDistance)
Add disable merge and avalanche inside geometry bound with added extension distance.
TerrainGridControl * getTerrainGridControl() const
Get control interface of the terrain grid data.
void convertVoxelsInActiveZonesToDynamicMass()
bool getDeformable() const
Gets whether or not deformations are enabled for this terrain.
agx::Real getInnerVolume(const Shovel *shovel) const
void moveParticlesToSurface(agx::Vec3iVector changedVoxelIndices)
const ModifiedVerticesVector & getModifiedParticleVertices() const
Returns the modified terrain height field (including particles) vertices during the last time step.
agx::Real getLastDeadLoadFraction(const Shovel *shovel) const
Get the last computed dead load fraction of the shovel, i.e how much of it's inner volume that is fil...
bool remove(Shovel *shovel)
Removes a shovel object in the terrain, if it exists.
bool contains(const Shovel *shovel) const
Check is a shovel object is registered in the terrain.
void sortParticlesIntoVoxels()
agx::Real convertOccupancyToMass(agx::Real occupnacy) const
agxCollide::GeometryContactPtrVector getShovelAggregateContacts(const Shovel *shovel, Shovel::ExcavationMode excavationMode) const
Get the shovel <-> aggregate contacts with the terrain given an excavation mode and a shovel.
float convertOccupancyToParticleRadius(float occupancy) const
void initVoxelStructureFromHeightField(bool adjustForCompaction=false)
bool setHeights(const agx::RealVector &heights, bool flipY=false, bool resetCompaction=true)
Set height values of all sampled points.
agx::Real calculateTotalMass() const
agx::Vec3 getDeformationContactForce(const Shovel *shovel) const
Given geometry contacts exists and the solver has solved them - calculates total contact force betwee...
void calculateShovelVoxelIntersection()
const agx::AffineMatrix4x4 & _getInverseTransform() const
agx::Vec3i goToSurfaceVoxel(const agx::Vec3i &start) const
agx::Real getLastExcavatedVolume() const
void setHeight(const agx::Vec2i &terrainIndex, agx::Real height)
Sets Terrain height at a specific terrain grid node.
agx::Vec3 generateRandomSoilParticlePositionPerturbation(agx::Real maxDelta)
agx::Bool projectPointToSurface(const agx::Vec3 &worldPosition, agx::Vec3 &result) const
Project a world point to the grid surface.
static Terrain * find(const agxSDK::Simulation *simulation, const agx::Uuid &uuid)
Find terrain with given UUID.
void setTransform(const agx::AffineMatrix4x4 &transform)
Set the transform of this terrain.
float removeFluidMassInGeometry(agxCollide::Geometry *geometry, float fluidMass)
Remove fluid mass (in kg, NOT occupancy) in the intersecting 3D grid element with specified geometry.
agx::Real traceGridSurfaceHeightFromVoxelIndex(const agx::Vec3i &index)
agx::Vec3 getExcavationModeContactForce(const Shovel *shovel, Shovel::ExcavationMode excavationMode) const
calculates total contact force between the soil aggregate associated with the specified excavation mo...
void mergeSoilToCuttingEdge()
agx::Quat generateRandomSoilParticleRotation()
void toolCollectionsPreCollide()
static TerrainPtrVector findAll(const agxSDK::Simulation *simulation, const agx::Name &name)
Find all terrains with given name.
agx::Real calculateVolume()
agx::Real getVoxelArea() const
void preUpdateTerrainContacts()
agx::Real getDynamicMass(const Shovel *shovel) const
bool isSolidBoundaryVoxel(const agx::Vec3i &index) const
void debugRenderGeometryContactVoxels() const
bool isBorderIndex(const agx::Vec2i &terrainIndex) const
Checks if the specified index is at the border of the terrain.
void setCompaction(agx::Real compaction, bool replaceCompactedSoil=true) const
Set a compaction for all current active solid grid elements in the Terrain object.
agx::Vec3 getPosition() const
bool isSubmergedVoxel(const agx::Vec3i &index) const
const TerrainToolCollectionRefVector & getToolCollections() const
const agxCollide::HeightField * getSoilParticleBoundedHeightField() const
Get the soil particle height field consisting of the highest point of either the terrain surface or t...
bool shouldPrimaryActiveZoneRemoveMass(TerrainToolCollection *toolCollection)
const TerrainContactRefVector & getTerrainContacts() const
const ModifiedVerticesVector & getParticleVertices() const
Returns the terrain vertices that contains soil particles during the last time step.
void debugRenderShovelForbiddenBounds()
bool removeNoMergeZoneToGeometry(agxCollide::Geometry *geometry)
remove disable merge and avalanche inside geometry bound with added extension distance
void moveEntityDataToCurrentThread()
agx::AffineMatrix4x4 getInverseTransform() const
bool soilParticleShouldMerge(SoilParticlePtr &ptr) const
agx::Vec3i goToBoundaryVoxel(const agx::Vec3i &start) const
bool hasOverlap(const agxCollide::Geometry *geometry) const
Return true if the specified geometry bounding volume overlaps the terrain geometry bounding volume.
bool voxelColumnHasParticles(const agx::Vec2i &vertex) const
void sanityCheckHeightFieldAgainstMaxDepth()
void addDirtyVoxelsToAvalanche()
agx::Real getElementSize() const
Returns the element size of a cell in agxTerrain, which is incidentally the distance between the cent...
TerrainMaterial * getTerrainMaterial() const
Returns the terrain material which is used to derive material and contact material parameters.
bool shouldDeformerActiveZoneRemoveMass(TerrainToolCollection *toolCollection, DeformerCollection *deformerCollection)
void updateSurfaceHeightFieldFromVoxelIndices(const agx::Vec3iVector &updateIndices)
agx::Real calculateTotalDynamicMass() const
bool isGeometryShovel(const agxCollide::Geometry *geometry) const
Checks if the specified geometry's rigid body is contained in any of the terrain object's registered ...
const ModifiedVerticesVector & getModifiedVertices() const
Returns the modified terrain height field vertices during the last time step.
void createFluidMassOnTerrainSurface(const agx::Vec2i &terrainIndex, int surfaceVoxelOffset, agx::Real32 amount)
agx::Real getMinimumAllowedHeight() const
agx::Vec3 getValidParticlePosition(const agx::Real radius, const agx::Vec3i &index, const agx::Vec3 &pos)
agx::Vec3 getUpDirection() const
Returns the world up direction of the terrain.
agx::Vec3 transformVectorToTerrain(const agx::Vec3 vector) const
Transform vector given in world coordinate frame to local coordinate frame of this terrain.
TerrainToolCollection * getToolCollection(const Shovel *shovel) const
bool isFilledSolidVoxel(const agx::Vec3i &index) const
bool add(Shovel *shovel)
Adds a shovel object in the terrain.
bool hasVoxelCompaction(const agx::Vec3i &index) const
size_t getMemoryUsage()
Returns the memory usage in bytes in agxTerrain.
agx::Real getVoxelVolume() const
bool getPenetrationForce(const Shovel *shovel, agx::Vec3 &force, agx::Vec3 &torque) const
The result includes the active force and torque from the penetration resistance from the terrain on t...
void storeVoxelContactHeight(const agx::Vec2i &voxelXY, agx::Real currentHeight)
void createParticleIslands(ParticleIslandVector &particleIslands)
void updateIndicesForAvalanche(TerrainIndexSet &forbiddenVertices)
agx::Real getMergeSpeedSquared() const
void updateSurfaceHeightFieldFromDirtyVoxels()
bool isDigging(const Shovel *shovel) const
Check if the specified shovel is currently in digging mode with the terrain, i.e if the cutting edge ...
bool isIndexWithinBounds(const agx::Vec2i &terrainIndex) const
Checks if the specified index is within bound of the terrain [(0,0) -> (resolutionX,...
void storeModifiedTerrainIndex(const agx::Vec2i &terrainVertex)
void updateTransformationFromParentBody()
agx::Real findNewHeightFromVoxelIndex(const agx::Vec3i &index)
void removeModifiedParticleVertice(agx::Vec2i terrainIndex)
Removes a vertex from the vector with vertices that were modified during the last time step.
Terrain(size_t resolutionX, size_t resolutionY, agx::Real elementSize, const agx::RealVector &heights, bool flipY, agx::Real maximumDepth)
Constructor.
bool isActiveSolidVoxel(const agx::Vec3i &index) const
agx::Real getSoilAggregateMass(const Shovel *shovel, Shovel::ExcavationMode excavationMode) const
Returns the total soil aggregate mass in a terrain given a shovel and a specific excavation mode.
float getDynamicMassCompaction() const
bool isWorldPositionWithinBounds(const agx::Vec3 &position) const
Checks whether the position is within terrain (x,y) position bounds in world space.
agx::HashVector< agx::Vec2i, agx::Int > getShovelHeightPerColumn()
bool getIntersectingGridElements(agxCollide::Geometry *geometry, agx::Vec3iVector &gridPoints) const
Get intersecting 3D grid element with specified geometry.
void convertRemovedOccupancyToDynamicMass()
agx::Real calculateSurfaceHeightFromVoxelIndex(const agx::Vec3i &voxelIndex)
void postSortSynchronizeParticleHeightField()
agx::Real calculateTotalSolidMass() const
agx::Vec3 getContactForce(const Shovel *shovel) const
Given geometry contacts exists and the solver has solved them - calculates total shovel contact force...
void applyFluidMassChanges(agx::HashTable< agx::Vec3i, float > &fluidMassTable)
void computeForbiddenBounds()
agx::Vec3f getVoxelVelocity(const agx::Vec3i &voxelIndex, agx::HashTable< agx::Vec3i, size_t > &shovelVoxels)
bool isVoxelWithinTerrainIndexBounds(const agx::Vec3i &index) const
void updateSurfaceHeightFieldFromHeightsTable(agx::HashTable< agx::Vec2i, std::pair< agx::Vec3i, agx::Real > > &table)
agx::Real getTotalSoilParticleMass() const
Get the total mass (kg) of the active soil particles in the simulation.
float convertParticlesToSolidMass(agx::Vec3i voxel, ParticleWeightPairVector particles, float massToRemove, agx::Vec3iVector &changedIndices)
void calculateFluidMassTransport(agx::HashTable< agx::Vec3i, float > &fluidMassTable)
void createFluidMassInVoxel(const agx::Vec3i &voxelIndex, agx::Real32 amount)
agx::Real calculateTotalFluidMass() const
agx::TaskGroupRef createTask_preCollide()
void resizeSoilParticles()
void updateOccupancyFromHeightChange(const agx::Vec2i &heightFieldIndex)
bool loadMaterialFile(const agx::String &filename)
Load a TerrainMaterial from a specification file in JSON data format.
const agxCollide::HeightField * getHeightField() const
ShovelRefVector getShovels() const
Return the shovels currently added in the terrain.
TerrainProperties * getProperties() const
size_t getNumCreatedParticles() const
Return the number of soil particles created during excavation this time step.
void renderVoxelAABB(agx::Vec3i index, agx::Vec4f color)
void setDeformable(bool deformable)
Sets if deformation should be enabled on this terrain.
void computeParticleGrowthTables(const agx::UInt64Vector &particleIndices, ParticleDeltaVector &particles)
agx::ContactMaterial * getContactMaterial(Terrain::MaterialType type1, Terrain::MaterialType type2)
Returns one of the internal contact materials in agxTerrain.
void debugRenderForbiddenBounds()
void traceGridSurfaceVoxel(const agx::Vec2i &voxelIndexXY, agx::Vec3i &surfaceVoxel) const
void createSoilParticles()
agx::Vec3 getSurfacePositionWorld(const agx::Vec2i &terrainIndex, bool includeSurfaceParticles=false) const
Finds the terrain surface world position for a specified terrain index.
agx::Vec3 getSeparationContactForce(const Shovel *shovel) const
Given geometry contacts exists and the solver has solved them - calculates total contact force betwee...
std::function< bool(const agx::Vec3i &index)> GoToStopCondition
SoilParticleStatistics getSoilParticleStatistics() const
Get basic statistics of the soil particles active in the simulation.
static Terrain * createFromHeightField(const agxCollide::HeightField *heightField, agx::Real maximumDepth)
Creates a terrain object by using an existing height field as a basis.
Terrain(size_t resolutionX, size_t resolutionY, agx::Real elementSize, agx::Real maximumDepth)
Constructor.
bool isLocalPositionWithinBounds(const agx::Vec3 &position) const
Checks whether the position is within terrain (x,y) position bounds in local space.
void initializeSurfaceHeightFieldFromVoxelGrid()
void enforceIncompressibilityColumnwise()
void setNoMerge(bool noMerge)
Prevent merge of dynamic mass to this terrain.
bool getIntersectingActiveGridElements(agxCollide::Geometry *geometry, agx::Vec3iVector &gridPoints, MassType massType) const
Get intersecting 3D grid element with specified geometry that is active/occupied with a specified mas...
agx::Vec3 transformVectorToWorld(const agx::Vec3 vector) const
Transform vector given in local coordinate frame of this terrain, to world coordinate frame.
void setTerrainMaterial(TerrainMaterial *terrainMaterial)
Set the material for the bulk of the terrain which is used to derive material and contact material pa...
bool findSurfaceVoxel(const agx::Vec3i &index, agx::Vec3i &result) const
void mergeParticleIslands(const ParticleIslandVector &particleIslands, agxData::LocalVector< agx::Vec3i > &mergedParticleIndices)
void sampleParticleMassVelocity()
SoilSimulationInterface * getSoilSimulationInterface() const
Get the soil particle system interface used to represent the dynamic mass in the terrain.
static agx::Bool getEnableKinematicForParticles(const agx::RigidBody *rb)
void removeSoilParticlesOutsideTerrainBounds()
bool loadLibraryMaterial(const agx::String materialName)
Loads a TerrainMaterial preset in the TerrainMaterialLibrary that contains calibrated bulk and contac...
void sortParticlesIntoColumns()
void convertToDynamicMassInShape(agxCollide::ConvexRef shape)
Converts the terrain occupancy that overlaps the specified convex into dynamic mass.
agx::ContactMaterial * getShovelAggregateContactMaterial(const Shovel *shovel, Shovel::ExcavationMode mode=Shovel::ExcavationMode::PRIMARY) const
Get the explicitly set contact material in a shovel-aggregate contact corresponding to a specified ex...
void markVoxelToAvalanche(const agx::Vec3i &changedVoxel)
agx::Quat getRotation() const
agx::Vec2 getSize() const
Returns the total surface size of he terrain in X Y coordinate system.
size_t getResolutionY() const
Returns the element resolution of the terrain in the local Y-axis.
SoilParticlePtrVector calculateParticlesInContactWithSurfaceGraph()
void mergeSoilParticlesAndFluidMass()
void updateSurfaceHeightFieldFromVoxelIndex(const agx::Vec3i &voxelIndex)
void growSmallParticlesFromParticleMass(ParticleDeltaVector &particles, float particleRadiusUpperLimit)
static void setEnableKinematicForParticles(agx::RigidBody *rb, agx::Bool enable)
Enable/disable particles to see this rigid body as kinematic regardless of current motion control.
agx::Real generateRandomNumber()
agx::Real convertMassToOccupancy(agx::Real mass) const
void setRotation(const agx::Quat &rotation)
Set the rotation of this terrain.
void growParticlesFromFluidMass(agx::Vec3i binIndex, int binVoxels, float availableFluidMass, ParticleDeltaVector &particles)
void storeParticleGeometryContact(agx::Physics::ParticleGeometryContactPtr contact)
const ModifiedVerticesVector & getModifiedVoxelColumns() const
Returns the terrain vertices which voxel columns has modified compaction during the last time step.
bool findPathToSurfaceVoxel(const agx::Vec3i &startVoxel, std::deque< agx::Vec3i > &result)
agx::Vec3i goToVoxelKernel(const agx::Vec3i &start, const GoToStopCondition &stopCondition) const
void setPosition(const agx::Vec3 &position)
Set the position of this terrain.
agx::StringVector getAvailableLibraryMaterials() const
Get the available TerrainMaterial presets from the TerrainMaterialLibrary that contains calibrated bu...
void setEnable(bool enable)
Set if terrain computations should be enabled.
bool isSurfaceVoxel(const agx::Vec3i &index) const
Surface voxel functions.
float getParticleNominalRadius()
Get the soil particle nominal radius from the simulation.
agx::Vec3iVector mergeCuttingEdgeColumn(agx::Vec3i voxel, size_t numVoxelsToSurfaceThreshold, agx::Plane cuttingPlane)
agx::HashTable< agx::Vec3i, agx::UInt64Vector > sortParticlesIntoBins(int binVoxels)
agx::Vec3 transformPointToTerrain(const agx::Vec3 point) const
Transform point given in world coordinate frame to local coordinate frame of this terrain.
bool particleIslandShouldMerge(const agx::Vector< std::pair< agx::Vec3i, offsetIndexInfo >> &island)
agx::Vec3 transformPointToWorld(const agx::Vec3 point) const
Transform point given in local coordinate frame of this terrain, to world coordinate frame.
AvalancheController * getAvalancheController() const
agx::RealVector getResizedHeightField(size_t factorX, size_t factorY) const
Calculate a reduced version of the height field structure.
void initBuildIslandTask()
static Terrain * find(const agxSDK::Simulation *simulation, const agx::Name &name)
Find first terrain with given name.
void resizeOrRemoveParticles(const agx::HashTable< SoilParticlePtr, std::array< agx::Real, 2 >> &particlesToUpdate)
void addNeighbours(agxData::LocalVector< agx::Vec3i > &indexQueue, agx::Vec3i index)
Terrain(agxCollide::HeightField *heightField, agx::Real maximumDepth)
size_t getNumSoilParticles() const
Return the number of soil particles active in the simulation.
bool isRigidBodyShovel(const agx::RigidBody *body) const
Checks if a specified rigid body is contained in any of the terrain object's registered shovels.
void growLargeParticlesFromParticleMass(ParticleDeltaVector &particles, float particleRadiusUpperLimit)
bool _getIntersectingGridElements(BasicGrid *grid, agxCollide::Geometry *geometry, agx::Vec3iVector &gridPoints, bool isOccupied=true) const
void setNoMergeEdgeMargin(size_t noMergeEdgeMargin)
Add disable merge and avalanche a number of indices from the terrain edge.
agx::Real getHeight(const agx::Vec2i &terrainIndex, bool includeSurfaceParticles=false) const
Gets the terrain height at a specific terrain grid node.
agx::Bool isIndexWithinBoundsIssueWarning(const agx::Vec2i &terrainIndex) const
size_t getResolutionX() const
Returns the element resolution of the terrain in the local X-axis.
virtual agxCollide::Geometry * getGeometry() const override
void setMaterial(agx::Material *material, Terrain::MaterialType type=Terrain::MaterialType::TERRAIN)
Assign new material to this terrain.
agx::Material * getMaterial(Terrain::MaterialType type=Terrain::MaterialType::TERRAIN) const
Returns one of the internal materials in agxTerrain.
agx::Vec2i getClosestGridPoint(const agx::Vec3 &worldPosition, bool clampToBound=false) const
Finds the closes terrain grid point given any point in world.
bool setShovelAggregateContactMaterial(const Shovel *shovel, agx::ContactMaterial *contactMaterial, Shovel::ExcavationMode mode=Shovel::ExcavationMode::PRIMARY)
Explicitly set contact material properties in a shovel-aggregate contact for a specific excavation mo...
agx::AffineMatrix4x4 getTransform() const
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
The HighAccurayTimer class can replace the regular Timer class in high level applications where the n...
An abstract job/workblock representation, which allows work threads to execute arbitrary tasks.
Inheritance with partial specialization due to bug with ref_ptr containers.
Main material class which acts as a holder of a Surface Material and a Bulk material.
Representation of a name string.
Pointer to a entity instance of type Physics.GranularBody.
Pointer to a entity instance of type Physics.ParticleGeometryContact.
Class representing the mathematical concept of a plane, also called a half- space.
The rigid body class, combining a geometric model and a frame of reference.
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
A class holding 4 dimensional vectors and providing basic arithmetic.
Vector containing 'raw' data.
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
This namespace consists of a set of classes for handling geometric intersection tests including boole...
agx::VectorPOD< GeometryContact * > GeometryContactPtrVector
void AGXCORE_EXPORT transform(void *target, const Format *targetFormat, const void *source, const Format *sourceFormat, size_t numElements)
Transform data between two buffers.
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
agx::SetVector< agx::Vec2i > ModifiedVerticesSetVector
agx::Physics::GranularBodyPtrVector SoilParticlePtrVector
std::pair< SoilParticlePtr, agx::Real > ParticleWeightPair
agx::Vector< ParticleWeightPair > ParticleWeightPairVector
agx::Vector< std::pair< SoilParticlePtr, float > > ParticleDeltaVector
agx::HashTable< agx::Vec3i, ParticleWeightPairVector > IndexToParticleWeightPairVector
agx::Physics::GranularBodyPtr SoilParticlePtr
agx::Vector< agx::Vec2i > ModifiedVerticesVector
agx::HashSet< agx::Vec3i > VoxelIndexSet
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Vec3T< Real > Vec3
The object holding 3 dimensional vectors and providing basic arithmetic.
VectorPOD< Vec3i > Vec3iVector
agx::UInt groundParticleIndex