AGX Dynamics  2.37.3.2
TerrainContact.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 <agxTerrain/export.h>
20 #include <agx/Referenced.h>
21 #include <agxCollide/Geometry.h>
22 #include <agx/HashTable.h>
23 
24 namespace agxTerrain
25 {
28 
31 
41  {
42  public:
47  struct SurfaceForce {
50  };
51 
53 
54  public:
55 
60  const agxCollide::Geometry* getGeometry() const;
61 
66  const TerrainIndexToDepthTable& getDepthTable() const;
67 
72  agx::Bound3 getContactBound() const;
73 
80  agx::Real getArea() const;
81 
86  agx::Real getMeanGridDepth() const;
87 
92  agx::Real getCurrentContactTime() const;
93 
98  agx::Real getSurfaceStress() const;
99 
104  agx::Real getSurfaceStressInIndex(const agx::Vec2i& terrainIndex) const;
105 
111  agx::Real getSurfaceForce() const;
112 
117  agx::Real getMaxSurfaceForce() const;
118 
124  const SurfaceForceVector& getSurfacePointForces() const;
125 
126  public:
127  // Internal, but public methods
128 
134  TerrainContact();
135 
141  TerrainContact(const agxCollide::Geometry* geometry,
142  const TerrainIndexToDepthTable terrainIndicesToDepth,
143  const agx::Real area,
144  const agx::Real meanGridDepth,
145  const agx::Real currentContactTime,
146  const agx::Bound3 contactBound);
147 
154  void setSurfaceStress(agx::Real surfaceStress);
155 
162  void setSurfaceForce(agx::Real surfaceForce);
163 
170  void setContactArea(agx::Real area);
171 
178  void setSurfacePointForces(const SurfaceForceVector& pointForces);
179 
180  protected:
184  virtual ~TerrainContact();
185 
186  public:
187  agx::Real calculateTotalForce() const;
188 
189  private:
190  const agxCollide::Geometry* m_geometry;
191  TerrainIndexToDepthTable m_terrainIndicesToDepth;
192  agx::Real m_area;
193  agx::Real m_meanGridDepth;
194  agx::Real m_currentContactTime;
195  agx::Bound3 m_contactBound;
196  agx::Real m_surfaceStress;
197  agx::Real m_surfaceForce;
198  SurfaceForceVector m_pointForces;
199  };
200 }
agx::HashTable< agx::Vec2i, agx::Real > TerrainIndexToDepthTable
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes...
Definition: Geometry.h:59
Class that contains information about a terrain contact between an external object and the terrain ge...
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
This class has two main responsibilities:
Base class providing referencing counted objects.
Definition: Referenced.h:119
The geometry representation used by the collision detection engine.
Definition: Geometry.h:92
Struct holding information about a surface force of the Terrain contact.
#define AGXTERRAIN_EXPORT
agx::Vector< SurfaceForce > SurfaceForceVector
double Real
Definition: Real.h:42
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: Vector.h:34
Inheritance with partial specialization due to bug with ref_ptr containers.