AGXDynamics  2.35.0.3
agxTerrain/Terrain.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. 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>
38 
39 #include <agxSDK/TerrainInstance.h>
40 
41 #include <agx/HashSet.h>
42 #include <agx/HighAccuracyTimer.h>
43 #include <agx/BitState.h>
44 #include <agx/IndexLambdaKernel.h>
45 
46 #include <agxCollide/Plane.h>
47 #include <agxCollide/Geometry.h>
48 #include <agxCollide/HeightField.h>
49 
50 namespace agxTerrain
51 {
55  typedef std::pair<SoilParticlePtr, agx::Real> ParticleWeightPair;
62 
65 
78 
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 
168  Terrain(size_t resolutionX, size_t resolutionY, agx::Real elementSize, agx::Real maximumDepth);
169 
180  Terrain(
181  size_t resolutionX, size_t resolutionY, agx::Real elementSize, const agx::RealVector& heights,
182  bool flipY, agx::Real maximumDepth);
183 
192  void setCompaction( agx::Real compaction, bool replaceCompactedSoil=true ) const;
193 
198  void setTransform(const agx::AffineMatrix4x4& transform);
199 
203  agx::AffineMatrix4x4 getTransform() const;
204 
208  agx::AffineMatrix4x4 getInverseTransform() const;
209 
215  void setEnable( bool enable );
216 
221  bool getEnable() const;
222 
227  void setPosition(const agx::Vec3& position);
228 
232  agx::Vec3 getPosition() const;
233 
238  void setRotation(const agx::Quat& rotation);
239 
243  agx::Quat getRotation() const;
244 
251  agx::Vec3 transformPointToTerrain(const agx::Vec3 point) const;
252 
259  agx::Vec3 transformPointToWorld(const agx::Vec3 point) const;
260 
267  agx::Vec3 transformVectorToTerrain(const agx::Vec3 vector) const;
268 
275  agx::Vec3 transformVectorToWorld(const agx::Vec3 vector) const;
276 
281  const agxCollide::HeightField* getHeightField() const;
282 
287  virtual agxCollide::Geometry* getGeometry() const override;
288 
295  const agxCollide::HeightField* getSoilParticleBoundedHeightField() const;
296 
302  void setDeformable( bool deformable );
303 
309  inline bool getDeformable() const;
310 
314  void setNoMergeEdgeMargin(size_t noMergeEdgeMargin);
315 
319  void setNoMerge(bool noMerge);
320 
324  bool getNoMerge();
325 
329  bool addNoMergeZoneToGeometry( agxCollide::Geometry* geometry, agx::Real extensionDistance);
330 
334  bool removeNoMergeZoneToGeometry( agxCollide::Geometry* geometry);
335 
344  const ModifiedVerticesVector& getModifiedVoxelColumns() const;
345 
350  const ModifiedVerticesVector& getModifiedVertices() const;
351 
356  const ModifiedVerticesVector& getModifiedParticleVertices() const;
357 
361  void removeModifiedParticleVertice(agx::Vec2i terrainIndex);
362 
367  const ModifiedVerticesVector& getParticleVertices() const;
368 
372  agx::Vec2 getSize() const;
373 
377  size_t getResolutionX() const;
378 
382  size_t getResolutionY() const;
383 
389  agx::Real getElementSize() const;
390 
394  size_t getMemoryUsage();
395 
399  agx::Real getMinimumAllowedHeight() const;
400 
407  agx::Vec3 getSurfacePosition(const agx::Vec2i& terrainIndex, bool includeSurfaceParticles = false) const;
408 
415  agx::Vec3 getSurfacePositionWorld(const agx::Vec2i& terrainIndex, bool includeSurfaceParticles = false) const;
416 
423  agx::Vec2i getClosestGridPoint(const agx::Vec3& worldPosition, bool clampToBound=false) const;
424 
432  agx::Bool projectPointToSurface(const agx::Vec3& worldPosition, agx::Vec3& result) const;
433 
439  bool isBorderIndex(const agx::Vec2i& terrainIndex) const;
440 
446  bool isIndexWithinBounds(const agx::Vec2i& terrainIndex) const;
447 
453  bool isWorldPositionWithinBounds(const agx::Vec3& position) const;
454 
460  bool isLocalPositionWithinBounds(const agx::Vec3& position) const;
461 
467  void setHeight(const agx::Vec2i& terrainIndex, agx::Real height);
468 
475  agx::Real getHeight(const agx::Vec2i& terrainIndex, bool includeSurfaceParticles = false) const;
476 
480  agx::Real calculateVolume();
481 
485  agx::Real calculateTotalSolidMass() const;
486 
490  agx::Real calculateTotalFluidMass() const;
491 
495  agx::Real calculateTotalDynamicMass() const;
496 
500  agx::Real calculateTotalMass() const;
501 
508  bool add(Shovel* shovel);
509 
515  bool remove(Shovel* shovel);
516 
520  const TerrainToolCollectionRefVector& getToolCollections() const;
521 
526  TerrainToolCollection* getToolCollection( const Shovel* shovel ) const;
527 
531  ShovelRefVector getShovels() const;
532 
541  bool getPenetrationForce(const Shovel* shovel, agx::Vec3& force, agx::Vec3& torque) const;
542 
550  agx::Vec3 getSeparationContactForce( const Shovel* shovel ) const;
551 
560  agx::Vec3 getDeformationContactForce(const Shovel* shovel) const;
561 
570  agx::Vec3 getExcavationModeContactForce(const Shovel* shovel, Shovel::ExcavationMode excavationMode) const;
571 
581  agx::Vec3 getContactForce( const Shovel* shovel ) const;
582 
590 
597  agx::Real getLastDeadLoadFraction(const Shovel* shovel) const;
598 
602  agx::Real getInnerVolume(const Shovel* shovel) const;
603 
607  agx::Real getLastExcavatedVolume() const;
608 
614  bool isDigging(const Shovel* shovel) const;
615 
620  agx::Real getDynamicMass( const Shovel* shovel ) const;
621 
630  agx::Real getSoilAggregateMass(const Shovel* shovel, Shovel::ExcavationMode excavationMode) const;
631 
637  bool contains(const Shovel* shovel) const;
638 
644  bool isRigidBodyShovel(const agx::RigidBody* body) const;
645 
651  bool isGeometryShovel(const agxCollide::Geometry* geometry) const;
652 
656  bool hasOverlap(const agxCollide::Geometry* geometry) const;
657 
669 
683  void setMaterial( agx::Material* material, Terrain::MaterialType type = Terrain::MaterialType::TERRAIN);
684 
695  agx::ContactMaterial* getContactMaterial( Terrain::MaterialType type1, Terrain::MaterialType type2 );
696 
702  TerrainMaterial* getTerrainMaterial() const;
703 
708  void setTerrainMaterial( TerrainMaterial* terrainMaterial );
709 
717  bool loadLibraryMaterial( const agx::String materialName );
718 
724  agx::StringVector getAvailableLibraryMaterials() const;
725 
731  bool loadMaterialFile( const agx::String& filename );
732 
743  bool setShovelAggregateContactMaterial( const Shovel* shovel,
744  agx::ContactMaterial* contactMaterial,
746 
756  agx::ContactMaterial* getShovelAggregateContactMaterial( const Shovel* shovel,
758 
767  bool setHeights( const agx::RealVector& heights, bool flipY = false, bool resetCompaction = true );
768 
773  void convertToDynamicMassInShape(agxCollide::ConvexRef shape);
774 
779  void triggerForceAvalancheAll();
780 
788  agx::RealVector getResizedHeightField(size_t factorX, size_t factorY) const;
789 
796  SoilSimulationInterface* getSoilSimulationInterface() const;
797 
804  TerrainGridControl* getTerrainGridControl() const;
805 
809  agx::Real getTotalSoilParticleMass() const;
810 
814  SoilParticleStatistics getSoilParticleStatistics() const;
815 
819  const TerrainContactRefVector& getTerrainContacts() const;
820 
824  TerrainProperties* getProperties() const;
825 
835  bool getIntersectingGridElements( agxCollide::Geometry* geometry,
836  agx::Vec3iVector& gridPoints ) const;
837 
849  bool getIntersectingActiveGridElements( agxCollide::Geometry* geometry,
850  agx::Vec3iVector& gridPoints,
851  MassType massType ) const;
852 
862  float removeFluidMassInGeometry(agxCollide::Geometry* geometry, float fluidMass);
863 
870  float getParticleNominalRadius();
871 
875  size_t getNumSoilParticles() const;
876 
881  size_t getNumCreatedParticles() const;
882 
886  agx::Vec3 getUpDirection() const;
887 
891  agx::Real getVoxelArea() const;
892 
896  agx::Real getVoxelVolume() const;
897 
899 
901 
903  size_t getNumActiveVoxels();
904 
906  size_t getNumModifiedVoxels();
907 
915  bool verifyMassColumnIntegrity(const agx::Vec2i& terrainIndex);
916 
920  bool isVoxelIndexBelowMaximumDepth(const agx::Vec3i& index) const;
921 
928  agx::Line transformLineToTerrain(const agx::Line& line) const;
929 
936  agx::Line transformLineToWorld(const agx::Line& line) const;
937 
941  bool isVoxelIndexInsideGeometryBound(const agx::Vec3i& index) const;
942 
946  bool isBorderIndexAndBordersLocked(const agx::Vec2i& terrainIndex) const;
947 
948  CompactionController* getCompactionController() const;
949 
950  TerrainDataAtlas* getTerrainDataAtlas() const;
951 
952  virtual void runBuildIslandsTask() override;
953 
954  void clearAllSoilParticles();
955 
963  float addFluidMassToColumn(const agx::Vec2i& terrainIndex, float fluidMass) const;
964 
972  float removeFluidMassFromColumn(const agx::Vec2i& terrainIndex, float fluidMass);
973 
981  float addFluidMass(const agx::Vec3i& voxelIndex, float fluidMass) const;
982 
990  float removeFluidMass(const agx::Vec3i& voxelIndex, float fluidMass);
991 
998  agx::Real calculateFluidOccupancy() const;
999 
1006  agx::Real getTotalSoilParticleOccupancy() const;
1007 
1013  agx::Vec3 getLocalPositionFromVoxelIndex(const agx::Vec3i& voxelIndex) const;
1014 
1020  agx::Vec3 getWorldPositionFromVoxelIndex(const agx::Vec3i& voxelIndex) const;
1021 
1027  agx::Vec3i getVoxelIndexFromLocalPosition(agx::Vec3 position) const;
1028 
1034  agx::Vec3i getVoxelIndexFromWorldPosition(const agx::Vec3& position) const;
1035 
1041  agx::Vec3i getSurfaceVoxelIndexFromTerrainIndex(const agx::Vec2i& terrainIndex) const;
1042 
1048  agx::Vec3 getSurfacePositionFromVoxelXY(const agx::Vec2i& voxelXY) const;
1049 
1055  agx::Vec3 getSurfacePositionWorldFromVoxelXY(const agx::Vec2i& voxelXY) const;
1056 
1062  agx::Vec2i getTerrainIndexFromVoxelIndexXY(const agx::Vec2i& voxelXY) const;
1063 
1069  agx::Vec2i getVoxelIndexXYFromTerrainIndex(const agx::Vec2i& terrainIndex) const;
1070 
1076  agx::Vec3i getSurfaceVoxelIndexFromVoxelXY(const agx::Vec2i& voxelXY) const;
1077 
1083  bool voxelContainsShovel(const agx::Vec3i& voxelIndex) const;
1084 
1091  bool hasCreatedParticle( agx::Physics::ParticlePtr particle ) const;
1092 
1100  bool hasSameParticleMaterial(agx::Physics::ParticlePtr particle) const;
1101 
1107  TerrainMassController* getMassController() const;
1108 
1116  agx::Vec3 getAggregateTerrainContactForce(const Shovel* shovel, Shovel::ExcavationMode excavationMode) const;
1117 
1125  agx::Vec3 getAggregateTerrainNormalForce(const Shovel* shovel, Shovel::ExcavationMode excavationMode) const;
1126 
1134  agxCollide::GeometryContactPtrVector getAggregateTerrainContacts(const Shovel* shovel, Shovel::ExcavationMode excavationMode) const;
1135 
1136  void adjustFluidMassInGrid(agx::Vec3i binIndex, int binVoxels, float availableFluidMass, float remainingFluidMass);
1137 
1138  agx::Vec3iVector getVoxelsOccupiedByShovel(TerrainToolCollection *collection) const;
1139 
1140  bool voxelHasParticles(const agx::Vec3i& voxelIndex) const;
1141 
1142  bool isForbiddenIndex(const agx::Vec3i& index);
1143 
1144  void addTerrainIndexToAvalanche(const agx::Vec2i& index);
1145 
1146  int getLowestAllowableVoxelIndexZ() const;
1147 
1148  agx::Vec3 constructHeightFieldOffset() const;
1149 
1150  void setIsTerrainPagerTile(bool isPagerTile);
1151 
1152  bool getIsTerrainPagerTile() const;
1153 
1154  bool hasEnabledToolCollections() const;
1155 
1156  bool shouldUpdateTerrain() const;
1157 
1158  bool hasParticlesInTerrain() const;
1159 
1160  void debugRenderFluidMass();
1161 
1162  void clampHeights(agx::Real minValue);
1163 
1165 
1166  protected:
1170  Terrain();
1171 
1175  virtual void addNotification() override;
1176 
1180  virtual void removeNotification() override;
1181 
1185  virtual void preCollide() override;
1186 
1190  virtual void pre() override;
1191 
1195  virtual void post() override;
1196 
1200  virtual void last() override;
1201 
1202  protected:
1203  typedef struct offsetIndexInfo
1204  {
1210  } offsetIndexInfo;
1211 
1212  using GoToStopCondition = std::function<bool(const agx::Vec3i& index)>;
1214 
1216  bool isSurfaceVoxel(const agx::Vec3i& index) const;
1217  bool isSolidBoundaryVoxel(const agx::Vec3i& index) const;
1218  bool isSubmergedVoxel(const agx::Vec3i& index) const;
1219  bool isFilledSolidVoxel(const agx::Vec3i& index) const;
1220  bool isSolidVoxel(const agx::Vec3i& index) const;
1221  bool isActiveSolidVoxel(const agx::Vec3i& index) const;
1222  bool hasVoxelCompaction(const agx::Vec3i& index) const;
1223  bool isVoxelWithinTerrainIndexBounds(const agx::Vec3i& index) const;
1224  bool getSurfaceVoxel(const agx::Vec3i& voxelIndex, agx::Vec3i& result) const;
1225  bool findPathToSurfaceVoxel(const agx::Vec3i& startVoxel, std::deque<agx::Vec3i>& result);
1226  bool findSurfaceVoxel(const agx::Vec3i& index, agx::Vec3i& result) const;
1227  agx::Vec3i goToVoxelKernel(const agx::Vec3i& start, const GoToStopCondition& stopCondition) const;
1228  agx::Vec3i goToSurfaceVoxel(const agx::Vec3i& start) const;
1229  agx::Vec3i goToBoundaryVoxel(const agx::Vec3i& start) const;
1230  void updateSurfaceHeightFieldFromDirtyVoxels();
1231  void updateSurfaceHeightFieldFromVoxelIndices(const agx::Vec3iVector& updateIndices);
1232  void updateSurfaceHeightFieldFromVoxelIndices(const agxData::LocalVector<agx::Vec3i>& updateIndices);
1233  void updateSurfaceHeightFieldFromVoxelIndex(const agx::Vec3i& voxelIndex);
1234  void updateSurfaceHeightFieldFromHeightsTable( agx::HashTable<agx::Vec2i, std::pair<agx::Vec3i, agx::Real> >& table );
1235  void traceGridSurfaceVoxel(const agx::Vec2i& voxelIndexXY, agx::Vec3i& surfaceVoxel) const;
1236  agx::Real traceGridSurfaceHeightFromVoxelIndex(const agx::Vec3i& index);
1237  agx::Real calculateSurfaceHeightFromVoxelIndex(const agx::Vec3i& voxelIndex);
1238  void initializeSurfaceHeightFieldFromVoxelGrid();
1239  void initVoxelStructureFromHeightField( bool adjustForCompaction = false );
1240  void convertVoxelsInActiveZonesToDynamicMass();
1241  bool shouldPrimaryActiveZoneRemoveMass(TerrainToolCollection* toolCollection);
1242  bool shouldDeformerActiveZoneRemoveMass(TerrainToolCollection* toolCollection, DeformerCollection* deformerCollection);
1243  void convertRemovedOccupancyToDynamicMass();
1244  void createSoilParticles();
1245  agx::Vec3 getValidParticlePosition(const agx::Real radius, const agx::Vec3i& index, const agx::Vec3& pos);
1246  void addDirtyVoxelsToAvalanche();
1247  void removeSoilParticlesOutsideTerrainBounds();
1248  void updateTransformationFromParentBody();
1249  void storeModifiedTerrainIndex( const agx::Vec2i& terrainVertex );
1250  void addModifiedParticleTerrainIndex(const agx::Vec2i& terrainIndex);
1251  void updateIndicesForAvalanche(TerrainIndexSet& forbiddenVertices);
1252  agx::Real findNewHeightFromVoxelIndex(const agx::Vec3i& index);
1253 
1254  SoilParticlePtrVector calculateParticlesInContactWithSurfaceGraph();
1255  void storeVoxelContactHeight( const agx::Vec2i& voxelXY, agx::Real currentHeight );
1256  void storeParticleGeometryContact( agx::Physics::ParticleGeometryContactPtr contact );
1257 
1258  bool _getIntersectingGridElements(
1259  BasicGrid* grid,
1260  agxCollide::Geometry* geometry,
1261  agx::Vec3iVector& gridPoints,
1262  bool isOccupied = true) const;
1263 
1264  void sortParticlesIntoVoxels();
1265  void sortParticlesIntoColumns();
1266  agx::HashTable<agx::Vec3i, agx::UInt64Vector> sortParticlesIntoBins(int binVoxels);
1267 
1268  void preSortSynchronizeParticleHeightField();
1269  void postSortSynchronizeParticleHeightField();
1270 
1271  // Sampling method
1272  void sampleParticleMassVelocity();
1273 
1274  void preUpdateTerrainContacts();
1275  void postUpdateCompaction();
1276  bool isDirty();
1277  void markVoxelToAvalanche(const agx::Vec3i& changedVoxel);
1278  void postSolveShovels();
1279  void updateOccupancyFromHeightChange(const agx::Vec2i& heightFieldIndex);
1280  void avalanche();
1281  void computeForbiddenBounds();
1282  void initializeFromHeightField();
1283  void sanitizeMaxDepthData(agx::Real maximumDepth);
1284 
1285  // Resize soil particles
1286  void resizeSoilParticles();
1287  void computeParticleGrowthTables(const agx::UInt64Vector& particleIndices, ParticleDeltaVector& particles);
1288  void growParticlesFromFluidMass(agx::Vec3i binIndex, int binVoxels, float availableFluidMass, ParticleDeltaVector& particles);
1289  void growSmallParticlesFromParticleMass(ParticleDeltaVector& particles, float particleRadiusUpperLimit);
1290  void growLargeParticlesFromParticleMass(ParticleDeltaVector& particles, float particleRadiusUpperLimit);
1291 
1292  // Merge soil particles functions
1293  void mergeSoilParticlesAndFluidMass();
1294  void addNeighbours(agxData::LocalVector<agx::Vec3i>& indexQueue, agx::Vec3i index);
1295  bool mergeFluidMass();
1296  void createParticleIslands( ParticleIslandVector& particleIslands );
1297  void mergeParticleIslands( const ParticleIslandVector& particleIslands, agxData::LocalVector<agx::Vec3i>& mergedParticleIndices );
1298  void resizeOrRemoveParticles( const agx::HashTable<SoilParticlePtr, std::array<agx::Real, 2>>& particlesToUpdate );
1299  agx::Real getMergeSpeedSquared() const;
1300 
1301  // Merge to cutting edge functions
1302  void mergeSoilToCuttingEdge();
1303  agx::Vec3iVector mergeCuttingEdgeColumn(agx::Vec3i voxel, size_t numVoxelsToSurfaceThreshold, agx::Plane cuttingPlane);
1304  float convertParticlesToSolidMass(agx::Vec3i voxel, ParticleWeightPairVector particles, float massToRemove, agx::Vec3iVector& changedIndices);
1305  void moveParticlesToSurface(agx::Vec3iVector changedVoxelIndices);
1306 
1307  // Step fluid mass
1308  void stepFluidMass();
1309  void calculateFluidMassTransport(agx::HashTable<agx::Vec3i, float>& fluidMassTable);
1310  void applyFluidMassChanges(agx::HashTable<agx::Vec3i, float>& fluidMassTable);
1311  void enforceIncompressibilityColumnwise();
1312  agx::Vec3f getVoxelVelocity(const agx::Vec3i& voxelIndex, agx::HashTable<agx::Vec3i, size_t>& shovelVoxels);
1313  void createFluidMassInVoxel(const agx::Vec3i& voxelIndex, agx::Real32 amount);
1314  void createFluidMassOnTerrainSurface(const agx::Vec2i& terrainIndex, int surfaceVoxelOffset, agx::Real32 amount);
1315 
1316  // Conversion functions for particle radius and general occupancy
1317  float convertParticleRadiusToOccupancy(float radius) const;
1318  float convertOccupancyToParticleRadius(float occupancy) const;
1319  float getDynamicMassCompaction() const;
1320  bool soilParticleShouldMerge(SoilParticlePtr& ptr) const;
1321  bool particleIslandShouldMerge(const agx::Vector<std::pair<agx::Vec3i, offsetIndexInfo>>& island);
1322  bool voxelColumnHasParticles(const agx::Vec2i& vertex) const;
1323  void debugRenderGeometryContactVoxels() const;
1324 
1325  void calculateShovelVoxelIntersection();
1326 
1327  agx::HashVector<agx::Vec2i, agx::Int> getShovelHeightPerColumn();
1328 
1329  agx::Real convertOccupancyToMass(agx::Real occupnacy) const;
1330  agx::Real convertMassToOccupancy(agx::Real mass) const;
1331 
1332  agx::Real generateRandomNumber();
1333  agx::Vec3 generateRandomSoilParticlePositionPerturbation(agx::Real maxDelta);
1334  agx::Quat generateRandomSoilParticleRotation();
1335 
1336  void debugRenderForbiddenBounds();
1337  void debugRenderShovelForbiddenBounds();
1338 
1339  AvalancheController* getAvalancheController() const;
1340 
1341  agx::Bool isIndexWithinBoundsIssueWarning( const agx::Vec2i& terrainIndex ) const;
1342 
1343  void renderVoxelAABB(agx::Vec3i index, agx::Vec4f color);
1344 
1345  void toolCollectionsPreCollide();
1346  agx::TaskGroupRef createTask_preCollide();
1347  void initBuildIslandTask();
1348 
1349  const agx::AffineMatrix4x4& _getTransform() const;
1350  const agx::AffineMatrix4x4& _getInverseTransform() const;
1351 
1352  void moveEntityDataToCurrentThread();
1353 
1354  void sanityCheckHeightFieldAgainstMaxDepth();
1355 
1356  friend class AvalancheController;
1358  friend class TerrainMaterial;
1360  friend class TerrainGridControl;
1362  friend class CompactionController;
1363  friend class TerrainPhysics;
1364  friend class TerrainCache;
1365 
1366  protected:
1367  virtual ~Terrain();
1368 
1369  Terrain(agxCollide::HeightField* heightField, agx::Real maximumDepth);
1370 
1371  private:
1374 
1375  private:
1376  agxCollide::HeightFieldRef m_surfaceHeightField;
1377  agxCollide::HeightFieldRef m_particleHeightField;
1378  agx::Real m_voxelSize;
1379  TerrainPropertiesRef m_properties;
1380  agx::UniformRealGenerator m_generator;
1381  float m_nominalSoilParticleRadius;
1382 
1383  agxCollide::GeometryRef m_surfaceGeometry;
1384  agx::AffineMatrix4x4 m_transform;
1385  agx::AffineMatrix4x4 m_invTransform;
1386  agx::Vec3 m_heightFieldOffset;
1387  agx::Vec2i m_voxelToHeightFieldIndexSpaceOffset;
1388 
1389  TerrainDataAtlasRef m_terrainDataAtlas;
1390  TerrainMassControllerRef m_massController;
1391  CompactionControllerRef m_compactionController;
1392  TerrainContactGeneratorRef m_terrainContactGenerator;
1393  AvalancheControllerRef m_avalancheController;
1394  SoilSimulationInterfaceRef m_soilSimulationInterface;
1395  TerrainGridControlRef m_terrainGridInterface;
1396 
1397  TerrainMaterialRef m_terrainMaterial;
1398  agx::MaterialRef m_material;
1399  agx::MaterialRef m_particleMaterial;
1400  agx::MaterialRef m_aggregateMaterial;
1401 
1402  agx::ContactMaterialRef m_terrainParticleContactMaterial;
1403  agx::ContactMaterialRef m_terrainAggregateContactMaterial;
1404  agx::ContactMaterialRef m_particleParticleContactMaterial;
1405 
1406  TerrainToolCollectionRefVector m_toolCollections;
1407  AvalancheController::TerrainIndexSet m_terrainIndicesToAvalanche;
1408 
1409  agx::HashTable<agxCollide::Geometry*, agx::Real> m_noMergeGeometryToDistance;
1410  size_t m_noMergeEdgeMargin;
1411  bool m_noMerge;
1412  BoundingAABBVector m_forbiddenBounds;
1413  agx::HashTable<agx::Vec3i, size_t> m_voxelIndexToShovelIndex;
1414  agx::HashTable<TerrainToolCollection*, agx::Vec3iVector> m_voxelsInPrimaryActiveZoneLastTimeStep;
1415  agx::Vec3iVector m_dirtyVoxelIndices;
1416  agx::Real32Vector m_removedOccupancy;
1417  agx::Real m_lastRemovedVolume;
1418  VoxelIndexSet m_voxelHasCreatedParticle;
1419  TerrainIndexSet m_mergedVoxelXYVertices;
1420  ModifiedVerticesSetVector m_modifiedVoxelColumns;
1421  ModifiedVerticesSetVector m_modifiedTerrainVertices;
1422  ModifiedVerticesSetVector m_modifiedParticleVertices;
1423  ModifiedVerticesSetVector m_particleTerrainVertices;
1424  agx::HashTable<agx::Index, agx::Real> m_particleToContactHeights;
1425  agx::HashTable<agx::Vec2i, agx::Real> m_geometryContactHeights;
1426 
1427  size_t m_numCreatedParticles;
1428  float m_averageSoilParticleRadius;
1429 
1430  // Sort particles into voxels
1431  VoxelIndexOffsetIndexInfoTable m_voxelParticleOffsetTable;
1432  ParticleWeightPairVector m_voxelParticleWeightPairVector;
1433 
1434  // Sort particles into columns
1435  VoxelIndexOffsetIndexInfoTable m_columnParticleOffsetTable;
1436  ParticleWeightPairVector m_columnParticleWeightPairVector;
1437 
1438  agx::HashTable<agx::Vec2i, agx::Real> m_columnParticleHeight;
1439  agx::HighAccuracyTimer m_timer;
1440 
1441  agx::IndexLambdaKernelRef m_indexKernel;
1442 
1443  bool m_isTerrainPagerTile;
1444  bool m_enable;
1445 
1446  // !HACK! !BEWARE! Islands partitioning
1447  // The build islands task is not executed when using PPGS.
1448  // No island partitioning means no parallelization of solving the rigid body system.
1449  // However, we still need islands in Terrain to determine which particles are in contact with the ground.
1450  // Thus, we manually load and execute the task in Terrain.
1451  // The task is loaded and bound for each Terrain that is added but is only executed once by agxSDK::Simulation.
1452  // The task is executed using the runBuildIslandsTask() method.
1453  agx::TaskRef m_buildIslandsTask;
1454  agx::TaskGroupRef m_preCollideUpdateTask;
1455  agx::TaskRef m_sortParticlesToVoxelsTask;
1456  agx::TaskRef m_sortParticlesToColumnsTask;
1457  agx::TaskRef m_calculateShovelVoxelIntersection;
1458  agx::TaskRef m_convertSolidToDynamicMassTask;
1459 
1460  agx::ParallelTaskRef m_updateHeightfieldsTask;
1461  agx::Job m_updateHeightfieldsJobs[2];
1462  agx::ParallelTaskRef m_voxelCollisionTask;
1463 
1464  bool m_enableFluidMerge; // Only used for testing. Should not be serialized.
1465 
1466  agx::Vector<agxCollide::ConvexRef> m_userInputFailureShapes;
1467  };
1468 
1469 
1470  AGX_FORCE_INLINE agx::Vec3i Terrain::getVoxelIndexFromLocalPosition(agx::Vec3 position) const
1471  {
1472  position *= (1.0 / m_voxelSize);
1473  // Note: ( position + 0.5 * m_voxelSize ) / m_voxelSize
1474  return agx::Vec3i((agx::Int)std::floor(position.x() + 0.5),
1475  (agx::Int)std::floor(position.y() + 0.5),
1476  (agx::Int)std::floor(position.z() + 0.5));
1477  }
1478 
1479 
1480  inline TerrainDataAtlas* Terrain::getTerrainDataAtlas() const
1481  {
1482  return m_terrainDataAtlas;
1483  }
1484 
1485 
1487  {
1488  return m_terrainMaterial;
1489  }
1490 
1491 
1492  inline size_t Terrain::getResolutionX() const
1493  {
1494  return m_surfaceHeightField->getResolutionX();
1495  }
1496 
1497 
1498  inline size_t Terrain::getResolutionY() const
1499  {
1500  return m_surfaceHeightField->getResolutionY();
1501  }
1502 
1503 
1505  {
1506  return m_voxelSize;
1507  }
1508 
1509 
1510  inline agx::Vec2i Terrain::getTerrainIndexFromVoxelIndexXY(const agx::Vec2i& voxelXY) const
1511  {
1512  return voxelXY + m_voxelToHeightFieldIndexSpaceOffset;
1513  }
1514 
1515 
1516  inline agx::Vec2i Terrain::getVoxelIndexXYFromTerrainIndex(const agx::Vec2i& terrainIndex) const
1517  {
1518  return terrainIndex - m_voxelToHeightFieldIndexSpaceOffset;
1519  }
1520 
1521 
1523  {
1524  return m_transform;
1525  }
1526 
1527 
1528 
1530  {
1531  return m_invTransform;
1532  }
1533 
1534 
1535  inline agx::Vec3i Terrain::getSurfaceVoxelIndexFromTerrainIndex(const agx::Vec2i& terrainIndex) const
1536  {
1537  agx::Vec2i voxelXY = getVoxelIndexXYFromTerrainIndex(terrainIndex);
1538 
1539  auto solidGrid = static_cast<ColumnHeightGrid*>(m_terrainDataAtlas->getGridMassData(TerrainDataAtlas::MassType::SOLID));
1540  int voxelHeight = solidGrid->getSurfaceHeightIndex(terrainIndex);
1541 
1542  return agx::Vec3i(voxelXY.x(), voxelXY.y(), voxelHeight);
1543  }
1544 
1545 
1546  inline agx::Vec3 Terrain::getSurfacePositionFromVoxelXY( const agx::Vec2i& voxelXY ) const
1547  {
1548  return getSurfacePosition( getTerrainIndexFromVoxelIndexXY( voxelXY ) );
1549  }
1550 
1551 
1552  inline agx::Vec3 Terrain::getSurfacePositionWorldFromVoxelXY( const agx::Vec2i& voxelXY ) const
1553  {
1554  return getSurfacePositionWorld( getTerrainIndexFromVoxelIndexXY( voxelXY ) );
1555  }
1556 
1557 
1558  inline bool Terrain::getIsTerrainPagerTile() const
1559  {
1560  return m_isTerrainPagerTile;
1561  }
1562 
1563  inline bool Terrain::getDeformable() const
1564  {
1565  return m_properties->getEnableDeformation();
1566  }
1567 
1568 }
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: agxTerrain/Terrain.h:1207
agxTerrain::IndexToParticleWeightPairVector
agx::HashTable< agx::Vec3i, ParticleWeightPairVector > IndexToParticleWeightPairVector
Definition: agxTerrain/Terrain.h:57
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: agxTerrain/Terrain.h:56
agx::Vec2T::x
T & x()
Definition: Vec2Template.h:208
agxTerrain::Terrain::getTerrainMaterial
TerrainMaterial * getTerrainMaterial() const
Returns the terrain material which is used to derive material and contact material parameters.
Definition: agxTerrain/Terrain.h:1486
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: agxTerrain/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
agxTerrain::Terrain::getSurfacePosition
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.
BitState.h
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:59
agxTerrain::Terrain::MaterialType
MaterialType
Definition: agxTerrain/Terrain.h:88
agx::RigidBody
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
agxTerrain::ParticleWeightPair
std::pair< SoilParticlePtr, agx::Real > ParticleWeightPair
Definition: agxTerrain/Terrain.h:55
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: agxTerrain/Terrain.h:1504
agx::AffineMatrix4x4T< Real >
IndexLambdaKernel.h
agxTerrain::Shovel
Definition: Shovel.h:50
agxTerrain::ModifiedVerticesSetVector
agx::SetVector< agx::Vec2i > ModifiedVerticesSetVector
Definition: agxTerrain/Terrain.h:58
DOXYGEN_START_INTERNAL_BLOCK
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
agx::Int
int32_t Int
Definition: Integer.h:35
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: agxTerrain/Terrain.h:60
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:86
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
agxTerrain::AvalancheController
Definition: AvalancheController.h:33
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::Terrain::offsetIndexInfo::groundParticleIndex
agx::UInt groundParticleIndex
Definition: agxTerrain/Terrain.h:1206
agx::Vec3T::y
T & y()
Definition: Vec3Template.h:505
SoilParticleStatistics.h
agx::Vec3iVector
VectorPOD< Vec3i > Vec3iVector
Definition: agx_vector_types.h:61
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
TerrainMassController.h
agxTerrain::Terrain::getSurfacePositionWorld
agx::Vec3 getSurfacePositionWorld(const agx::Vec2i &terrainIndex, bool includeSurfaceParticles=false) const
Finds the terrain surface world position for a specified terrain index.
agx::ref_ptr< Convex >
agxTerrain::Terrain::offsetIndexInfo::offset
agx::UInt offset
Definition: agxTerrain/Terrain.h:1208
agxSDK::Simulation
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:126
agxTerrain::Terrain::getDeformable
bool getDeformable() const
Gets whether or not deformations are enabled for this terrain.
Definition: agxTerrain/Terrain.h:1563
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: agxTerrain/Terrain.h:1203
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:499
agx::Physics::ParticleGeometryContactPtr
Pointer to a entity instance of type Physics.ParticleGeometryContact.
Definition: ParticleGeometryContactEntity.h:267
SoilSimulationInterface.h
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:44
agxTerrain::Terrain::_getInverseTransform
const agx::AffineMatrix4x4 & _getInverseTransform() const
Definition: agxTerrain/Terrain.h:1529
CompactionController.h
agx::LinearProbingHashTable
Inheritance with partial specialization due to bug with ref_ptr containers.
Definition: LinearProbingHashTable.h:871
agxCollide::Geometry
The geometry representation used by the collision detection engine.
Definition: Geometry.h:92
agxTerrain::Terrain::_getTransform
const agx::AffineMatrix4x4 & _getTransform() const
Definition: agxTerrain/Terrain.h:1522
agx::Vec2T
Definition: Vec2Template.h:30
agx::ContactMaterial
This class store the combine material properties between two agx::Material's.
Definition: Material.h:527
agxTerrain::BasicGrid
Pure virtual interface class for the data storage grid classes we have.
Definition: Grid.h:70
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: agxTerrain/Terrain.h:1212
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::getResolutionX
size_t getResolutionX() const
Returns the element resolution of the terrain in the local X-axis.
Definition: agxTerrain/Terrain.h:1492
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
AGXTERRAIN_EXPORT
#define AGXTERRAIN_EXPORT
Definition: agxTerrain/export.h:41
agx::UInt
uint32_t UInt
Definition: Integer.h:34
agxSDK::TerrainInstance
agxTerrain::Terrain instance in a simulation, receiving step and contact callbacks in a controllable ...
Definition: TerrainInstance.h:37
agxCollide
This namespace consists of a set of classes for handling geometric intersection tests including boole...
Definition: ContactForceFilterParticipant.h:22
agxTerrain::ModifiedVerticesVector
agx::Vector< agx::Vec2i > ModifiedVerticesVector
Definition: agxTerrain/Terrain.h:59
agxTerrain::Terrain::getResolutionY
size_t getResolutionY() const
Returns the element resolution of the terrain in the local Y-axis.
Definition: agxTerrain/Terrain.h:1498
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:48
agxTerrain::ColumnHeightGrid
Class implementing the BasicGrid interface.
Definition: ColumnHeightGrid.h:27
agxTerrain::TerrainToolCollection
Collection of terrain tool (currently Shovel) related objects which are terrain instance specific.
Definition: TerrainToolCollection.h:35
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:38
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:387
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
agxCollide::GeometryContactPtrVector
agx::VectorPOD< GeometryContact * > GeometryContactPtrVector
Definition: agxcollide_vector_types.h:40
agxTerrain::Terrain::offsetIndexInfo::size
agx::UInt size
Definition: agxTerrain/Terrain.h:1205
TerrainMaterialLibrary.h
agxTerrain::Terrain::offsetIndexInfo::currentIndex
agx::UInt currentIndex
Definition: agxTerrain/Terrain.h:1209
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: agxTerrain/Terrain.h:54
agxTerrain::Terrain::MassType
MassType
Definition: agxTerrain/Terrain.h:95
HighAccuracyTimer.h
agx::Vec3T::z
T & z()
Definition: Vec3Template.h:511
agxTerrain::TerrainMassController
Class that handles and sanity checks the mass logic in the terrain.
Definition: TerrainMassController.h:35
agx::HashVector
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: HashVector.h:40
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
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition: macros.h:58
agxData::LocalVector
Local scope vector.
Definition: LocalVector.h:43
agxTerrain::TerrainDataAtlas
Definition: TerrainDataAtlas.h:33
agxTerrain::Terrain::MaterialType::TERRAIN
@ TERRAIN