AGX Dynamics  2.35.0.1
ShovelAggregateContactUtils.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 <agxTerrain/export.h>
20 #include <agx/Material.h>
22 #include <agxTerrain/Shovel.h>
23 
24 
25 
26 namespace agxTerrain
27 {
30 
46  agx::Real contactArea,
48  TerrainToolCollection* collection );
49 
61  agx::Real contactArea,
62  const agx::ContactMaterial* sourceMaterial,
63  const TerrainMaterial* terrainMaterial );
64 
70 
78 
86 
92  {
93  public:
95  {
96  // Initialize with 4 since we have 4 different aggregate contacts
97  m_contactMaterials.resize( 4, nullptr );
98  }
99 
101  {
102  }
103 
105  agx::ContactMaterial* contactMaterial )
106  {
107  agx::UInt32 materialIndex = static_cast< agx::UInt32 >( excavationMode );
108  if ( materialIndex < m_contactMaterials.size() )
109  {
110  m_contactMaterials[ materialIndex ] = contactMaterial;
111  return true;
112  }
113  else
114  {
115  return false;
116  }
117  }
118 
120  {
121  agx::UInt32 materialIndex = static_cast< agx::UInt32 >( excavationMode );
122  if ( materialIndex < m_contactMaterials.size() )
123  {
124  return m_contactMaterials[ static_cast< agx::UInt32 >( excavationMode ) ];
125  }
126  else
127  {
128  return nullptr;
129  }
130  }
131 
135 
136  private:
137  agx::Vector< agx::ContactMaterialRef > m_contactMaterials;
138  };
139 }
140 
141 
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
#define AGXTERRAIN_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: agx/Vector.h:34
The geometry representation used by the collision detection engine.
Definition: Geometry.h:93
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:45
Simple container class for storing and handling explicit contact material for shovel-aggregate contac...
agx::ContactMaterial * getContactMaterial(Shovel::ExcavationMode excavationMode)
bool setContactMaterial(Shovel::ExcavationMode excavationMode, agx::ContactMaterial *contactMaterial)
ExcavationMode
Enum for describing the different excavation modes of a shovel: PRIMARY - The primary mode of excavat...
Definition: Shovel.h:87
This class is used to describe the general material properties of the Terrain.
Collection of terrain tool (currently Shovel) related objects which are terrain instance specific.
This class store the combine material properties between two agx::Material's.
Definition: Material.h:528
Main material class which acts as a holder of a Surface Material and a Bulk material.
Definition: Material.h:388
Base class providing referencing counted objects.
Definition: Referenced.h:114
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:55
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
Definition: Geometry.h:60
AGXTERRAIN_EXPORT agxCollide::Geometry * getFirstContactValidGeometry(const agx::RigidBody *shovelBody)
Get first contact valid geometry in the shovel rigid body for contact.
AGXTERRAIN_EXPORT bool setupShovelAggregateContactMaterial(agx::ContactMaterial *shovelAggregateCM, agx::Real contactArea, Shovel::ExcavationMode mode, TerrainToolCollection *collection)
Configure the contact material that is to be used in shovel-aggregate contacts.
AGXTERRAIN_EXPORT void setShovelAggregateContactMaterialProperties(agx::ContactMaterial *shovelAggregateCM, agx::Real contactArea, const agx::ContactMaterial *sourceMaterial, const TerrainMaterial *terrainMaterial)
Set the shovel-aggregate contact material properties from a source contact material that should eithe...
AGXTERRAIN_EXPORT bool isValidContactGeometry(agxCollide::Geometry *geometry)
Checks if the specified geometry is valid for creating aggregate contacts against.
AGXTERRAIN_EXPORT agx::Material * findShovelMaterial(agxTerrain::Shovel *shovel)
Find the agx::Material on the first contact valid contact geometry in the specified shovel.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint32_t UInt32
Definition: Integer.h:40
agx::ref_ptr< ContactMaterial > ContactMaterialRef
Definition: Material.h:60
double Real
Definition: Real.h:42