AGXDynamics
2.35.0.3
SoilParticleAggregate.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/PrimaryActiveZone.h
>
20
#include <
agxTerrain/SoilSimulationInterface.h
>
21
#include <
agx/RigidBody.h
>
22
#include <
agx/LockJoint.h
>
23
#include <
agx/Plane.h
>
24
25
namespace
agxTerrain
26
{
27
class
Shovel;
28
class
TerrainToolCollection;
29
class
ActiveZone;
30
class
TerrainMaterial
;
31
32
typedef
agx::Physics::GranularBodyPtr
SoilParticlePtr
;
33
typedef
agx::Physics::GranularBodyPtrVector
SoilParticlePtrVector
;
34
35
AGX_DECLARE_POINTER_TYPES
(
SoilParticleAggregate
);
36
AGX_DECLARE_VECTOR_TYPES
(
SoilParticleAggregate
);
37
38
class
AGXTERRAIN_EXPORT
SoilParticleAggregate
:
public
agx::Referenced
39
{
40
public
:
44
SoilParticleAggregate
();
45
52
const
agx::RigidBody
* getInnerBody()
const
;
53
60
const
agx::RigidBody
* getWedgeBody()
const
;
61
68
const
agxCollide::Geometry
* getInnerGeometry()
const
;
69
76
const
agxCollide::Geometry
* getWedgeGeometry()
const
;
77
85
const
agx::LockJoint
* getLockJoint()
const
;
86
92
void
setMaterial(
agx::Material
* material );
93
97
agx::Material
* getMaterial()
const
;
98
102
agx::Real
getMass()
const
;
103
107
const
SoilParticlePtrVector
& getInnerBodyParticles()
const
;
108
112
const
SoilParticlePtrVector
& getWedgeBodyParticles()
const
;
113
118
void
setLockTranslationalCompliance(
agx::Real
compliance);
119
124
void
setLockRotationalCompliance(
agx::Real
compliance);
125
129
agx::Real
getRigidBodyMassSum()
const
;
130
131
public
:
137
void
addNotification(
agxSDK::Simulation
* simulation,
Terrain
* terrain );
138
144
void
removeNotification(
agxSDK::Simulation
* simulation,
Terrain
* terrain );
145
151
void
onPreCollide(
TerrainToolCollection
* collection );
152
158
void
onPre(
TerrainToolCollection
* collection,
ActiveZone
* activeZone );
159
165
void
onPost(
TerrainToolCollection
* collection );
166
172
void
onEnableChange(
bool
enable );
173
174
static
agx::Plane
transformPlaneToWorld(
const
agx::Frame
* localFrame,
const
agx::Plane
& localPlane);
175
176
protected
:
180
virtual
~
SoilParticleAggregate
();
181
185
agxCollide::Geometry
* _getInnerGeometry()
const
;
186
190
agxCollide::Geometry
* _getWedgeGeometry()
const
;
191
192
private
:
193
agx::HashSet<agx::Vec3i>
calculateWedgeVoxels(
TerrainToolCollection
* collection,
ActiveZone
* activeZone);
194
195
agx::HashSet<agx::Vec3i>
filterWedgeVoxelsSplittingPlane(
TerrainToolCollection
* collection,
196
ActiveZone
* activeZone,
197
const
agx::HashSet<agx::Vec3i>
& wedgeVoxels);
198
199
void
updateDynamicProperties(
const
SoilParticlePtrVector
& soilParticles,
200
agx::RigidBody
* rb,
201
agx::HashSet<agx::Vec3i>
& voxels,
202
TerrainToolCollection
* collection);
203
204
void
synchronizeLockJoint(
TerrainToolCollection
* collection);
205
206
void
computePointsInsideActiveZone(
TerrainToolCollection
* collection,
ActiveZone
* activeZone);
207
208
void
sortParticlesBySeparatingPlane(
Terrain
* terrain,
209
ActiveZone
* activeZone,
210
SoilParticlePtrVector
& innerParticles,
211
SoilParticlePtrVector
& wedgeParticles);
212
213
void
computeParticlesInInnerShape(
PrimaryActiveZone
* activeZone,
SoilParticlePtrVector
& innerParticles);
214
215
SoilParticlePtrVector
computeParticlesInWedgeShape(
ActiveZone
* activeZone,
SoilParticlePtrVector
& wedgeParticleCandidates);
216
217
void
computeParticlesAboveShovel(
TerrainToolCollection
* collection,
agx::Vec3
up,
SoilParticlePtrVector
& wedgeParticles);
218
219
bool
isPointAbovePlane(
const
agx::Plane
& plane,
const
agx::Vec3
& point)
const
;
220
221
bool
isSphereIntersectingPlane(
const
agx::Plane
& plane,
const
agx::Vec3
& point,
agx::Real
radius)
const
;
222
223
void
updateLockJointComplianceFromBulkMaterial(
const
TerrainToolCollection
* collection,
224
agx::LockJoint
* lockJoint);
225
226
private
:
227
agx::RigidBodyRef
m_innerBody;
228
agx::RigidBodyRef
m_wedgeBody;
229
agx::Vec3
m_innerBodyMomentum;
230
agx::Vec3
m_wedgeBodyMomentum;
231
agx::Vec3
m_innerBodyAngularMomentum;
232
agx::Vec3
m_wedgeBodyAngularMomentum;
233
234
SoilParticlePtrVector
m_innerParticles;
235
SoilParticlePtrVector
m_wedgeParticles;
236
237
agx::LockJointRef
m_lock;
238
};
239
240
241
242
inline
bool
SoilParticleAggregate::isPointAbovePlane(
const
agx::Plane
& plane,
const
agx::Vec3
& point)
const
243
{
244
return
plane.
signedDistanceToPoint
(point) > 0;
245
}
246
247
248
249
inline
bool
SoilParticleAggregate::isSphereIntersectingPlane(
const
agx::Plane
& plane,
const
agx::Vec3
& point,
agx::Real
radius)
const
250
{
251
return
std::abs(plane.
signedDistanceToPoint
(point)) < radius;
252
}
253
254
255
256
257
}
agx::Physics::GranularBodyPtr
Pointer to a entity instance of type Physics.GranularBody.
Definition:
GranularBodyEntity.h:190
agxTerrain::Terrain
A terrain model based a 3D grid model with overlapping height field that can be deformed by interacti...
Definition:
agxTerrain/Terrain.h:85
agx::Real
double Real
Definition:
Real.h:42
PrimaryActiveZone.h
agxTerrain::SoilParticlePtr
agx::Physics::GranularBodyPtr SoilParticlePtr
Definition:
SoilParticleAggregate.h:30
agxTerrain
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
Definition:
Geometry.h:59
agx::RigidBody
The rigid body class, combining a geometric model and a frame of reference.
Definition:
RigidBody.h:54
agxTerrain::TerrainMaterial
This class is used to describe the general material properties of the Terrain.
Definition:
TerrainMaterial.h:53
agxTerrain::SoilParticlePtrVector
agx::Physics::GranularBodyPtrVector SoilParticlePtrVector
Definition:
SoilParticleAggregate.h:33
agxTerrain::ActiveZone
Definition:
ActiveZone.h:52
agx::VectorPOD
Vector containing 'raw' data.
Definition:
Vector.h:245
Plane.h
agxTerrain::PrimaryActiveZone
Definition:
PrimaryActiveZone.h:30
agx::PlaneT
Class representing the mathematical concept of a plane, also called a half- space.
Definition:
Plane.h:31
AGX_DECLARE_VECTOR_TYPES
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition:
Vector.h:34
agx::ref_ptr< RigidBody >
agxSDK::Simulation
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition:
Simulation.h:126
SoilSimulationInterface.h
agxCollide::Geometry
The geometry representation used by the collision detection engine.
Definition:
Geometry.h:92
agx::LockJoint
Constraint that removes all 6 DOF between two bodies, or one body and the world.
Definition:
LockJoint.h:28
LockJoint.h
agx::HashSet< agx::Vec3i >
agx::PlaneT::signedDistanceToPoint
T signedDistanceToPoint(const agx::Vec3T< T > &point) const
Calculates the distance from the plane to a point.
Definition:
Plane.h:209
RigidBody.h
agx::Referenced
Base class providing referencing counted objects.
Definition:
Referenced.h:113
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition:
Referenced.h:248
AGXTERRAIN_EXPORT
#define AGXTERRAIN_EXPORT
Definition:
agxTerrain/export.h:41
agxTerrain::TerrainToolCollection
Collection of terrain tool (currently Shovel) related objects which are terrain instance specific.
Definition:
TerrainToolCollection.h:35
agxTerrain::SoilParticleAggregate
Definition:
SoilParticleAggregate.h:38
agx::Material
Main material class which acts as a holder of a Surface Material and a Bulk material.
Definition:
Material.h:387
agx::Vec3T< Real >
agx::Frame
The object defining a frame of reference and providing transformations operations.
Definition:
Frame.h:67
include
agxTerrain
SoilParticleAggregate.h
Generated on Fri Feb 10 2023 14:06:18 for AGXDynamics by
1.8.17