AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
DeformController.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. 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{
28
30 {
31 public:
33 const agx::Line& cuttingEdge,
34 const agx::Line& topEdge,
35 const agx::Vec3& forwardVector,
36 const agxCollide::GeometryRefVector& voxelCollisionGeometries);
37
38 void addNotification(agxSDK::Simulation* simulation, Terrain* terrain);
39
40 void removeNotification(agxSDK::Simulation* simulation, Terrain* terrain);
41
43
44 void onPre(TerrainToolCollection* collection);
45
46 void onPost(TerrainToolCollection* collection);
47
49
51
53
55
57
58 void onEnableChanged(bool enable);
59
61
63
65
67
69
70 void setEnableCustomFrictionModels( bool enable );
71
73
75
83
91
92 protected:
94
95 private:
96 enum DeformSide
97 {
98 BACK = 0,
99 LEFT = 1,
100 RIGHT = 2
101 };
102
103 private:
104
105 void createEdges(const agx::Line& cuttingEdge,
106 const agx::Line& topEdge,
107 const agx::Vec3& forwardVector,
108 const agxCollide::GeometryRefVector& voxelCollisionGeometries);
109
110 agx::Vec3Vector extractVertices(const agxCollide::GeometryRefVector& voxelCollisionGeometries);
111
112 agx::Vec3 findEdgePoint( agx::Vec3Vector& vertices,
113 agx::Vec3 point,
114 agx::Plane& frontPlane,
115 agx::Plane& bottomPlane,
116 agx::Plane& sidePlane,
117 agx::Real tol );
118
119 void deformSolidMass(TerrainToolCollection* collection);
120
121 bool shouldDeformMass(TerrainToolCollection* collection);
122
123 void createAggregateContactPoints(TerrainToolCollection* collection);
124
125 void createShovelContacts(TerrainToolCollection* collection);
126
127 void createTerrainContacts(TerrainToolCollection* collection);
128
129 agx::Vec3Vector findShovelTerrainIntersectionPoints( TerrainToolCollection* collection,
130 DeformerCollection* deformer );
131
132 agx::Vec3Vector findAggregateTerrainIntersectionPoints( const agx::Line& wedgeCuttingEdge,
133 const agx::Line& wedgeFailureEdge );
134
135 agx::Vec3 calculateAggregateNormal( const agx::Line& wedgeCuttingEdge,
136 const agx::Line& wedgeFailureEdge ) const;
137
138 void pushSoilToSides(TerrainToolCollection* collection,
139 const agx::Vec3& fromVoxelWorldPos,
140 const agx::Real& elementSize,
141 const agx::Vec3& topVectorNormalized,
142 const agx::Vec3& deformerNormal,
143 const agx::Real& timeStep,
144 const agx::Real& voxelSpeed,
145 const agx::Vec2i& fromTerrainIndex,
146 const float& occupancyInVoxel,
147 const float& dynamicMassCompaction,
148 const agx::Vec3i& voxel,
149 agx::Vec3* voxelSideVelocity);
150
151 void updateFrictionModels( TerrainToolCollection* collection );
152
153 void DEBUG_DRAW();
154
155 private:
156
157 agx::Frame* m_parentFrame;
158 std::array<DeformerCollectionRef, 3> m_deformers;
159 std::array<AggregateContactDepthModel, 3> m_depthModels;
160 std::array<ShovelAggregateFrictionModelRef, 3> m_frictionModels;
162 std::array<agx::ContactMaterialRef, 3> m_aggregateTerrainContactMaterials;
163 std::array<agx::ContactMaterialRef, 3> m_aggregateShovelContactMaterials;
164 bool m_enableCustomFrictionModels;
165 };
166}
#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:126
Class used to calculate the contact depth in the soil aggregate <-> terrain contacts to mimic an elas...
DeformerCollection * getDeformerCollection(size_t i)
void initializeContactMaterials(TerrainToolCollection *collection)
agxCollide::GeometryPtrVector getActiveZoneGeometries()
void onPre(TerrainToolCollection *collection)
void addNotification(agxSDK::Simulation *simulation, Terrain *terrain)
void onPreCollide(TerrainToolCollection *collection)
const agxTerrain::AggregateContactDepthModel & getAggregateDepthModel(agx::UInt i) const
void onEnableChanged(bool enable)
void removeNotification(agxSDK::Simulation *simulation, Terrain *terrain)
void initializeFrictionModels(TerrainToolCollection *collection)
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
DeformController(agx::Frame *parentFrame, const agx::Line &cuttingEdge, const agx::Line &topEdge, const agx::Vec3 &forwardVector, const agxCollide::GeometryRefVector &voxelCollisionGeometries)
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)
ActiveZonePtrVector getActiveZones()
void onPost(TerrainToolCollection *collection)
SoilParticleAggregatePtrVector getSoilParticleAggregates()
void resetAggregateContactHistory(agx::UInt i)
agxCollide::GeometryContactPtrVector getGeometryContacts(agxSDK::Simulation *simulation) const
agx::Real calculateShovelAggregateContactArea(const agx::Vec3Vector &contactPoints, agx::Real voxelArea) const
Collection of terrain tool (currently Shovel) related objects which are terrain instance specific.
A terrain model based a 3D grid model with overlapping height field that can be deformed by interacti...
Definition Terrain.h:86
This class store the combine material properties between two agx::Material's.
Definition Material.h:516
The object defining a frame of reference and providing transformations operations.
Definition agx/Frame.h:68
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:120
Vector containing 'raw' data.
Definition agx/Vector.h:246
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:42