AGX Dynamics  2.38.0.2
ShovelAggregateContactUtils.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 
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  const agx::RealVector& weights);
50 
62  agx::Real contactArea,
63  const agx::RealVector& weights,
64  TerrainToolCollection* collection);
65 
77  agx::Real contactArea,
78  const agx::ContactMaterial* sourceMaterial,
79  const agx::RealVector& weights,
80  TerrainToolCollection* collection);
81 
87 
95 
103 
109  {
110  public:
112  {
113  // Initialize with 4 since we have 4 different aggregate contacts
114  m_contactMaterials.resize( 4, nullptr );
115  }
116 
118  {
119  }
120 
122  agx::ContactMaterial* contactMaterial )
123  {
124  agx::UInt32 materialIndex = static_cast< agx::UInt32 >( excavationMode );
125  if ( materialIndex < m_contactMaterials.size() )
126  {
127  m_contactMaterials[ materialIndex ] = contactMaterial;
128  return true;
129  }
130  else
131  {
132  return false;
133  }
134  }
135 
137  {
138  agx::UInt32 materialIndex = static_cast< agx::UInt32 >( excavationMode );
139  if ( materialIndex < m_contactMaterials.size() )
140  {
141  return m_contactMaterials[ static_cast< agx::UInt32 >( excavationMode ) ];
142  }
143  else
144  {
145  return nullptr;
146  }
147  }
148 
152 
153  private:
154  agx::Vector< agx::ContactMaterialRef > m_contactMaterials;
155  };
156 
162  agx::ContactMaterial* contactMaterial,
163  TerrainToolCollection* collection,
164  agx::Real bodyMass,
165  agx::Real contactVelocity,
166  agx::Real contactGravity,
167  agx::Real contactArea,
168  agx::Real elasticRestLength,
169  size_t numContacts );
170 
176  agx::Vec3 normal,
177  agx::Vec3 point,
178  const agx::RigidBody* rb1,
179  const agx::RigidBody* rb2 );
180 
187  agxSDK::Simulation* simulation,
188  const agx::Vec3& position );
189 }
agx::ContactMaterialRef
agx::ref_ptr< ContactMaterial > ContactMaterialRef
Definition: Material.h:60
agx::Real
double Real
Definition: Real.h:42
agxTerrain
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
Definition: Geometry.h:58
agx::RigidBody
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:51
agxStream::Serializable
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
DOXYGEN_END_INTERNAL_BLOCK
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
agxTerrain::Shovel
Definition: Shovel.h:50
DOXYGEN_START_INTERNAL_BLOCK
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
agxTerrain::Shovel::ExcavationMode
ExcavationMode
Enum for describing the different excavation modes of a shovel: PRIMARY - The primary mode of excavat...
Definition: Shovel.h:91
agxTerrain::setupShovelAggregateContactMaterial
AGXTERRAIN_EXPORT bool setupShovelAggregateContactMaterial(agx::ContactMaterial *shovelAggregateCM, agx::Real contactArea, Shovel::ExcavationMode mode, TerrainToolCollection *collection, const agx::RealVector &weights)
Configure the contact material that is to be used in shovel-aggregate contacts.
AGXSTREAM_DECLARE_SERIALIZABLE
#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
agx::VectorPOD< Real >
export.h
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition: AddedMassInteraction.h:22
agxTerrain::setShovelExplicitShovelContactMaterial
AGXTERRAIN_EXPORT void setShovelExplicitShovelContactMaterial(agx::ContactMaterial *shovelAggregateCM, agx::Real contactArea, const agx::ContactMaterial *sourceMaterial, const agx::RealVector &weights, TerrainToolCollection *collection)
Set the shovel-aggregate contact material properties from a source contact material that should be a ...
agxTerrain::ShovelAggregateContactMaterialContainer::getContactMaterial
agx::ContactMaterial * getContactMaterial(Shovel::ExcavationMode excavationMode)
Definition: ShovelAggregateContactUtils.h:136
Shovel.h
AGX_DECLARE_VECTOR_TYPES
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: Vector.h:34
agxTerrain::estimateContactDepth
agx::Real AGXTERRAIN_EXPORT estimateContactDepth(agx::ContactMaterial *contactMaterial, TerrainToolCollection *collection, agx::Real bodyMass, agx::Real contactVelocity, agx::Real contactGravity, agx::Real contactArea, agx::Real elasticRestLength, size_t numContacts)
Utility method for estimating the contact depth of a shovel <-> aggregate contact from contact veloci...
agx::Vec3
Vec3T< Real > Vec3
The object holding 3 dimensional vectors and providing basic arithmetic.
Definition: Vec3.h:36
agxTerrain::calculateGravityVector
agx::Vec3 AGXTERRAIN_EXPORT calculateGravityVector(agxSDK::Simulation *simulation, const agx::Vec3 &position)
Utility method for calculating the gravity vector given a point.
agxCollide::Geometry
The geometry representation used by the collision detection engine.
Definition: Geometry.h:91
agxTerrain::setShovelAggregateContactMaterialProperties
AGXTERRAIN_EXPORT void setShovelAggregateContactMaterialProperties(agx::ContactMaterial *shovelAggregateCM, agx::Real contactArea, const agx::RealVector &weights, TerrainToolCollection *collection)
Set the shovel-aggregate contact material properties from a source contact material that should eithe...
agx::ContactMaterial
This class store the combine material properties between two agx::Material's.
Definition: Material.h:515
TerrainMaterial.h
agxTerrain::isValidContactGeometry
AGXTERRAIN_EXPORT bool isValidContactGeometry(agxCollide::Geometry *geometry)
Checks if the specified geometry is valid for creating aggregate contacts against.
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
agxTerrain::calculateGv
agx::Real AGXTERRAIN_EXPORT calculateGv(agx::Vec3 normal, agx::Vec3 point, const agx::RigidBody *rb1, const agx::RigidBody *rb2)
Utility method for calculating the relative velocity of two bodies in a contact normal direction.
agxTerrain::TerrainToolCollection
Collection of terrain tool (currently Shovel) related objects which are terrain instance specific.
Definition: TerrainToolCollection.h:36
agxTerrain::ShovelAggregateContactMaterialContainer::~ShovelAggregateContactMaterialContainer
~ShovelAggregateContactMaterialContainer()
Definition: ShovelAggregateContactUtils.h:117
agxSDK
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:30
agxTerrain::ShovelAggregateContactMaterialContainer
Simple container class for storing and handling explicit contact material for shovel-aggregate contac...
Definition: ShovelAggregateContactUtils.h:108
agxTerrain::ShovelAggregateContactMaterialContainer::setContactMaterial
bool setContactMaterial(Shovel::ExcavationMode excavationMode, agx::ContactMaterial *contactMaterial)
Definition: ShovelAggregateContactUtils.h:121
agx::Material
Main material class which acts as a holder of a Surface Material and a Bulk material.
Definition: Material.h:375
agxTerrain::ShovelAggregateContactMaterialContainer::ShovelAggregateContactMaterialContainer
ShovelAggregateContactMaterialContainer()
Definition: ShovelAggregateContactUtils.h:111
agxTerrain::findShovelMaterial
AGXTERRAIN_EXPORT agx::Material * findShovelMaterial(agxTerrain::Shovel *shovel)
Find the agx::Material on the first contact valid contact geometry in the specified shovel.
agx::UInt32
uint32_t UInt32
Definition: Integer.h:32
Material.h
agxTerrain::getFirstContactValidGeometry
AGXTERRAIN_EXPORT agxCollide::Geometry * getFirstContactValidGeometry(const agx::RigidBody *shovelBody)
Get first contact valid geometry in the shovel rigid body for contact.