AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
DeformController.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
20#include <agx/Plane.h>
23#include <array>
24
25namespace agxTerrain
26{
27 class Terrain;
28 class Shovel;
29
31
33 {
34 public:
36
38
40
42
44
45 void onPreCollide(Terrain* terrain, bool shouldDeformMass);
46
47 void onPre(Terrain* terrain, Shovel* shovel);
48
49 void onPost( Shovel* shovel, Terrain* terrain);
50
52
54
56
58
60
62
63 void onEnableChanged(bool enable);
64
65 void initializeContactMaterials(Terrain* terrain, Shovel* shovel);
66
68
69 void initializeAggregateTerrainContactMaterial(Terrain* terrain, size_t deformerMode);
70
72
74
76
78
80
81 void setEnableCustomFrictionModels( bool enable );
82
84
86
94
102
103 protected:
105
106 private:
107 enum DeformSide
108 {
109 BACK = 0,
110 LEFT = 1,
111 RIGHT = 2
112 };
113
114 private:
115
116 void deformSolidMass(Terrain* terrain);
117
118 bool shouldDeformMass(Terrain* terrain, Shovel* shovel);
119
120 void createAggregateContactPoints(Terrain* terrain, Shovel* shovel);
121
122 void createShovelContacts(Terrain* terrain, Shovel* shovel);
123
124 void createTerrainContacts(Terrain* terrain, Shovel* shovel);
125
126 agx::Vec3Vector findShovelTerrainIntersectionPoints( Terrain* terrain,
127 DeformerCollection* deformer );
128
129 agx::Vec3Vector findAggregateTerrainIntersectionPoints( const agx::Line& wedgeCuttingEdge,
130 const agx::Line& wedgeFailureEdge );
131
132 agx::Vec3 calculateAggregateNormal( const agx::Line& wedgeCuttingEdge,
133 const agx::Line& wedgeFailureEdge ) const;
134
135 void pushSoilToSides(Terrain* terrain,
136 const agx::Vec3& fromVoxelWorldPos,
137 const agx::Real& elementSize,
138 const agx::Vec3& topVectorNormalized,
139 const agx::Vec3& deformerNormal,
140 const agx::Real& timeStep,
141 const agx::Real& voxelSpeed,
142 const agx::Vec2i& fromTerrainIndex,
143 const float& occupancyInVoxel,
144 const float& dynamicMassCompaction,
145 const agx::Vec3i& voxel,
146 agx::Vec3* voxelSideVelocity);
147
148 void updateFrictionModels( Terrain* terrain );
149
150 void DEBUG_DRAW();
151
152 private:
153 agx::Frame* m_parentFrame;
158 agx::Vector<agx::ContactMaterialRef> m_aggregateTerrainContactMaterials;
159 agx::Vector<agx::ContactMaterialRef> m_aggregateShovelContactMaterials;
160 bool m_enableCustomFrictionModels;
161 };
162}
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#define AGXTERRAIN_EXPORT
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:131
Class used to calculate the contact depth in the soil aggregate <-> terrain contacts to mimic an elas...
DeformerCollection * getDeformerCollection(size_t i)
agxCollide::GeometryPtrVector getActiveZoneGeometries()
void initializeContactMaterials(Terrain *terrain, Shovel *shovel)
void onPost(Shovel *shovel, Terrain *terrain)
const agxTerrain::AggregateContactDepthModel & getAggregateDepthModel(agx::UInt i) const
void initializeContactMaterialsExternalDeformer(agx::RigidBody *parentBody, Terrain *terrain)
void onEnableChanged(bool enable)
agx::ContactMaterial * getAggregateShovelContactMaterial(agx::UInt i) const
Get the internal shovel <-> aggregate contact material of the specified deformer denoted by an index.
bool getEnableCustomFrictionModels() const
agx::ContactMaterial * getAggregateTerrainContactMaterial(agx::UInt i) const
Get the internal aggregate <-> terrain contact material of the specified deformer denoted by an index...
void setEnableCustomFrictionModels(bool enable)
void onPreCollide(Terrain *terrain, bool shouldDeformMass)
ActiveZonePtrVector getActiveZones()
void addDeformer(DeformerCollection *deformer)
DeformController(agx::Frame *parentFrame)
void initializeAggregateTerrainContactMaterial(Terrain *terrain, size_t deformerMode)
SoilParticleAggregatePtrVector getSoilParticleAggregates()
void removeNotification(agxSDK::Simulation *simulation)
void onPre(Terrain *terrain, Shovel *shovel)
void addNotification(agxSDK::Simulation *simulation)
void resetAggregateContactHistory(agx::UInt i)
agxCollide::GeometryContactPtrVector getGeometryContacts(agxSDK::Simulation *simulation) const
agx::Real calculateShovelAggregateContactArea(const agx::Vec3Vector &contactPoints, agx::Real voxelArea) const
Shovel object used to interact with a terrain via an active zone that converts solid terrain to dynam...
Definition: Shovel.h:63
A terrain model based a 3D grid model with overlapping height field that can be deformed by interacti...
Definition: Terrain.h:92
This class store the combine material properties between two agx::Material's.
Definition: Material.h:518
The object defining a frame of reference and providing transformations operations.
Definition: agx/Frame.h:68
Base class providing referencing counted objects.
Definition: Referenced.h:120
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:49
Vector containing 'raw' data.
Definition: agx/Vector.h:246
Templated vector class.
Definition: agx/Vector.h:53
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
Definition: Geometry.h:59
uint64_t UInt
Definition: Integer.h:27
double Real
Definition: Real.h:41