AGX Dynamics  2.38.0.2
Terrain.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #pragma once
18 
19 #include <agx/config/AGX_USE_AGXTERRAIN.h>
20 #include <agxTerrain/export.h>
24 #include <agxTerrain/Grid.h>
39 
40 #include <agxSDK/TerrainInstance.h>
41 
42 #include <agx/HashSet.h>
43 #include <agx/HighAccuracyTimer.h>
44 #include <agx/BitState.h>
45 #include <agx/IndexLambdaKernel.h>
46 
47 #include <agxCollide/Plane.h>
48 #include <agxCollide/Geometry.h>
49 #include <agxCollide/HeightField.h>
51 
52 namespace agxTerrain
53 {
57  typedef std::pair<SoilParticlePtr, agx::Real> ParticleWeightPair;
64 
67 
86  {
87  public:
88  enum class MaterialType
89  {
90  TERRAIN,
91  PARTICLE,
92  AGGREGATE
93  };
94 
95  enum class MassType
96  {
97  SOLID,
98  PARTICLE,
99  FLUID
100  };
101 
102  public:
106  static agx::Bool getEnableKinematicForParticles( const agx::RigidBody* rb );
107 
113  static void setEnableKinematicForParticles( agx::RigidBody* rb, agx::Bool enable );
114 
121  static Terrain* find( const agxSDK::Simulation* simulation, const agx::Name& name );
122 
129  static Terrain* find( const agxSDK::Simulation* simulation, const agx::Uuid& uuid );
130 
137  static TerrainPtrVector findAll( const agxSDK::Simulation* simulation, const agx::Name& name );
138 
144  static TerrainPtrVector findAll( const agxSDK::Simulation* simulation );
145 
146  public:
158  static Terrain* createFromHeightField(const agxCollide::HeightField* heightField, agx::Real maximumDepth);
159 
170  Terrain(size_t resolutionX, size_t resolutionY, agx::Real elementSize, agx::Real maximumDepth);
171 
184  Terrain(
185  size_t resolutionX, size_t resolutionY, agx::Real elementSize, const agx::RealVector& heights,
186  bool flipY, agx::Real maximumDepth);
187 
196  void setCompaction( agx::Real compaction, bool replaceCompactedSoil=true ) const;
197 
202  void setTransform(const agx::AffineMatrix4x4& transform);
203 
207  agx::AffineMatrix4x4 getTransform() const;
208 
212  agx::AffineMatrix4x4 getInverseTransform() const;
213 
219  void setEnable( bool enable );
220 
225  bool getEnable() const;
226 
231  void setPosition(const agx::Vec3& position);
232 
236  agx::Vec3 getPosition() const;
237 
242  void setRotation(const agx::Quat& rotation);
243 
247  agx::Quat getRotation() const;
248 
255  agx::Vec3 transformPointToTerrain(const agx::Vec3 point) const;
256 
263  agx::Vec3 transformPointToVoxelSpace( const agx::Vec3 point ) const;
264 
271  agx::Vec3 transformPointToWorld(const agx::Vec3 point) const;
272 
279  agx::Vec3 transformVectorToTerrain(const agx::Vec3 vector) const;
280 
287  agx::Vec3 transformVectorToWorld(const agx::Vec3 vector) const;
288 
293  const agxCollide::HeightField* getHeightField() const;
294 
299  virtual agxCollide::Geometry* getGeometry() const override;
300 
307  const agxCollide::HeightField* getSoilParticleBoundedHeightField() const;
308 
314  void setDeformable( bool deformable );
315 
321  inline bool getDeformable() const;
322 
326  void setNoMergeEdgeMargin(size_t noMergeEdgeMargin);
327 
331  void setNoMerge(bool noMerge);
332 
336  bool getNoMerge();
337 
341  bool addNoMergeZoneToGeometry( agxCollide::Geometry* geometry, agx::Real extensionDistance);
342 
346  bool removeNoMergeZoneToGeometry( agxCollide::Geometry* geometry);
347 
352  const ModifiedVerticesVector& getModifiedVertices() const;
353 
358  const ModifiedVerticesVector& getModifiedParticleVertices() const;
359 
363  void removeModifiedParticleVertice(agx::Vec2i terrainIndex);
364 
369  const ModifiedVerticesVector& getParticleVertices() const;
370 
374  agx::Vec2 getSize() const;
375 
380  size_t getResolutionX() const;
381 
386  size_t getResolutionY() const;
387 
393  agx::Real getElementSize() const;
394 
398  size_t getMemoryUsage();
399 
403  agx::Real getMinimumAllowedHeight() const;
404 
411  agx::Vec3 getSurfacePosition(const agx::Vec2i& terrainIndex, bool includeSurfaceParticles = false) const;
412 
419  agx::Vec3 getSurfacePositionWorld(const agx::Vec2i& terrainIndex, bool includeSurfaceParticles = false) const;
420 
427  agx::Vec2i getClosestGridPoint(const agx::Vec3& worldPosition, bool clampToBound=false) const;
428 
436  agx::Bool projectPointToSurface(const agx::Vec3& worldPosition, agx::Vec3& result) const;
437 
443  bool isBorderIndex(const agx::Vec2i& terrainIndex) const;
444 
450  bool isIndexWithinBounds(const agx::Vec2i& terrainIndex) const;
451 
457  bool isWorldPositionWithinBounds(const agx::Vec3& position) const;
458 
464  bool isLocalPositionWithinBounds(const agx::Vec3& position) const;
465 
471  void setHeight(const agx::Vec2i& terrainIndex, agx::Real height);
472 
479  agx::Real getHeight(const agx::Vec2i& terrainIndex, bool includeSurfaceParticles = false) const;
480 
484  agx::Real calculateVolume();
485 
489  agx::Real calculateTotalSolidMass() const;
490 
494  agx::Real calculateTotalFluidMass() const;
495 
499  agx::Real calculateTotalDynamicMass() const;
500 
504  agx::Real calculateTotalMass() const;
505 
512  bool add(Shovel* shovel);
513 
519  bool remove(Shovel* shovel);
520 
524  const TerrainToolCollectionRefVector& getToolCollections() const;
525 
530  TerrainToolCollection* getToolCollection( const Shovel* shovel ) const;
531 
535  ShovelRefVector getShovels() const;
536 
545  bool getPenetrationForce(const Shovel* shovel, agx::Vec3& force, agx::Vec3& torque) const;
546 
554  agx::Vec3 getSeparationContactForce( const Shovel* shovel ) const;
555 
562  agx::Vec3 getSeparationNormalForce( const Shovel* shovel ) const;
563 
570  agx::Vec3 getSeparationFrictionForce( const Shovel* shovel ) const;
571 
580  agx::Vec3 getDeformationContactForce(const Shovel* shovel) const;
581 
590  agx::Vec3 getExcavationModeContactForce(const Shovel* shovel, Shovel::ExcavationMode excavationMode) const;
591 
601  agx::Vec3 getContactForce( const Shovel* shovel ) const;
602 
610 
617  agx::Real getLastDeadLoadFraction(const Shovel* shovel) const;
618 
622  agx::Real getInnerVolume(const Shovel* shovel) const;
623 
627  agx::Real getLastExcavatedVolume() const;
628 
634  bool isDigging(const Shovel* shovel) const;
635 
640  agx::Real getDynamicMass( const Shovel* shovel ) const;
641 
650  agx::Real getSoilAggregateMass(const Shovel* shovel, Shovel::ExcavationMode excavationMode) const;
651 
657  bool contains(const Shovel* shovel) const;
658 
664  bool isRigidBodyShovel(const agx::RigidBody* body) const;
665 
671  bool isGeometryShovel(const agxCollide::Geometry* geometry) const;
672 
676  bool hasOverlap(const agxCollide::Geometry* geometry) const;
677 
689 
690 
704  void setMaterial(agx::Material* material, Terrain::MaterialType type = Terrain::MaterialType::TERRAIN);
705 
706 
707  /*
708  Returns the associated material with the given terrainMaterial. Use this material when configuring contact
709  materials between the given terrainMaterial and other materials, for example the shovelMaterial.
710  \returns the associated material with the given terrainMaterial.
711  */
712  agx::Material* getAssociatedMaterial(TerrainMaterial* terrainMaterial) const;
713 
714 
723  bool setAssociatedMaterial(TerrainMaterial* terrainMaterial, agx::Material* material);
724 
725 
732  bool exchangeTerrainMaterial(TerrainMaterial* oldTerrainMaterial, TerrainMaterial* newTerrainMaterial);
733 
734  /*
735  Remove an added terrain material, its assigned domain will also be removed along with it.
736  \param terrainMaterialToRemove - the terrain material to remove. Note that this can not be the default terrain material, instead try to swithc it with either setTerrainMaterial or exchangeTerrainMaterial!
737  */
738  bool removeTerrainMaterial(TerrainMaterial* terrainMaterialToRemove);
739 
740  /*
741  Remove all traces of added terrain materials. Clears the underlying grid with voxel assignments as well as the list with added terrain materials.
742  \param clearAddedMaterials - true to also clear the list of added materials, false to only clear the assigned domains. Default: true.
743  */
744  void clearTerrainMaterials(bool clearAddedMaterials = true);
745 
746 
757  agx::ContactMaterial* getContactMaterial( Terrain::MaterialType type1, Terrain::MaterialType type2 );
758 
764  TerrainMaterial* getDefaultTerrainMaterial() const;
765 
770  TerrainMaterial* getTerrainMaterial() const;
771 
772 
779  TerrainMaterial* getTerrainMaterial(agx::Vec3 position) const;
780 
787  void setTerrainMaterial( TerrainMaterial* terrainMaterial, agx::Material* material = nullptr);
788 
794  bool addTerrainMaterial(TerrainMaterial* terrainMaterial);
795 
796 
804  int addTerrainMaterial(TerrainMaterial* terrainMaterial, agxCollide::Geometry* geometry);
805 
813  bool loadLibraryMaterial( const agx::String& materialName );
814 
822  static TerrainMaterial* getLibraryMaterial(const agx::String& materialName);
823 
824 
830  static agx::StringVector getAvailableLibraryMaterials();
831 
837  bool loadMaterialFile( const agx::String& filename );
838 
844  static TerrainMaterial* getMaterialFromFile(const agx::String& filename);
845 
856  bool setShovelAggregateContactMaterial( const Shovel* shovel,
857  agx::ContactMaterial* contactMaterial,
859 
869  agx::ContactMaterial* getShovelAggregateContactMaterial( const Shovel* shovel,
871 
880  bool setHeights( const agx::RealVector& heights, bool flipY = false, bool resetCompaction = true );
881 
886  void convertToDynamicMassInShape(agxCollide::Shape* shape);
887 
888 
893  void triggerForceAvalancheAll();
894 
902  agx::RealVector getResizedHeightField(size_t factorX, size_t factorY) const;
903 
910  SoilSimulationInterface* getSoilSimulationInterface() const;
911 
918  TerrainGridControl* getTerrainGridControl() const;
919 
923  agx::Real getTotalSoilParticleMass() const;
924 
928  SoilParticleStatistics getSoilParticleStatistics() const;
929 
933  const TerrainContactRefVector& getTerrainContacts() const;
934 
938  TerrainProperties* getProperties() const;
939 
945  agx::RealVector getMaterialWeightsInLine( const agx::Line& line ) const;
946 
951  agx::RealVector getMaterialWeightsInGridPoints( const agx::Vec3iVector& gridPoints ) const;
952 
962  bool getIntersectingGridElements( agxCollide::Geometry* geometry,
963  agx::Vec3iVector& gridPoints ) const;
964 
976  bool getIntersectingActiveGridElements( agxCollide::Geometry* geometry,
977  agx::Vec3iVector& gridPoints,
978  MassType massType ) const;
979 
989  float removeFluidMassInGeometry(agxCollide::Geometry* geometry, float fluidMass);
990 
997  float getParticleNominalRadius() const;
998 
1002  size_t getNumSoilParticles() const;
1003 
1008  size_t getNumCreatedParticles() const;
1009 
1013  agx::Vec3 getUpDirection() const;
1014 
1018  agx::Real getVoxelArea() const;
1019 
1023  agx::Real getVoxelVolume() const;
1024 
1028  static agx::Real getTerrainParticlePackingRatio();
1029 
1030  /*
1031  \return Whether the terrain consists of one homogeneous terrain material or not.
1032  */
1033  bool isOfHomogeneousTerrainMaterial() const;
1034 
1041  agx::Vec3 getAggregateTerrainContactForce( const Shovel* shovel, Shovel::ExcavationMode excavationMode ) const;
1042 
1049  agx::Vec3 getAggregateTerrainNormalForce( const Shovel* shovel, Shovel::ExcavationMode excavationMode ) const;
1050 
1057  agx::Vec3 getAggregateTerrainTangentialForce( const Shovel* shovel, Shovel::ExcavationMode excavationMode ) const;
1058 
1065  agx::Real getAggregateTerrainContactArea( const Shovel* shovel, Shovel::ExcavationMode excavationMode ) const;
1066 
1074 
1076 
1078 
1080  size_t getNumActiveVoxels() const;
1081 
1083  size_t getNumModifiedVoxels() const;
1084 
1092  bool verifyMassColumnIntegrity(const agx::Vec2i& terrainIndex) const;
1093 
1097  bool isVoxelIndexBelowMaximumDepth(const agx::Vec3i& index) const;
1098 
1105  agx::Line transformLineToTerrain(const agx::Line& line) const;
1106 
1113  agx::Line transformLineToVoxelSpace( const agx::Line& line ) const;
1114 
1121  agx::Line transformLineToWorld(const agx::Line& line) const;
1122 
1126  bool isVoxelIndexInsideGeometryBound(const agx::Vec3i& index) const;
1127 
1131  agx::AffineMatrix4x4 getVoxelSpaceTransform() const;
1132 
1136  bool isBorderIndexAndBordersLocked(const agx::Vec2i& terrainIndex) const;
1137 
1138  CompactionController* getCompactionController() const;
1139 
1140  TerrainDataAtlas* getTerrainDataAtlas() const;
1141 
1142 
1143  virtual void runBuildIslandsTask() override;
1144 
1145  void clearAllSoilParticles();
1146 
1154  float addFluidMassToColumn(const agx::Vec2i& terrainIndex, float fluidMass) const;
1155 
1163  float removeFluidMassFromColumn(const agx::Vec2i& terrainIndex, float fluidMass);
1164 
1172  float addFluidMass(const agx::Vec3i& voxelIndex, float fluidMass) const;
1173 
1181  float removeFluidMass(const agx::Vec3i& voxelIndex, float fluidMass);
1182 
1189  agx::Real calculateFluidOccupancy() const;
1190 
1197  agx::Real getTotalSoilParticleOccupancy() const;
1198 
1204  agx::Vec3 getLocalPositionFromVoxelIndex(const agx::Vec3i& voxelIndex) const;
1205 
1211  agx::Vec3 getWorldPositionFromVoxelIndex(const agx::Vec3i& voxelIndex) const;
1212 
1218  agx::Vec3i getVoxelIndexFromLocalPosition(const agx::Vec3& position) const;
1219 
1225  inline agx::Vec3i getVoxelIndexFromGridPosition(agx::Vec3 position) const
1226  {
1227  return VoxelGridUtils::getVoxelIndexFromGridPosition(position, m_voxelSize);
1228  }
1229 
1235  inline agx::Vec2i getTerrainIndexFromGridPosition(agx::Vec3 position) const
1236  {
1237  agx::Vec3i vi = getVoxelIndexFromGridPosition(position);
1238  return agx::Vec2i(vi.x(), vi.y());
1239  }
1240 
1246  agx::Vec3i getVoxelIndexFromWorldPosition(const agx::Vec3& position) const;
1247 
1253  agx::Vec3i getSurfaceVoxelIndexFromTerrainIndex(const agx::Vec2i& terrainIndex) const;
1254 
1261  void setForbiddenVoxelsForDynamicMass(const agx::Vec3iVector& voxelIndices);
1262 
1268  bool getForbiddenVoxelsForDynamicMass(agx::Vec3iVector& voxelIndices) const;
1269 
1276  bool isForbiddenVoxelsForDynamicMass(const agx::Vec3i& voxelIndex) const;
1277 
1283  bool voxelContainsShovel(const agx::Vec3i& voxelIndex) const;
1284 
1291  bool hasCreatedParticle( agx::Physics::ParticlePtr particle ) const;
1292 
1300  bool hasSameParticleMaterial(agx::Physics::ParticlePtr particle) const;
1301 
1307  TerrainMassOccupancyController* getMassOccupancyController() const;
1308 
1314  TerrainMaterialController* getMaterialController() const;
1315 
1316  void adjustFluidMassInGrid(agx::Vec3i binIndex, int binVoxels, float availableFluidMass, float remainingFluidMass);
1317 
1318  agx::Vec3iVector getVoxelsOccupiedByShovel(TerrainToolCollection *collection) const;
1319 
1320  bool isPointSubmerged( const agx::Vec3& point ) const;
1321 
1322  bool voxelHasParticles(const agx::Vec3i& voxelIndex) const;
1323 
1324  bool isForbiddenIndex(const agx::Vec3i& index);
1325 
1326  void addTerrainIndexToAvalanche(const agx::Vec2i& index);
1327 
1328  int getLowestAllowableVoxelIndexZ() const;
1329 
1330  agx::Vec3 constructVoxelFieldOffset() const;
1331 
1332  void setIsTerrainPagerTile(bool isPagerTile);
1333 
1334  bool getIsTerrainPagerTile() const;
1335 
1336  bool hasEnabledToolCollections() const;
1337 
1338  bool shouldUpdateTerrain() const;
1339 
1340  bool hasParticlesInTerrain() const;
1341 
1342  void debugRenderFluidMass();
1343 
1344  void clampHeights(agx::Real minValue);
1345 
1346  bool isSolidVoxel( const agx::Vec3i& index ) const;
1347 
1348  bool isActiveSolidVoxel( const agx::Vec3i& index ) const;
1349 
1350  void markIndexAsModified( const agx::Vec2i& terrainIndex );
1351 
1353 
1354  protected:
1358  Terrain();
1359 
1363  virtual void addNotification() override;
1364 
1368  virtual void removeNotification() override;
1369 
1373  virtual void preCollide() override;
1374 
1378  virtual void pre() override;
1379 
1383  virtual void post() override;
1384 
1388  virtual void last() override;
1389 
1390  protected:
1391  typedef struct offsetIndexInfo
1392  {
1398  } offsetIndexInfo;
1399 
1400  using GoToStopCondition = std::function<bool(const agx::Vec3i& index)>;
1402 
1404  bool isSurfaceVoxel(const agx::Vec3i& index) const;
1405  bool isSolidBoundaryVoxel(const agx::Vec3i& index) const;
1406  bool isSubmergedVoxel(const agx::Vec3i& index) const;
1407  bool isFilledSolidVoxel(const agx::Vec3i& index) const;
1408  bool hasVoxelCompaction(const agx::Vec3i& index) const;
1409  bool isVoxelWithinTerrainIndexBounds(const agx::Vec3i& index) const;
1410  bool getSurfaceVoxel(const agx::Vec3i& voxelIndex, agx::Vec3i& result) const;
1411  bool findPathToSurfaceVoxel(const agx::Vec3i& startVoxel, std::deque<agx::Vec3i>& result);
1412  bool findSurfaceVoxel(const agx::Vec3i& index, agx::Vec3i& result) const;
1413  agx::Vec3i goToVoxelKernel(const agx::Vec3i& start, const GoToStopCondition& stopCondition) const;
1414  agx::Vec3i goToSurfaceVoxel(const agx::Vec3i& start) const;
1415  agx::Vec3i goToBoundaryVoxel(const agx::Vec3i& start) const;
1416  void updateSurfaceHeightFieldFromDirtyVoxels();
1417  void updateSurfaceHeightFieldFromVoxelIndices(const agx::Vec3iVector& updateIndices);
1418  void updateSurfaceHeightFieldFromVoxelIndices(const agxData::LocalVector<agx::Vec3i>& updateIndices);
1419  void updateSurfaceHeightFieldFromVoxelIndex(const agx::Vec3i& voxelIndex);
1420  void updateSurfaceHeightFieldFromHeightsTable( agx::HashTable<agx::Vec2i, std::pair<agx::Vec3i, agx::Real> >& table );
1421  void traceGridSurfaceVoxel(const agx::Vec2i& terrainIndex, agx::Vec3i& surfaceVoxel) const;
1422  agx::Real traceGridSurfaceHeightFromVoxelIndex(const agx::Vec3i& index);
1423  agx::Real calculateSurfaceHeightFromVoxelIndex(const agx::Vec3i& voxelIndex);
1424  void initializeSurfaceHeightFieldFromVoxelGrid();
1425  void initVoxelStructureFromHeightField( bool adjustForCompaction = false );
1426  void convertVoxelsInActiveZonesToDynamicMass();
1427  bool shouldPrimaryActiveZoneRemoveMass(TerrainToolCollection* toolCollection);
1428  bool shouldDeformerActiveZoneRemoveMass(TerrainToolCollection* toolCollection, DeformerCollection* deformerCollection);
1429  void convertRemovedOccupancyToDynamicMass();
1430  void createSoilParticles();
1431  agx::Vec3 getValidParticlePosition(const agx::Real radius, const agx::Vec3i& index, const agx::Vec3& pos);
1432  void addDirtyVoxelsToAvalanche();
1433  void removeSoilParticlesOutsideTerrainBounds();
1434  void updateTransformationFromParentBody();
1435  void storeModifiedTerrainIndex( const agx::Vec2i& terrainVertex );
1436  void addModifiedParticleTerrainIndex(const agx::Vec2i& terrainIndex);
1437  void updateIndicesForAvalanche(TerrainIndexSet& forbiddenVertices);
1438  agx::Real findNewHeightFromVoxelIndex(const agx::Vec3i& index);
1439 
1440  SoilParticlePtrVector calculateParticlesInContactWithSurfaceGraph(agxCollide::GeometryPtrVector& contactGeometries);
1441 
1442  bool _getIntersectingGridElements(
1443  BasicGrid* grid,
1444  agxCollide::Geometry* geometry,
1445  agx::Vec3iVector& gridPoints,
1446  bool isOccupied = true) const;
1447 
1448  void sortParticlesIntoVoxels();
1449  void sortParticlesIntoColumns();
1450 
1451  TerrainIndexSet findTerrainIndices(agxTerrain::SoilParticlePtrVector& particles);
1452 
1453  /*
1454  For every column we have particles in, shoot a ray into space and find possible collisions with the geometries that are connected in the particle-surface graph.
1455  If there is a collision, save the position for filtering later.
1456  */
1457  void raytraceColumns( agxCollide::GeometryPtrVector geometries,
1458  agx::HashTable <agx::Vec2i, agx::Vec4>& contactPositionTable,
1459  const TerrainIndexSet& columnTerrainIndices,
1460  bool parallelExecute);
1461 
1462  /*
1463  Filter away particles so the remaining particles all are below that columns contact position voxel.
1464  This prevents merging through geometries.
1465  */
1466  void filterParticlesAboveContactGeometryVoxels( agx::HashTable <agx::Vec2i, agx::Vec4>& contactPositionTable,
1468 
1469  void debugRenderContactGeometryVoxels();
1470 
1471  agx::HashTable<agx::Vec3i, agx::UInt64Vector> sortParticlesIntoBins(int binVoxels);
1472 
1473  void preSortSynchronizeParticleHeightField();
1474  void postSortSynchronizeParticleHeightField();
1475 
1476  // Sampling method
1477  void sampleParticleMassVelocity();
1478 
1479  void preUpdateTerrainContacts();
1480  void postUpdateCompaction();
1481  bool isDirty();
1482  void markVoxelToAvalanche(const agx::Vec3i& changedVoxel);
1483  void postSolveShovels();
1484  void updateOccupancyFromHeightChange(const agx::Vec2i& heightFieldIndex);
1485  void avalanche();
1486  void computeForbiddenBounds();
1487  void initializeFromHeightField();
1488  void sanitizeMaxDepthData(agx::Real maximumDepth);
1489 
1490  // Resize soil particles
1491  void resizeSoilParticles();
1492  void computeParticleGrowthTables(const agx::UInt64Vector& particleIndices, ParticleDeltaVector& particles);
1493  void growParticlesFromFluidMass(agx::Vec3i binIndex, int binVoxels, float availableFluidMass, ParticleDeltaVector& particles);
1494  void growSmallParticlesFromParticleMass(ParticleDeltaVector& particles, float particleRadiusUpperLimit);
1495  void growLargeParticlesFromParticleMass(ParticleDeltaVector& particles, float particleRadiusUpperLimit);
1496 
1497  // Merge soil particles functions
1498  void mergeSoilParticlesAndFluidMass();
1499  void addNeighbours(agxData::LocalVector<agx::Vec3i>& indexQueue, agx::Vec3i index);
1500  bool mergeFluidMass();
1501  void createParticleIslands( ParticleIslandVector& particleIslands );
1502  void mergeParticleIslands( const ParticleIslandVector& particleIslands, agxData::LocalVector<agx::Vec3i>& mergedParticleIndices );
1503  void resizeOrRemoveParticles( const agx::HashTable<SoilParticlePtr, std::array<agx::Real, 2>>& particlesToUpdate );
1504  agx::Real getMergeSpeedSquared() const;
1505 
1506  // Merge to cutting edge functions
1507  void mergeSoilToCuttingEdge();
1508  agx::Vec3iVector mergeCuttingEdgeColumn(agx::Vec3i cuttingEdgeVoxel, size_t numVoxelsToSurfaceThreshold, agx::Plane cuttingPlane);
1509  float convertParticlesToSolidMass(agx::Vec3i voxel, ParticleWeightPairVector particles, float occupancyToRemove, agx::Vec3iVector& changedIndices);
1510  void moveParticlesToSurface(agx::Vec3iVector changedVoxelIndices);
1511 
1512  // Step fluid mass
1513  void stepFluidMass();
1514  void calculateFluidMassTransport(agx::HashTable<agx::Vec3i, float>& fluidMassTable);
1515  void applyFluidMassChanges(agx::HashTable<agx::Vec3i, float>& fluidMassTable);
1516  void enforceIncompressibilityColumnwise();
1517  agx::Vec3f getVoxelVelocity(const agx::Vec3i& voxelIndex, agx::HashTable<agx::Vec3i, size_t>& shovelVoxels);
1518  void createFluidMassInVoxel(const agx::Vec3i& voxelIndex, agx::Real32 amount);
1519  void createFluidMassOnTerrainSurface(const agx::Vec2i& terrainIndex, int surfaceVoxelOffset, agx::Real32 amount);
1520 
1521  // Conversion functions for particle radius and general occupancy
1522  float convertParticleRadiusToOccupancy(float radius) const;
1523  float convertOccupancyToParticleRadius(float occupancy) const;
1524  float getDynamicMassCompaction(const agx::Vec3i& voxelIndex) const;
1525  bool particleIslandShouldMerge(const agx::Vector<std::pair<agx::Vec3i, offsetIndexInfo>>& island);
1526  bool voxelColumnHasParticles(const agx::Vec2i& vertex) const;
1527 
1528  // TerrainMaterial bookkeeping functions
1532  void removeEmptyTerrainMaterialVoxels();
1533 
1534 
1535 
1536  void calculateShovelVoxelIntersection();
1537 
1538  agx::HashVector<agx::Vec2i, agx::Int> getShovelHeightPerColumn();
1539 
1540  agx::Real convertFluidOccupancyToMass(agx::Real occupancy) const;
1541  agx::Real convertFluidMassToOccupancy(agx::Real mass) const;
1542 
1543  agx::Real generateRandomNumber();
1544  agx::Vec3 generateRandomSoilParticlePositionPerturbation(agx::Real maxDelta);
1545  agx::Quat generateRandomSoilParticleRotation();
1546 
1547  void debugRenderForbiddenBounds();
1548  void debugRenderShovelForbiddenBounds();
1549 
1550  AvalancheController* getAvalancheController() const;
1551 
1552  agx::Bool isIndexWithinBoundsIssueWarning( const agx::Vec2i& terrainIndex ) const;
1553 
1554  void renderVoxelAABB(agx::Vec3i index, agx::Vec4f color);
1555 
1556  void toolCollectionsPreCollide();
1557  agx::TaskGroupRef createTask_preCollide();
1558  void initBuildIslandTask();
1559  void updateInternalTransforms();
1560 
1561  const agx::AffineMatrix4x4& _getVoxelSpaceTransform() const;
1562  const agx::AffineMatrix4x4& _getInvVoxelSpaceTransform() const;
1563  const agx::AffineMatrix4x4& _getTransform() const;
1564  const agx::AffineMatrix4x4& _getInverseTransform() const;
1565 
1566  void moveEntityDataToCurrentThread();
1567 
1568  void sanityCheckHeightFieldAgainstMaxDepth();
1569 
1570  friend class AvalancheController;
1572  friend class TerrainMaterial;
1574  friend class TerrainGridControl;
1576  friend class TerrainMaterialController;
1577  friend class CompactionController;
1578  friend class TerrainPhysics;
1579  friend class TerrainCache;
1580 
1581  protected:
1582  virtual ~Terrain();
1583 
1584  Terrain(agxCollide::HeightField* heightField, agx::Real maximumDepth);
1585 
1586  private:
1589 
1590  private:
1591  agxCollide::HeightFieldRef m_surfaceHeightField;
1592  agxCollide::HeightFieldRef m_particleHeightField;
1593  agx::Real m_voxelSize;
1594  TerrainPropertiesRef m_properties;
1595  agx::UniformRealGenerator m_generator;
1596  float m_nominalSoilParticleRadius;
1597 
1598  agxCollide::GeometryRef m_surfaceGeometry;
1599  agx::AffineMatrix4x4 m_transform;
1600  agx::AffineMatrix4x4 m_invTransform;
1601  agx::AffineMatrix4x4 m_voxelSpaceTransform;
1602  agx::AffineMatrix4x4 m_invVoxelSpaceTransform;
1603  agx::Vec3 m_voxelFieldOffset;
1604 
1605  TerrainDataAtlasRef m_terrainDataAtlas;
1606  TerrainMassOccupancyControllerRef m_massOccupancyController;
1607  TerrainMaterialControllerRef m_materialController;
1608  CompactionControllerRef m_compactionController;
1609  TerrainContactGeneratorRef m_terrainContactGenerator;
1610  AvalancheControllerRef m_avalancheController;
1611  SoilSimulationInterfaceRef m_soilSimulationInterface;
1612  TerrainGridControlRef m_terrainGridInterface;
1613 
1614  agx::MaterialRef m_particleMaterial;
1615  agx::MaterialRef m_aggregateMaterial;
1616 
1617  agx::ContactMaterialRef m_terrainParticleContactMaterial;
1618  agx::ContactMaterialRef m_terrainAggregateContactMaterial;
1619  agx::ContactMaterialRef m_particleParticleContactMaterial;
1620 
1621  TerrainToolCollectionRefVector m_toolCollections;
1622  AvalancheController::TerrainIndexSet m_terrainIndicesToAvalanche;
1623 
1624  agx::HashTable<agxCollide::Geometry*, agx::Real> m_noMergeGeometryToDistance;
1625  size_t m_noMergeEdgeMargin;
1626  bool m_noMerge;
1627  BoundingAABBVector m_forbiddenBounds;
1628  agx::HashTable<agx::Vec3i, size_t> m_voxelIndexToShovelIndex;
1629  agx::HashTable<TerrainToolCollection*, agx::Vec3iVector> m_voxelsInPrimaryActiveZoneLastTimeStep;
1630  agx::Vec3iVector m_dirtyVoxelIndices;
1631  agx::Real32Vector m_removedOccupancy;
1632  agx::Real m_lastRemovedVolume;
1633  VoxelIndexSet m_voxelHasCreatedParticle;
1634  VoxelIndexSet m_forbiddenVoxelsForDynamicMass;
1635  TerrainIndexSet m_mergedTerrainVertices;
1636  ModifiedVerticesSetVector m_modifiedVoxelColumns;
1637  ModifiedVerticesSetVector m_modifiedTerrainVertices;
1638  ModifiedVerticesSetVector m_modifiedParticleVertices;
1639  ModifiedVerticesSetVector m_particleTerrainVertices;
1640 
1641 
1642  size_t m_numCreatedParticles;
1643  float m_averageSoilParticleRadius;
1644 
1645  // Sort particles into voxels
1646  VoxelIndexOffsetIndexInfoTable m_voxelParticleOffsetTable;
1647  ParticleWeightPairVector m_voxelParticleWeightPairVector;
1648 
1649  // Sort particles into columns
1650  agx::IndexVector m_particlesInContactWithSurface;
1651  agx::HashTable <agx::Vec2i, agx::Vec4> m_contactPositionTable;
1652 
1653  VoxelIndexOffsetIndexInfoTable m_columnParticleOffsetTable;
1654  ParticleWeightPairVector m_columnParticleWeightPairVector;
1655 
1656  agx::HashTable<agx::Vec2i, agx::Real> m_columnParticleHeight;
1657  agx::HighAccuracyTimer m_timer;
1658 
1659  agx::IndexLambdaKernelRef m_indexKernel;
1660 
1661  bool m_isTerrainPagerTile;
1662  bool m_enable;
1663 
1664  // !HACK! !BEWARE! Islands partitioning
1665  // The build islands task is not executed when using PPGS.
1666  // No island partitioning means no parallelization of solving the rigid body system.
1667  // However, we still need islands in Terrain to determine which particles are in contact with the ground.
1668  // Thus, we manually load and execute the task in Terrain.
1669  // The task is loaded and bound for each Terrain that is added but is only executed once by agxSDK::Simulation.
1670  // The task is executed using the runBuildIslandsTask() method.
1671  agx::TaskRef m_buildIslandsTask;
1672  agx::TaskGroupRef m_preCollideUpdateTask;
1673  agx::TaskRef m_sortParticlesToVoxelsTask;
1674  agx::TaskRef m_sortParticlesToColumnsTask;
1675  agx::TaskRef m_calculateShovelVoxelIntersection;
1676  agx::TaskRef m_convertSolidToDynamicMassTask;
1677 
1678  agx::ParallelTaskRef m_updateHeightfieldsTask;
1679  agx::Job m_updateHeightfieldsJobs[2];
1680  agx::ParallelTaskRef m_voxelCollisionTask;
1681  agx::ParallelTaskRef m_geometryFilterTask;
1682 
1683  bool m_enableFluidMerge; // Only used for testing. Should not be serialized.
1684 
1685  agx::Vector<agxCollide::ShapeRef> m_userInputFailureShapes;
1686  };
1687 
1688 
1689  inline TerrainDataAtlas* Terrain::getTerrainDataAtlas() const
1690  {
1691  return m_terrainDataAtlas;
1692  }
1693 
1695  {
1696  return m_materialController->getDefaultTerrainMaterial();
1697  }
1698 
1699 
1701  {
1702  return m_materialController->getDefaultTerrainMaterial();
1703  }
1704 
1705 
1707  {
1708  auto voxelIndex = getVoxelIndexFromWorldPosition(position);
1709  return m_materialController->getTerrainMaterial(voxelIndex);
1710  }
1711 
1712 
1713  inline size_t Terrain::getResolutionX() const
1714  {
1715  return m_surfaceHeightField->getResolutionX();
1716  }
1717 
1718 
1719  inline size_t Terrain::getResolutionY() const
1720  {
1721  return m_surfaceHeightField->getResolutionY();
1722  }
1723 
1724 
1726  {
1727  return m_voxelSize;
1728  }
1729 
1730 
1731 
1733  {
1734  return m_voxelSpaceTransform;
1735  }
1736 
1737 
1738 
1740  {
1741  return m_invVoxelSpaceTransform;
1742  }
1743 
1744 
1745 
1747  {
1748  return m_transform;
1749  }
1750 
1751 
1752 
1754  {
1755  return m_invTransform;
1756  }
1757 
1758 
1759  inline agx::Vec3i Terrain::getSurfaceVoxelIndexFromTerrainIndex(const agx::Vec2i& terrainIndex) const
1760  {
1761  auto solidGrid = static_cast<ColumnHeightGrid*>(m_terrainDataAtlas->getGridMassOccupancyData(TerrainDataAtlas::MassType::SOLID));
1762  int voxelHeight = solidGrid->getSurfaceHeightIndex(terrainIndex);
1763 
1764  return agx::Vec3i( terrainIndex.x(), terrainIndex.y(), voxelHeight);
1765  }
1766 
1767  inline bool Terrain::getIsTerrainPagerTile() const
1768  {
1769  return m_isTerrainPagerTile;
1770  }
1771 
1772  inline bool Terrain::getDeformable() const
1773  {
1774  return m_properties->getEnableDeformation();
1775  }
1776 
1777 }
TerrainInstance.h
agx::Physics::GranularBodyPtr
Pointer to a entity instance of type Physics.GranularBody.
Definition: GranularBodyEntity.h:190
HeightField.h
agxTerrain::TerrainPhysics
Utility class where most of the physics calculation used in agxTerrain is gathered.
Definition: TerrainPhysics.h:26
agxTerrain::Terrain::offsetIndexInfo::stopMergeIndex
agx::UInt stopMergeIndex
Definition: Terrain.h:1395
agx::UInt
uint64_t UInt
Definition: Integer.h:27
agxTerrain::IndexToParticleWeightPairVector
agx::HashTable< agx::Vec3i, ParticleWeightPairVector > IndexToParticleWeightPairVector
Definition: Terrain.h:59
agxWire::transformPointToWorld
static agx::Vec3 transformPointToWorld(const agx::Vec3 &p, const agxCollide::Geometry *g)
Transforms a point given in shape coordinates to world given geometry g.
Definition: WireUtils.h:81
agxTerrain::ParticleWeightPairVector
agx::Vector< ParticleWeightPair > ParticleWeightPairVector
Definition: Terrain.h:58
agx::Vec2T::x
T & x()
Definition: Vec2Template.h:208
agxTerrain::Terrain::getTerrainMaterial
TerrainMaterial * getTerrainMaterial() const
Returns the default terrain material which is used to derive material and contact material parameters...
Definition: Terrain.h:1700
agxTerrain::TerrainContactForceCalculator::getShovelAggregateContacts
agxCollide::GeometryContactPtrVector AGXTERRAIN_EXPORT getShovelAggregateContacts(const Terrain *terrain, const Shovel *shovel, Shovel::ExcavationMode excavationMode)
Internal method Get the shovel <-> aggregate contacts with the terrain given an excavation mode and a...
agxTerrain::Terrain
A terrain model based a 3D grid model with overlapping height field that can be deformed by interacti...
Definition: Terrain.h:85
agx::Real
double Real
Definition: Real.h:42
agxData::transform
void AGXCORE_EXPORT transform(void *target, const Format *targetFormat, const void *source, const Format *sourceFormat, size_t numElements)
Transform data between two buffers.
agxTerrain::TerrainCache
The TerrainCache is used internally by the TerrainPager to provide requested terrain tiles.
Definition: TerrainCache.h:53
agx::Vector< ParticleWeightPair >
TerrainContactGenerator.h
PrimaryActiveZone.h
BitState.h
agxTerrain::TerrainContactForceCalculator::getSeparationNormalForce
agx::Vec3 AGXTERRAIN_EXPORT getSeparationNormalForce(const Terrain *terrain, const Shovel *shovel)
Given geometry contacts exists and the solver has solved them - calculates total contact normal force...
agxTerrain::TerrainIndexSet
agx::HashSet< agx::Vec2i > TerrainIndexSet
Definition: Terrain.h:63
agxTerrain::SoilParticlePtr
agx::Physics::GranularBodyPtr SoilParticlePtr
Definition: SoilParticleAggregate.h:30
agxTerrain
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
Definition: Geometry.h:58
agxTerrain::Terrain::MaterialType
MaterialType
Definition: Terrain.h:88
agx::RigidBody
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:51
agxTerrain::ParticleWeightPair
std::pair< SoilParticlePtr, agx::Real > ParticleWeightPair
Definition: Terrain.h:57
agxTerrain::TerrainContactForceCalculator::getExcavationModeContactForce
agx::Vec3 AGXTERRAIN_EXPORT getExcavationModeContactForce(const Terrain *terrain, const Shovel *shovel, Shovel::ExcavationMode excavationMode)
Calculates total contact force between the soil aggregate and the shovel associated with the specifie...
TerrainPhysics.h
DOXYGEN_END_INTERNAL_BLOCK
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
Plane.h
agx::Vec2T::y
T & y()
Definition: Vec2Template.h:211
Geometry.h
agxTerrain::TerrainContactForceCalculator::getSeparationContactForce
agx::Vec3 AGXTERRAIN_EXPORT getSeparationContactForce(const Terrain *terrain, const Shovel *shovel)
Given geometry contacts exists and the solver has solved them - calculates total contact force betwee...
agx::Vec3i
Vec3T< Int > Vec3i
Definition: Vec3.h:43
agxTerrain::Terrain::getElementSize
agx::Real getElementSize() const
Returns the element size of a cell in agxTerrain, which is incidentally the distance between the cent...
Definition: Terrain.h:1725
agx::AffineMatrix4x4T< Real >
IndexLambdaKernel.h
agxTerrain::Shovel
Definition: Shovel.h:50
agxTerrain::ModifiedVerticesSetVector
agx::SetVector< agx::Vec2i > ModifiedVerticesSetVector
Definition: Terrain.h:60
DOXYGEN_START_INTERNAL_BLOCK
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
agxTerrain::TerrainMaterial
This class is used to describe the general material properties of the Terrain.
Definition: TerrainMaterial.h:53
agxCollide::HeightField
A HeightField is a collision shape that can be created from a grid structure, like an image.
Definition: agxCollide/HeightField.h:51
agxTerrain::ParticleDeltaVector
agx::Vector< std::pair< SoilParticlePtr, float > > ParticleDeltaVector
Definition: Terrain.h:62
agxTerrain::SoilParticlePtrVector
agx::Physics::GranularBodyPtrVector SoilParticlePtrVector
Definition: SoilParticleAggregate.h:33
agxTerrain::TerrainContactForceCalculator::getAggregateTerrainNormalForce
agx::Vec3 AGXTERRAIN_EXPORT getAggregateTerrainNormalForce(const Terrain *terrain, const Shovel *shovel, Shovel::ExcavationMode excavationMode)
Internal method Get the aggregate normal force with the terrain given an excavation mode and a shovel...
agx::Real32
float Real32
Definition: Real.h:44
SoilPenetrationResistance.h
agxTerrain::Shovel::ExcavationMode
ExcavationMode
Enum for describing the different excavation modes of a shovel: PRIMARY - The primary mode of excavat...
Definition: Shovel.h:91
agx::Job
An abstract job/workblock representation, which allows work threads to execute arbitrary tasks.
Definition: Job.h:62
agx::Vec4T
A class holding 4 dimensional vectors and providing basic arithmetic.
Definition: Vec4Template.h:34
VoxelGridUtils.h
AGXSTREAM_DECLARE_SERIALIZABLE
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
agx::VectorPOD
Vector containing 'raw' data.
Definition: Vector.h:245
Grid.h
export.h
TerrainGridControl.h
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition: AddedMassInteraction.h:22
agxTerrain::VoxelGridUtils::getVoxelIndexFromGridPosition
static agx::Vec3i getVoxelIndexFromGridPosition(agx::Vec3 gridPosition, agx::Real voxelSize)
Definition: VoxelGridUtils.h:38
agxTerrain::Terrain::offsetIndexInfo::groundParticleIndex
agx::UInt groundParticleIndex
Definition: Terrain.h:1394
agx::Vec3T::y
T & y()
Definition: Vec3Template.h:499
SoilParticleStatistics.h
TerrainMassOccupancyController.h
agx::PlaneT
Class representing the mathematical concept of a plane, also called a half- space.
Definition: Plane.h:31
TerrainDataAtlas.h
AGX_DECLARE_VECTOR_TYPES
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: Vector.h:34
agxTerrain::DeformerCollection
Definition: DeformerCollection.h:29
agxTerrain::TerrainContactForceCalculator::getAggregateTerrainContactForce
agx::Vec3 AGXTERRAIN_EXPORT getAggregateTerrainContactForce(const Terrain *terrain, const Shovel *shovel, Shovel::ExcavationMode excavationMode)
Internal method Get the aggregate contact force with the terrain given an excavation mode and a shove...
agx::GraphNode::PARTICLE
@ PARTICLE
Definition: GraphNode.h:30
agx::Physics::ParticlePtr
Pointer to a entity instance of type Physics.Particle.
Definition: ParticleEntity.h:292
agx::ref_ptr< TaskGroup >
agxTerrain::Terrain::offsetIndexInfo::offset
agx::UInt offset
Definition: Terrain.h:1396
agxSDK::Simulation
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:125
agxCollide::Shape
Base class for a shape.
Definition: Shape.h:53
agxTerrain::Terrain::getDeformable
bool getDeformable() const
Gets whether or not deformations are enabled for this terrain.
Definition: Terrain.h:1772
agx::HighAccuracyTimer
The HighAccurayTimer class can replace the regular Timer class in high level applications where the n...
Definition: HighAccuracyTimer.h:63
TerrainProperties.h
agx::SetVector< agx::Vec2i >
agxTerrain::Terrain::offsetIndexInfo
Definition: Terrain.h:1391
agx::Vec3
Vec3T< Real > Vec3
The object holding 3 dimensional vectors and providing basic arithmetic.
Definition: Vec3.h:36
agx::Vec3T::x
T & x()
Definition: Vec3Template.h:493
agxTerrain::Terrain::_getInvVoxelSpaceTransform
const agx::AffineMatrix4x4 & _getInvVoxelSpaceTransform() const
Definition: Terrain.h:1739
agx::AffineMatrix4x4
AffineMatrix4x4T< Real > AffineMatrix4x4
Definition: AffineMatrix4x4.h:390
SoilSimulationInterface.h
agxTerrain::TerrainMassOccupancyController
Class that handles and sanity checks the mass logic in the terrain.
Definition: TerrainMassOccupancyController.h:35
agx::RandomGenerator< agx::Real, std::uniform_real_distribution >
agxTerrain::TerrainGridControl
Interface class for accessing and manipulating the underlying 3D grid data in the terrain using terra...
Definition: TerrainGridControl.h:45
agxTerrain::Terrain::_getInverseTransform
const agx::AffineMatrix4x4 & _getInverseTransform() const
Definition: Terrain.h:1753
CompactionController.h
agx::LinearProbingHashTable
Inheritance with partial specialization due to bug with ref_ptr containers.
Definition: LinearProbingHashTable.h:926
agxCollide::Geometry
The geometry representation used by the collision detection engine.
Definition: Geometry.h:91
agxTerrain::Terrain::_getTransform
const agx::AffineMatrix4x4 & _getTransform() const
Definition: Terrain.h:1746
agx::LineT
Definition: Line.h:25
agx::Vec2T
Definition: Vec2Template.h:30
agx::ContactMaterial
This class store the combine material properties between two agx::Material's.
Definition: Material.h:515
agxTerrain::BasicGrid
Pure virtual interface class for the data storage grid classes we have.
Definition: Grid.h:71
agx::Name
Representation of a name string.
Definition: Name.h:32
TerrainMaterial.h
agxTerrain::SoilSimulationInterface
Interface class for accessing data and functions for the internal soil particle simulation used in ag...
Definition: SoilSimulationInterface.h:36
AvalancheController.h
agx::HashSet< agx::Vec3i >
agxTerrain::Terrain::GoToStopCondition
std::function< bool(const agx::Vec3i &index)> GoToStopCondition
Definition: Terrain.h:1400
agxTerrain::TerrainContactForceCalculator::getContactForce
agx::Vec3 AGXTERRAIN_EXPORT getContactForce(const Terrain *terrain, const Shovel *shovel)
Given geometry contacts exists and the solver has solved them - calculates total shovel contact force...
agx::QuatT< Real >
agx::Vec2i
Vec2T< Int > Vec2i
Definition: Vec2.h:40
HashSet.h
agxTerrain::ColumnHeightGrid::getSurfaceHeightIndex
int getSurfaceHeightIndex(const agx::Vec2i terrainIndex)
agx::Line
LineT< Vec3 > Line
Definition: Line.h:39
agxTerrain::Terrain::getDefaultTerrainMaterial
TerrainMaterial * getDefaultTerrainMaterial() const
Returns the default terrain material which is used to derive material and contact material parameters...
Definition: Terrain.h:1694
agxTerrain::Terrain::getResolutionX
size_t getResolutionX() const
Definition: Terrain.h:1713
agxTerrain::Terrain::_getVoxelSpaceTransform
const agx::AffineMatrix4x4 & _getVoxelSpaceTransform() const
Definition: Terrain.h:1732
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
AGXTERRAIN_EXPORT
#define AGXTERRAIN_EXPORT
Definition: agxTerrain/export.h:41
agxSDK::TerrainInstance
agxTerrain::Terrain instance in a simulation, receiving step and contact callbacks in a controllable ...
Definition: TerrainInstance.h:43
agxTerrain::ModifiedVerticesVector
agx::Vector< agx::Vec2i > ModifiedVerticesVector
Definition: Terrain.h:61
agxTerrain::Terrain::getResolutionY
size_t getResolutionY() const
Definition: Terrain.h:1719
agxTerrain::CompactionController
Controller that handles compaction in the terrain from generated terrain contacts in TerrainContactGe...
Definition: CompactionController.h:48
agx::Bool
bool Bool
Definition: Integer.h:40
agxTerrain::ColumnHeightGrid
Class implementing the BasicGrid interface.
Definition: ColumnHeightGrid.h:28
agxTerrain::TerrainToolCollection
Collection of terrain tool (currently Shovel) related objects which are terrain instance specific.
Definition: TerrainToolCollection.h:36
TerrainMaterialController.h
agxTerrain::TerrainContactForceCalculator::getAggregateTerrainTangentialForce
agx::Vec3 AGXTERRAIN_EXPORT getAggregateTerrainTangentialForce(const Terrain *terrain, const Shovel *shovel, Shovel::ExcavationMode excavationMode)
Internal method Get the aggregate <-> terrain tangential force with the terrain given an excavation m...
agx::AgXString< std::string >
agxTerrain::TerrainContactForceCalculator::getDeformationContactForce
agx::Vec3 AGXTERRAIN_EXPORT getDeformationContactForce(const Terrain *terrain, const Shovel *shovel)
Given geometry contacts exists and the solver has solved them - calculates total contact force betwee...
agxTerrain::SoilParticleAggregate
Definition: SoilParticleAggregate.h:39
agxTerrain::SoilParticleStatistics
Definition: SoilParticleStatistics.h:23
agx::Material
Main material class which acts as a holder of a Surface Material and a Bulk material.
Definition: Material.h:375
agx::Vec3T< Real >
ColumnHeightGrid.h
agx::Uuid
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
Definition: Uuid.h:41
agxTerrain::Terrain::offsetIndexInfo::size
agx::UInt size
Definition: Terrain.h:1393
TerrainMaterialLibrary.h
agxTerrain::Terrain::offsetIndexInfo::currentIndex
agx::UInt currentIndex
Definition: Terrain.h:1397
agxTerrain::TerrainProperties
Class for containing and managing the different agxTerrain::Terrain settings.
Definition: TerrainProperties.h:31
TerrainToolCollection.h
agxTerrain::VoxelIndexSet
agx::HashSet< agx::Vec3i > VoxelIndexSet
Definition: Terrain.h:56
agxTerrain::Terrain::MassType
MassType
Definition: Terrain.h:95
HighAccuracyTimer.h
agx::HashVector
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: HashVector.h:40
agxTerrain::TerrainContactForceCalculator::getSeparationFrictionForce
agx::Vec3 AGXTERRAIN_EXPORT getSeparationFrictionForce(const Terrain *terrain, const Shovel *shovel)
Given geometry contacts exists and the solver has solved them - calculates total contact friction for...
agxTerrain::Shovel::ExcavationMode::PRIMARY
@ PRIMARY
agxTerrain::TerrainContactForceCalculator::getAggregateTerrainContacts
agxCollide::GeometryContactPtrVector AGXTERRAIN_EXPORT getAggregateTerrainContacts(const Terrain *terrain, const Shovel *shovel, Shovel::ExcavationMode excavationMode)
Internal method Get the aggregate normal and shear contact force with the terrain given an excavation...
agxWire::transformVectorToWorld
static agx::Vec3 transformVectorToWorld(const agx::Vec3 &v, const agxCollide::Geometry *g)
Transforms a vector given in shape coordinates to world coordinates given geometry g.
Definition: WireUtils.h:57
agxData::LocalVector
Local scope vector.
Definition: LocalVector.h:43
agxTerrain::Terrain::MaterialType::TERRAIN
@ TERRAIN