AGX Dynamics  2.35.0.1
AggregateContactGenerator.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 
20 #include <agx/Plane.h>
23 
25 namespace detail
26 {
27  struct ContactPatchData;
28  struct ContactSpanData;
29 }
31 
32 namespace agxTerrain
33 {
34  class TerrainToolCollection;
35 
38 
40 
42  {
43  public:
45 
46  void onPre(TerrainToolCollection* collection);
47 
52 
57 
62 
67 
68  protected:
70 
71  private:
72 
73  void createGeometryContacts(TerrainToolCollection* collection);
74 
75  void createTerrainContacts(TerrainToolCollection* collection,
77 
78  void createShovelContacts(TerrainToolCollection* collection,
80 
81  agx::Real getContactPointAngle(const agx::Vec3& midPoint,
82  const agx::Vec3& zeroPoint,
83  const agx::Vec3& contactPoint,
84  const agx::Plane& polarPlane,
85  const agx::Plane& cutTopPlane) const;
86 
87  GeometryHashSet getShovelGeometries( TerrainToolCollection* collection) const;
88 
89  void getShovelContactsAndContactRange( TerrainToolCollection* collection,
90  GeometryHashSet& geometrySet,
92  agx::RangeReal& range) const;
93 
94  agxCollide::LocalParticleGeometryContactVector calculateShovelContactPoints( TerrainToolCollection* collection,
95  const agxCollide::ParticleGeometryContactVector& shovelContacts,
96  const agx::RangeReal& range ) const;
97 
98  void updateMeanContactNormals( detail::ContactPatchData& contactData,
100  const agx::Plane& cuttingTopPlane,
101  agx::Real contactAngle ) const;
102 
103  void updateContactSpan( detail::ContactPatchData& contactPatchData,
104  detail::ContactSpanData& contactSpanData,
106  const agx::Plane& middlePlane,
107  agx::Real contactAngle ) const;
108 
109  agxCollide::LocalParticleGeometryContactVector finalizeShovelContacts( TerrainToolCollection* collection,
110  detail::ContactPatchData& contactPatchData,
111  const agx::Vec3f& separationNormal,
112  const agx::Vec3& cuttingVector,
113  const detail::ContactSpanData& contactSpanData ) const;
114 
115  agx::Real calculateContactArea( const TerrainToolCollection* collection,
116  const agxCollide::LocalParticleGeometryContactVector& contacts ) const;
117 
118  private:
120 
121  ParticleIdSet m_particleIds;
122  agxCollide::LocalGeometryContactVector m_localGeometryContacts;
123  agx::ContactMaterialRef m_aggregateTerrainContactMaterial;
124  agx::ContactMaterialRef m_aggregateShovelContactMaterial;
125  AggregateContactDepthModel m_depthModel;
126  };
127 }
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:127
Class used to calculate the contact depth in the soil aggregate <-> terrain contacts to mimic an elas...
void resetAggregateContactHistory()
Resets contact model history in the contact generator.
agxCollide::GeometryContactPtrVector getGeometryContacts(agxSDK::Simulation *simulation) const
void initializeContactMaterials(TerrainToolCollection *collection)
Initialize contact materials used in the aggregate contacts.
void onPre(TerrainToolCollection *collection)
const AggregateContactDepthModel & getAggregateDepthModel() const
Get the aggregate <-> terrain contact depth model.
Collection of terrain tool (currently Shovel) related objects which are terrain instance specific.
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: HashVector.h:41
Pointer to a entity instance of type Physics.ParticleGeometryContact.
Class representing the mathematical concept of a plane, also called a half- space.
Definition: agx/Plane.h:32
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::HashVector< agxCollide::Geometry *, agxCollide::LocalGeometryContact > GeometryLocalContactTable
agx::HashSet< agxCollide::Geometry * > GeometryHashSet
double Real
Definition: Real.h:42