AGX Dynamics  2.35.0.1
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:
107 
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 
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 
199 
204 
209 
215  void setEnable( bool enable );
216 
221  bool getEnable() const;
222 
227  void setPosition(const agx::Vec3& position);
228 
233 
238  void setRotation(const agx::Quat& rotation);
239 
244 
252 
260 
268 
276 
282 
287  virtual agxCollide::Geometry* getGeometry() const override;
288 
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 
335 
345 
351 
357 
362 
368 
373 
377  size_t getResolutionX() const;
378 
382  size_t getResolutionY() const;
383 
389  agx::Real getElementSize() const;
390 
394  size_t getMemoryUsage();
395 
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 
481 
486 
491 
496 
501 
508  bool add(Shovel* shovel);
509 
515  bool remove(Shovel* shovel);
516 
521 
527 
532 
541  bool getPenetrationForce(const Shovel* shovel, agx::Vec3& force, agx::Vec3& torque) const;
542 
551 
561 
571 
581  agx::Vec3 getContactForce( const Shovel* shovel ) const;
582 
590 
598 
602  agx::Real getInnerVolume(const Shovel* shovel) const;
603 
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 
684 
696 
702  TerrainMaterial* getTerrainMaterial() const;
703 
708  void setTerrainMaterial( TerrainMaterial* terrainMaterial );
709 
717  bool loadLibraryMaterial( const agx::String materialName );
718 
725 
731  bool loadMaterialFile( const agx::String& filename );
732 
744  agx::ContactMaterial* contactMaterial,
746 
758 
767  bool setHeights( const agx::RealVector& heights, bool flipY = false, bool resetCompaction = true );
768 
774 
780 
788  agx::RealVector getResizedHeightField(size_t factorX, size_t factorY) const;
789 
797 
805 
810 
815 
820 
825 
836  agx::Vec3iVector& gridPoints ) const;
837 
850  agx::Vec3iVector& gridPoints,
851  MassType massType ) const;
852 
862  float removeFluidMassInGeometry(agxCollide::Geometry* geometry, float fluidMass);
863 
871 
875  size_t getNumSoilParticles() const;
876 
881  size_t getNumCreatedParticles() const;
882 
887 
892 
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:
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;
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;
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;
1239  void initVoxelStructureFromHeightField( bool adjustForCompaction = false );
1245  agx::Vec3 getValidParticlePosition(const agx::Real radius, const agx::Vec3i& index, const agx::Vec3& pos);
1249  void storeModifiedTerrainIndex( const agx::Vec2i& terrainVertex );
1250  void addModifiedParticleTerrainIndex(const agx::Vec2i& terrainIndex);
1251  void updateIndicesForAvalanche(TerrainIndexSet& forbiddenVertices);
1253 
1255  void storeVoxelContactHeight( const agx::Vec2i& voxelXY, agx::Real currentHeight );
1257 
1259  BasicGrid* grid,
1260  agxCollide::Geometry* geometry,
1261  agx::Vec3iVector& gridPoints,
1262  bool isOccupied = true) const;
1263 
1267 
1270 
1271  // Sampling method
1273 
1276  bool isDirty();
1277  void markVoxelToAvalanche(const agx::Vec3i& changedVoxel);
1279  void updateOccupancyFromHeightChange(const agx::Vec2i& heightFieldIndex);
1280  void avalanche();
1283  void sanitizeMaxDepthData(agx::Real maximumDepth);
1284 
1285  // Resize soil particles
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
1297  void mergeParticleIslands( const ParticleIslandVector& particleIslands, agxData::LocalVector<agx::Vec3i>& mergedParticleIndices );
1298  void resizeOrRemoveParticles( const agx::HashTable<SoilParticlePtr, std::array<agx::Real, 2>>& particlesToUpdate );
1300 
1301  // Merge to cutting edge functions
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
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;
1321  bool particleIslandShouldMerge(const agx::Vector<std::pair<agx::Vec3i, offsetIndexInfo>>& island);
1322  bool voxelColumnHasParticles(const agx::Vec2i& vertex) const;
1324 
1326 
1328 
1331 
1335 
1338 
1340 
1342 
1344 
1348 
1349  const agx::AffineMatrix4x4& _getTransform() const;
1350  const agx::AffineMatrix4x4& _getInverseTransform() const;
1351 
1353 
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 }
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#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
#define AGXTERRAIN_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: agx/Vector.h:34
The geometry representation used by the collision detection engine.
Definition: Geometry.h:93
A HeightField is a collision shape that can be created from a grid structure, like an image.
Local scope vector.
Definition: LocalVector.h:44
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:127
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.
Definition: Grid.h:71
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...
Definition: Shovel.h:87
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.
Definition: TerrainCache.h:54
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.
Collection of terrain tool (currently Shovel) related objects which are terrain instance specific.
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 getEnable() const
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 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 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
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.
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 store the combine material properties between two agx::Material's.
Definition: Material.h:528
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: HashVector.h:41
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.
Definition: Job.h:63
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.
Definition: Material.h:388
Representation of a name string.
Definition: Name.h:33
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.
Definition: agx/Plane.h:32
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:55
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
Definition: Uuid.h:42
A class holding 4 dimensional vectors and providing basic arithmetic.
Definition: Vec4Template.h:35
Vector containing 'raw' data.
Definition: agx/Vector.h:246
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
#define AGX_FORCE_INLINE
Definition: macros.h:58
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.
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...
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::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...
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
Definition: Geometry.h:60
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.
Definition: agx/Vec3.h:36
bool Bool
Definition: Integer.h:48
Vec2T< Int > Vec2i
Definition: Vec2.h:40
int32_t Int
Definition: Integer.h:35
uint32_t UInt
Definition: Integer.h:34
VectorPOD< Vec3i > Vec3iVector
Vec3T< Int > Vec3i
Definition: agx/Vec3.h:43
double Real
Definition: Real.h:42
float Real32
Definition: Real.h:44
LineT< Vec3 > Line
Definition: agx/Line.h:39