AGX Dynamics  2.37.2.0
AggregateContactUtils.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #pragma once
18 
19 #include <agx/Plane.h>
20 #include <agx/Vec3.h>
21 #include <agx/Vector.h>
22 #include <agx/Math.h>
23 
24 namespace agx
25 {
26  class RigidBody;
27 }
28 
29 
30 namespace agxTerrain
31 {
32  class Terrain;
33  class TerrainToolCollection;
34 
46  {
47  public:
52 
62  void updateContactDepth( const agx::Vec3& referencePoint,
63  const agx::Vec3& separationNormal,
64  const agx::Vec3Vector& contactPoints,
65  agx::Real cos_contactAngleThreshold );
66 
70  void resetContactHistory();
71 
75  bool hasContactHistory() const;
76 
80  agx::Real getCurrentDepth() const;
81 
85  agx::Real getMaximumContactDepth() const;
86 
91  agx::Real getDepthDecayFactor() const;
92 
97  agx::Real getDepthIncreaseFactor() const;
98 
103  agx::Real getAggregateContactArea() const;
104 
109  void setCurrentDepth( agx::Real currentDepth );
110 
116  void setDepthDecayFactor(agx::Real depthDecayFactor);
117 
123  void setDepthIncreaseFactor(agx::Real depthIncreaseFactor);
124 
129  void setMaximumContactDepth( agx::Real maximumDepth );
130 
136  void setAggregateContactArea(agx::Real area);
137 
141  void setDebugDrawColor(const agxRender::Color& color);
142 
146  void DEBUG_DRAW_CONTACT_POINTS();
147 
151  void DEBUG_DRAW_DEPTH_METER( const agx::Vec3& meterDirection );
152 
156  void DEBUG_DRAW_CONTACT_PLANE( const agx::Vec3Vector& contactPoints );
157 
161  void trimPreviousContactPoints();
162 
164  // Variables
166  private:
167  agx::Plane m_soilContactPlane;
168  agx::Vec3 m_previousReferencePoint;
169  agx::Real m_maximumContactDepth;
170  agx::Real m_contactDepthDecayFactor;
171  agx::Real m_contactDepthIncreaseFactor;
172  agx::Real m_currentDepth;
173  agx::Real m_contactArea;
174  bool m_hasContactHistory;
175 
176  agx::Vec3Vector m_previousPoints;
177  agxRender::Color m_debugColor;
178  };
179 
189  agx::Real soilAggregateMass,
190  agx::Real contactArea,
191  agx::Real frictionAngle );
192 
199 }
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes...
Definition: Geometry.h:59
Collection of terrain tool (currently Shovel) related objects which are terrain instance specific...
Utility color class with "common colors".
Definition: Color.h:33
Class representing the mathematical concept of a plane, also called a half- space.
Definition: Plane.h:31
Class used to calculate the contact depth in the soil aggregate <-> terrain contacts to mimic an elas...
agx::Vec3 AGXTERRAIN_EXPORT calculateContactReferencePoint(const agx::Vec3Vector &contactPoints)
Calculates the reference point that will be used in the contact model from specified contact points...
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
#define AGXTERRAIN_EXPORT
agx::Real AGXTERRAIN_EXPORT estimateMaximumAggregateForce(const TerrainToolCollection *collection, agx::Real soilAggregateMass, agx::Real contactArea, agx::Real frictionAngle)
Estimate the maximum force that can be generated from a soil aggregate in the contact between the agg...
double Real
Definition: Real.h:42