AGX Dynamics  2.35.0.1
TerrainContact.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 <agxTerrain/export.h>
20 #include <agx/Referenced.h>
21 #include <agxCollide/Geometry.h>
22 #include <agx/HashTable.h>
23 
24 namespace agxTerrain
25 {
26  class TerrainContactGenerator;
28 
31 
41  {
42  public:
47  struct SurfaceForce {
50  };
51 
53 
54  public:
55 
61 
67 
73 
80  agx::Real getArea() const;
81 
87 
93 
99 
104  agx::Real getSurfaceStressInIndex(const agx::Vec2i& terrainIndex) const;
105 
112 
118 
125 
126  public:
127  // Internal, but public methods
128 
135 
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 
171 
178  void setSurfacePointForces(const SurfaceForceVector& pointForces);
179 
180  protected:
184  virtual ~TerrainContact();
185 
186  public:
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 }
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#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
Class that contains information about a terrain contact between an external object and the terrain ge...
agx::Vector< SurfaceForce > SurfaceForceVector
agx::Real getMaxSurfaceForce() const
Get the maximum force of the Terrain contact from the associated contact points.
agx::Real getMeanGridDepth() const
Get the mean depth of the intersected grid points in the TerrainContact.
agx::Real getArea() const
Get the contact area.
void setContactArea(agx::Real area)
Internal method.
TerrainContact(const agxCollide::Geometry *geometry, const TerrainIndexToDepthTable terrainIndicesToDepth, const agx::Real area, const agx::Real meanGridDepth, const agx::Real currentContactTime, const agx::Bound3 contactBound)
Internal method.
agx::Real getSurfaceForce() const
Get the total surface force of the Terrain contact from all the contact points.
virtual ~TerrainContact()
Reference counted object - protected destructor.
const SurfaceForceVector & getSurfacePointForces() const
Get the surface point forces active in the Terrain contact.
TerrainContact()
Internal method.
agx::Real calculateTotalForce() const
agx::Real getSurfaceStressInIndex(const agx::Vec2i &terrainIndex) const
Get the specific contact stress in a terrain index in the contact by scaling the average stress with ...
agx::Real getSurfaceStress() const
Get the average surface stress of the contact which is calculated using the approximated contact area...
const TerrainIndexToDepthTable & getDepthTable() const
Get the table which holds information about the contact depth at each terrain index in the contact ar...
const agxCollide::Geometry * getGeometry() const
Get the geometry colliding with the terrain.
agx::Real getCurrentContactTime() const
Get the time that the colliding geometry has been in contact with the terrain.
void setSurfaceForce(agx::Real surfaceForce)
Internal method.
void setSurfaceStress(agx::Real surfaceStress)
Internal method.
void setSurfacePointForces(const SurfaceForceVector &pointForces)
Internal method.
agx::Bound3 getContactBound() const
The 3D bound spanned by the contact points of the colliding geometry.
Inheritance with partial specialization due to bug with ref_ptr containers.
Base class providing referencing counted objects.
Definition: Referenced.h:114
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
Definition: Geometry.h:60
agx::HashTable< agx::Vec2i, agx::Real > TerrainIndexToDepthTable
double Real
Definition: Real.h:42
Struct holding information about a surface force of the Terrain contact.