AGX Dynamics  2.38.0.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 }
agx::Real
double Real
Definition: Real.h:42
agxTerrain::AggregateContactDepthModel
Class used to calculate the contact depth in the soil aggregate <-> terrain contacts to mimic an elas...
Definition: AggregateContactUtils.h:45
agx::Vector< LocalGeometryContact >
PrimaryActiveZone.h
agxTerrain
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
Definition: Geometry.h:58
agx::VectorPOD< GeometryContact * >
Plane.h
agxTerrain::AggregateContactGenerator
Definition: AggregateContactGenerator.h:42
agx::PlaneT
Class representing the mathematical concept of a plane, also called a half- space.
Definition: Plane.h:31
agx::ref_ptr< ContactMaterial >
agxTerrain::GeometryHashSet
agx::HashSet< agxCollide::Geometry * > GeometryHashSet
Definition: AggregateContactGenerator.h:38
agxSDK::Simulation
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:125
agx::Physics::ParticleGeometryContactPtr
Pointer to a entity instance of type Physics.ParticleGeometryContact.
Definition: ParticleGeometryContactEntity.h:267
agx::ContactMaterial
This class store the combine material properties between two agx::Material's.
Definition: Material.h:515
AggregateContactUtils.h
agx::HashSet< agxCollide::Geometry * >
agx::Referenced
Base class providing referencing counted objects.
Definition: Referenced.h:119
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
AGXTERRAIN_EXPORT
#define AGXTERRAIN_EXPORT
Definition: agxTerrain/export.h:41
TerrainFrictionModels.h
agxTerrain::TerrainToolCollection
Collection of terrain tool (currently Shovel) related objects which are terrain instance specific.
Definition: TerrainToolCollection.h:36
agx::Range< Real >
agx::Vec3T< Real >
SoilParticleAggregate.h
agxTerrain::GeometryLocalContactTable
agx::HashVector< agxCollide::Geometry *, agxCollide::LocalGeometryContact > GeometryLocalContactTable
Definition: AggregateContactGenerator.h:35
agx::UInt32
uint32_t UInt32
Definition: Integer.h:32
agx::HashVector
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: HashVector.h:40