AGX Dynamics  2.37.3.2
AggregateContactGenerator.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 
20 #include <agx/Plane.h>
24 
26 namespace detail
27 {
28  struct ContactPatchData;
29  struct ContactSpanData;
30 }
32 
33 namespace agxTerrain
34 {
36 
39 
41 
43  {
44  public:
46 
47  void onPre( TerrainToolCollection* collection );
48 
49  void onPost(TerrainToolCollection* collection);
50 
54  agxCollide::GeometryContactPtrVector getGeometryContacts( agxSDK::Simulation* simulation ) const;
55 
59  void initializeContactMaterials( TerrainToolCollection* collection );
60 
64  void initializeFrictionModels( TerrainToolCollection* collection );
65 
69  void resetAggregateContactHistory();
70 
74  const AggregateContactDepthModel& getAggregateDepthModel() const;
75 
81  bool particleIsInShovelContacts( agx::UInt32 particleId ) const;
82 
83 
87  agx::ContactMaterial* getAggregateShovelContactMaterial() const;
88 
92  agx::ContactMaterial* getAggregateTerrainContactMaterial() const;
93 
96  size_t getNumShovelContactPoints() const;
97 
98  void setEnableCustomFrictionModels( bool enable );
99  bool getEnableCustomFrictionModels() const;
100 
101  protected:
102  virtual ~AggregateContactGenerator();
103 
104  private:
105 
106  void createGeometryContacts( TerrainToolCollection* collection );
107 
108  void createTerrainContacts( TerrainToolCollection* collection,
110 
111  void createShovelContacts( TerrainToolCollection* collection,
113 
114  agx::Real getContactPointAngle( const agx::Vec3& midPoint,
115  const agx::Vec3& zeroPoint,
116  const agx::Vec3& contactPoint,
117  const agx::Plane& polarPlane,
118  const agx::Plane& cutTopPlane ) const;
119 
120  GeometryHashSet getShovelGeometries( TerrainToolCollection* collection ) const;
121 
122  void getShovelContactsAndContactRange( TerrainToolCollection* collection,
123  GeometryHashSet& geometrySet,
125  agx::RangeReal& range );
126 
127  agxCollide::LocalParticleGeometryContactVector calculateShovelContactPoints( TerrainToolCollection* collection,
128  const agxCollide::ParticleGeometryContactVector& shovelContacts,
129  const agx::RangeReal& range ) const;
130 
131  void updateMeanContactData( detail::ContactPatchData& contactData,
133  const agx::Plane& cuttingTopPlane,
134  agx::Real contactAngle ) const;
135 
136  void updateContactSpan( detail::ContactPatchData& contactPatchData,
137  detail::ContactSpanData& contactSpanData,
139  const agx::Plane& middlePlane,
140  agx::Real contactAngle ) const;
141 
142  agxCollide::LocalParticleGeometryContactVector finalizeShovelContacts( TerrainToolCollection* collection,
143  detail::ContactPatchData& contactPatchData,
144  const agx::Vec3f& separationNormal,
145  const agx::Vec3& cuttingVector,
146  const detail::ContactSpanData& contactSpanData ) const;
147 
148  agx::Real calculateContactArea( const TerrainToolCollection* collection,
149  const agxCollide::LocalParticleGeometryContactVector& contacts ) const;
150 
151  private:
153 
154  ParticleIdSet m_particleIds;
155  ParticleIdSet m_particlesInShovelContacts;
156  agxCollide::LocalGeometryContactVector m_localGeometryContacts;
157  agxCollide::LocalGeometryContactVector m_localShovelAggregateContacts;
158  agx::ContactMaterialRef m_aggregateTerrainContactMaterial;
159  agx::ContactMaterialRef m_aggregateShovelContactMaterial;
160  AggregateContactDepthModel m_depthModel;
161  ShovelAggregateFrictionModelRef m_frictionModel;
162  bool m_enableCustomFrictionModels;
163  };
164 }
This class store the combine material properties between two agx::Material&#39;s.
Definition: Material.h:515
Pointer to a entity instance of type Physics.ParticleGeometryContact.
agx::HashSet< agxCollide::Geometry * > GeometryHashSet
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...
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
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::HashVector< agxCollide::Geometry *, agxCollide::LocalGeometryContact > GeometryLocalContactTable
Base class providing referencing counted objects.
Definition: Referenced.h:119
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: HashVector.h:40
Vector containing &#39;raw&#39; data.
Definition: Vector.h:245
#define AGXTERRAIN_EXPORT
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:126
double Real
Definition: Real.h:42
uint32_t UInt32
Definition: Integer.h:40