AGX Dynamics  2.35.0.1
AggregateContactUtils.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/Plane.h>
20 #include <agx/Vec3.h>
21 #include <agx/Vector.h>
22 
23 namespace agx
24 {
25  class RigidBody;
26 }
27 
28 
29 namespace agxTerrain
30 {
31  class Terrain;
32  class TerrainToolCollection;
33 
45  {
46  public:
51 
61  void updateContactDepth( const agx::Vec3& referencePoint,
62  const agx::Vec3& separationNormal,
63  const agx::Vec3Vector& contactPoints,
64  agx::Real cos_contactAngleThreshold );
65 
70 
74  bool hasContactHistory() const;
75 
80 
85 
91 
97 
103 
108  void setCurrentDepth( agx::Real currentDepth );
109 
115  void setDepthDecayFactor(agx::Real depthDecayFactor);
116 
122  void setDepthIncreaseFactor(agx::Real depthIncreaseFactor);
123 
128  void setMaximumContactDepth( agx::Real maximumDepth );
129 
136 
141 
146 
150  void DEBUG_DRAW_DEPTH_METER( const agx::Vec3& meterDirection );
151 
155  void DEBUG_DRAW_CONTACT_PLANE( const agx::Vec3Vector& contactPoints );
156 
161 
163  // Variables
165  private:
166  agx::Plane m_soilContactPlane;
167  agx::Vec3 m_previousReferencePoint;
168  agx::Real m_maximumContactDepth;
169  agx::Real m_contactDepthDecayFactor;
170  agx::Real m_contactDepthIncreaseFactor;
171  agx::Real m_currentDepth;
172  agx::Real m_contactArea;
173  bool m_hasContactHistory;
174 
175  agx::Vec3Vector m_previousPoints;
176  agxRender::Color m_debugColor;
177  };
178 
188  agx::Real soilAggregateMass,
189  agx::Real contactArea,
190  agx::Real frictionAngle );
191 
198 }
#define AGXTERRAIN_EXPORT
Utility color class with "common colors".
Definition: Color.h:34
Class used to calculate the contact depth in the soil aggregate <-> terrain contacts to mimic an elas...
AggregateContactDepthModel()
Default constructor.
void trimPreviousContactPoints()
Trim the history of contact points.
void setMaximumContactDepth(agx::Real maximumDepth)
Set the maximum contact depth (m) in the model.
void setCurrentDepth(agx::Real currentDepth)
Update the current depth (m) of the model.
void resetContactHistory()
Reset the contact history by erasing the current depth, contact plane and previous contact points.
void DEBUG_DRAW_CONTACT_POINTS()
Debug draw contact history.
void DEBUG_DRAW_CONTACT_PLANE(const agx::Vec3Vector &contactPoints)
Debug the depth meter, illustrating how far the current depth is from the maximum depth.
void setDepthIncreaseFactor(agx::Real depthIncreaseFactor)
Set the depth increase factor of the model.
void DEBUG_DRAW_DEPTH_METER(const agx::Vec3 &meterDirection)
Debug the depth meter, illustrating how far the current depth is from the maximum depth.
void setDepthDecayFactor(agx::Real depthDecayFactor)
Set the depth decay factor of the model.
void updateContactDepth(const agx::Vec3 &referencePoint, const agx::Vec3 &separationNormal, const agx::Vec3Vector &contactPoints, agx::Real cos_contactAngleThreshold)
Update the depth in the model by using a reference contact point, separation normal of the excavation...
void setAggregateContactArea(agx::Real area)
Set the aggregate contact area (m3) in the model, spanned by the contact points in that interface.
void setDebugDrawColor(const agxRender::Color &color)
Set the color to use during debug rendering.
Collection of terrain tool (currently Shovel) related objects which are terrain instance specific.
Class representing the mathematical concept of a plane, also called a half- space.
Definition: agx/Plane.h:32
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
Definition: Geometry.h:60
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...
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.
double Real
Definition: Real.h:42