AGXDynamics  2.31.1.0
AggregateContactGenerator.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. 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 
24 namespace detail
25 {
26  struct ContactPatchData;
27  struct ContactSpanData;
28 }
29 
30 namespace agxTerrain
31 {
33 
36 
38 
40  {
41  public:
43 
44  void onPre(TerrainToolCollection* collection);
45 
49  agxCollide::GeometryContactPtrVector getGeometryContacts(agxSDK::Simulation *simulation) const;
50 
54  void initializeContactMaterials(TerrainToolCollection* collection);
55 
59  void resetAggregateContactHistory();
60 
64  const AggregateContactDepthModel& getAggregateDepthModel() const;
65 
66  protected:
67  virtual ~AggregateContactGenerator();
68 
69  private:
70 
71  void createGeometryContacts(TerrainToolCollection* collection);
72 
73  void createTerrainContacts(TerrainToolCollection* collection,
75 
76  void createShovelContacts(TerrainToolCollection* collection,
78 
79  agx::Real getContactPointAngle(const agx::Vec3& midPoint,
80  const agx::Vec3& zeroPoint,
81  const agx::Vec3& contactPoint,
82  const agx::Plane& polarPlane,
83  const agx::Plane& cutTopPlane) const;
84 
85  GeometryHashSet getShovelGeometries( TerrainToolCollection* collection) const;
86 
87  void getShovelContactsAndContactRange( TerrainToolCollection* collection,
88  GeometryHashSet& geometrySet,
90  agx::RangeReal& range) const;
91 
92  agxCollide::LocalParticleGeometryContactVector calculateShovelContactPoints( TerrainToolCollection* collection,
93  const agxCollide::ParticleGeometryContactVector& shovelContacts,
94  const agx::RangeReal& range ) const;
95 
96  void updateMeanContactNormals( detail::ContactPatchData& contactData,
98  const agx::Plane& cuttingTopPlane,
99  agx::Real contactAngle ) const;
100 
101  void updateContactSpan( detail::ContactPatchData& contactPatchData,
102  detail::ContactSpanData& contactSpanData,
104  const agx::Plane& middlePlane,
105  agx::Real contactAngle ) const;
106 
107  agxCollide::LocalParticleGeometryContactVector finalizeShovelContacts( TerrainToolCollection* collection,
108  detail::ContactPatchData& contactPatchData,
109  const agx::Vec3f& separationNormal,
110  const agx::Vec3& cuttingVector,
111  const detail::ContactSpanData& contactSpanData ) const;
112 
113  agx::Real calculateContactArea( const TerrainToolCollection* collection,
114  const agxCollide::LocalParticleGeometryContactVector& contacts ) const;
115 
116  private:
118 
119  ParticleIdSet m_particleIds;
120  agxCollide::LocalGeometryContactVector m_localGeometryContacts;
121  agx::ContactMaterialRef m_aggregateTerrainContactMaterial;
122  agx::ContactMaterialRef m_aggregateShovelContactMaterial;
123  AggregateContactDepthModel m_depthModel;
124  };
125 }
Pointer to a entity instance of type Physics.ParticleGeometryContact.
agx::HashSet< agxCollide::Geometry * > GeometryHashSet
Copyright 2007 - 2018.
Definition: Geometry.h:56
Collection of terrain tool (currently Shovel) related objects which are terrain instance specific...
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
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:113
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
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:121
double Real
Definition: Real.h:42