AGX Dynamics
2.37.3.2
TerrainParticles.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
#ifndef AGXMODEL_TERRAIN_PARTICLES_H
18
#define AGXMODEL_TERRAIN_PARTICLES_H
19
20
#include <
agxModel/export.h
>
21
22
23
#include <
agxCollide/Contacts.h
>
24
#include <
agx/Material.h
>
25
26
#include <
agxCollide/agxCollide.h
>
27
28
29
#define TERRAIN_USE_PARTICLE_SYSTEM 0
30
31
#if TERRAIN_USE_PARTICLE_SYSTEM
32
#include <
agx/ParticleSystem.h
>
33
#endif
34
35
namespace
agxModel
36
{
37
class
Terrain
;
38
39
typedef
agx::Vec3
ParticleCoordinateHeightData
;
40
41
typedef
agx::Vector< std::pair< agx::Vec2i, ParticleCoordinateHeightData >
>
Vec2iHeightDataPairVector
;
42
43
typedef
agx::Vector< std::pair < agx::Real, size_t >
>
RealSizeTPairVector
;
44
45
typedef
agx::Vector< std::pair<size_t, size_t>
>
SizeTPairVector
;
46
47
typedef
agx::HashVector< size_t, agx::Real >
SizeTRealHashVector
;
48
53
class
AGXMODEL_EXPORT
ParticleAttributes
:
public
agxStream::Serializable
54
{
55
56
public
:
57
61
enum
SoilType
{
62
PARTICLE
,
63
PARTICLE_SYSTEM_PARTICLE
,
64
CONVEX_BODY
65
};
66
67
ParticleAttributes
();
68
72
void
setType(
SoilType
soilType );
73
77
SoilType
getType
( );
78
82
void
setParticleUniqueId(
agx::UInt32
uniqueParticleId );
83
87
agx::UInt32
getParticleUniqueId()
const
;
88
93
void
setParticleYoungsModulusMultiplier(
agx::Real
multiplier);
94
98
agx::Real
getParticleYoungsModulusMultiplier()
const
;
99
103
void
setMergeVelocity(
agx::Real
velocity );
104
108
agx::Real
getMergeVelocity2()
const
;
109
113
agx::Real
getAdhesiveOverlap( )
const
;
114
118
agx::Real
getRadius( )
const
;
119
123
agx::Real
getCoreRadius( )
const
;
124
128
agx::Real
getVolume( )
const
;
129
137
void
setRadius(
agx::Real
radius);
138
145
void
setCoreRadius(
agx::Real
coreRadius );
146
150
bool
getRadiusIsDirty( )
const
;
151
152
AGXSTREAM_DECLARE_SERIALIZABLE
(
agxModel::ParticleAttributes
);
153
154
protected
:
155
friend
class
Terrain
;
156
private
:
157
158
void
setRadiusIsDirty(
bool
dirty );
159
160
SoilType
m_type;
161
agx::Real
m_radius;
162
agx::Real
m_coreRadius;
163
agx::Real
m_mergeVelocity2;
164
bool
m_radiusIsDirty;
165
agx::UInt32
m_uniqueParticleId;
166
agx::Real
m_particleYoungsMultiplier;
167
};
168
174
class
AGXMODEL_EXPORT
SoilParticle
:
public
agx::RigidBody
175
{
176
public
:
177
179
SoilParticle
(
agx::Real
radius,
ParticleAttributes::SoilType
type );
180
184
ParticleAttributes::SoilType
getType
()
const
;
185
189
agx::Real
getRadius( )
const
;
190
194
virtual
agx::Real
getVolume( )
const
;
195
200
void
setParent(
SoilParticle
* parent );
201
205
void
setSeedContact( );
206
210
bool
getSeedContact( )
const
;
211
215
SoilParticle
* getParent( )
const
;
216
220
bool
hasParent()
const
;
221
225
bool
isParent()
const
;
226
227
AGXSTREAM_DECLARE_SERIALIZABLE
(
agxModel::SoilParticle
);
228
229
protected
:
230
SoilParticle
() {}
231
ParticleAttributes::SoilType
m_type
;
232
private
:
233
agx::Real
m_radius;
234
SoilParticle
* m_parent;
//particles
235
bool
m_seedContact;
236
237
};
238
239
typedef
agx::ref_ptr< SoilParticle >
SoilParticleRef
;
240
typedef
agx::observer_ptr< SoilParticle >
SoilParticleObs
;
241
242
class
AGXMODEL_EXPORT
ConvexSoil
:
public
SoilParticle
243
{
244
public
:
248
ConvexSoil
(
const
agx::Vec3Vector
* vertices,
const
agx::UInt32Vector
* indices );
249
253
virtual
agx::Real
getVolume( )
const override
;
254
255
AGXSTREAM_DECLARE_SERIALIZABLE
(
agxModel::ConvexSoil
);
256
protected
:
257
ConvexSoil
() {}
258
private
:
259
260
};
261
262
#if TERRAIN_USE_PARTICLE_SYSTEM
263
typedef
agx::VectorPOD< agx::Physics::ParticlePtr >
SoilParticleObsVector
;
264
typedef
SoilParticleObsVector
SoilParticleRefVector
;
265
typedef
SoilParticleRefVector
SoilParticlePtrVector
;
266
#else
267
typedef
agx::Vector< SoilParticleObs >
SoilParticleObsVector
;
268
typedef
agx::Vector< SoilParticleRef >
SoilParticleRefVector
;
269
typedef
agx::Vector<SoilParticle*>
SoilParticlePtrVector
;
270
#endif
271
272
}
273
274
#endif //AGXMODEL_TERRAIN_PARTICLES_H
agxModel::RealSizeTPairVector
agx::Vector< std::pair< agx::Real, size_t > > RealSizeTPairVector
Definition:
TerrainParticles.h:43
agxData::getType
AGXCORE_EXPORT Type * getType(const agx::String &name)
agxModel::SoilParticleObsVector
agx::Vector< SoilParticleObs > SoilParticleObsVector
Definition:
TerrainParticles.h:267
agxModel::SoilParticle
When converting Terrain to particles, we create SoilParticles.
Definition:
TerrainParticles.h:174
agxModel::SoilParticleRef
agx::ref_ptr< SoilParticle > SoilParticleRef
Definition:
TerrainParticles.h:239
agx::observer_ptr
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
Definition:
observer_ptr.h:60
agxModel::ParticleAttributes
Definition:
TerrainParticles.h:53
Material.h
agxModel::SoilParticlePtrVector
agx::Vector< SoilParticle * > SoilParticlePtrVector
Definition:
TerrainParticles.h:269
agxModel::ParticleAttributes::PARTICLE_SYSTEM_PARTICLE
Definition:
TerrainParticles.h:63
agxCollide.h
agxModel::ParticleAttributes::PARTICLE
Definition:
TerrainParticles.h:62
agxModel::Terrain
Definition:
agxModel/Terrain.h:83
agxModel
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition:
FlowUnit.h:36
agx::HashVector< size_t, agx::Real >
agx::Vector
Templated vector class.
Definition:
Vector.h:52
agxModel::SizeTRealHashVector
agx::HashVector< size_t, agx::Real > SizeTRealHashVector
Definition:
TerrainParticles.h:47
agx::VectorPOD< Vec3 >
agxModel::ParticleCoordinateHeightData
agx::Vec3 ParticleCoordinateHeightData
Definition:
TerrainParticles.h:37
agxModel::ConvexSoil::ConvexSoil
ConvexSoil()
Definition:
TerrainParticles.h:257
agx::ref_ptr
Smart pointer for handling referenced counted objects.
Definition:
ref_ptr.h:29
agxModel::SoilParticle::SoilParticle
SoilParticle()
Definition:
TerrainParticles.h:230
agxModel::ParticleAttributes::SoilType
SoilType
Enum for type of soil.
Definition:
TerrainParticles.h:61
agxModel::SoilParticle::m_type
ParticleAttributes::SoilType m_type
Definition:
TerrainParticles.h:231
agx::RigidBody
The rigid body class, combining a geometric model and a frame of reference.
Definition:
RigidBody.h:54
export.h
agx::Vec3T< Real >
Contacts.h
agxModel::SizeTPairVector
agx::Vector< std::pair< size_t, size_t > > SizeTPairVector
Definition:
TerrainParticles.h:45
agxModel::ConvexSoil
Definition:
TerrainParticles.h:242
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
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
AGXMODEL_EXPORT
#define AGXMODEL_EXPORT
Definition:
agxModel/export.h:42
ParticleSystem.h
agx::Real
double Real
Definition:
Real.h:42
agxModel::SoilParticleRefVector
agx::Vector< SoilParticleRef > SoilParticleRefVector
Definition:
TerrainParticles.h:268
agx::UInt32
uint32_t UInt32
Definition:
Integer.h:40
agxModel::Vec2iHeightDataPairVector
agx::Vector< std::pair< agx::Vec2i, ParticleCoordinateHeightData > > Vec2iHeightDataPairVector
Definition:
TerrainParticles.h:41
agxModel::SoilParticleObs
agx::observer_ptr< SoilParticle > SoilParticleObs
Definition:
TerrainParticles.h:240
include
agxModel
TerrainParticles.h
Generated on Fri Apr 12 2024 12:40:27 for AGX Dynamics by
1.8.13