17 #ifndef AGXMODEL_TERRAIN_H 18 #define AGXMODEL_TERRAIN_H 111 agx::Real getMaximumParticleRadius()
const;
116 void setDynamicHeightFieldCutOffVelocity(
agx::Real cutOffVelocity );
121 agx::Real getDynamicHeightFieldCutOffVelocity()
const;
126 void setDynamicHeightFieldCutOffAngularVelocity(
agx::Real cutOffAngularVelocity );
130 agx::Real getDynamicHeightFieldCutOffAngularVelocity()
const;
133 #if TERRAIN_USE_PARTICLE_SYSTEM 149 void setEnableDynamicHeightField(
bool enable );
154 bool getEnableDynamicHeightField()
const;
169 void setEnableLockedBorders(
bool enable,
bool triggerAvalancheMassLoss =
true );
178 void setVerticalYoungsModulusAreaScaler(
agx::Real scaler );
183 agx::Real getVerticalYoungsModulusAreaScaler()
const;
193 void setHorizontalYoungsModulusAreaScaler(
agx::Real scaler );
198 agx::Real getHorizontalYoungsModulusAreaScaler()
const;
204 void avalancheAll(
size_t iterations );
213 void setWetnessScale(
agx::Real wetnessScaler );
226 void setAvalancheDecayPercent(
agx::Real scaler );
231 agx::Real getAvalancheDecayPercent()
const;
236 void setAvalancheStepLifeTime(
size_t numSteps );
241 size_t getAvalancheStepLifeTime()
const;
246 void setAvalancheVertexDistanceExtent(
size_t numVertices );
251 size_t getAvalancheVertexDistanceExtent()
const;
259 void setShovelMinimumDigAngleToHorizontalPlane(
agx::Real angle );
264 agx::Real getShovelMinimumDigAngleToHorizontalPlane()
const;
292 agx::Real getDynamicHeightFieldParticleRadius()
const;
312 #if TERRAIN_USE_PARTICLE_SYSTEM 349 virtual void addNotification()
override;
354 virtual void removeNotification()
override;
356 #if defined(USE_SOIL_PARTICLE_SIMULATION) && USE_SOIL_PARTICLE_SIMULATION == 1 360 SoilParticleSimulation* getParticleSimulation();
389 agx::Vec3 inHfPlaneOrthoVector = inHfPlaneVector - (inHfPlaneVector*normal) * normal;
393 agx::Real percentOfActual = inHfPlaneOrthoVector[variable]/inHfPlaneOrthoVector[variable];
395 agx::Real actualHeight = inHfPlaneOrthoVector.
z() / percentOfActual;
402 agx::Real planePosAtCoordinates = getHeight(hfPos.
x(), hfPos.
y());
403 return hfPos.
z() > (planePosAtCoordinates + particleRadius);
408 void prepareForContactModification();
416 void createTerrain();
420 void replaceDynamicHeightFieldParticles();
430 void createProjectedGeometryContact(
432 const agx::Vec3 gravityDirection,
const bool inGravityDirection,
const bool useGravityDepth);
439 #if TERRAIN_USE_PARTICLE_SYSTEM 442 bool validateParticleToMerge(
SoilParticle* particle)
const;
453 void resetNoGrowIndices();
455 void updateAvalanceIndices(
size_t minX,
size_t maxX,
size_t minY,
size_t maxY);
467 void spreadAvalanche(
size_t indexHF,
const size_t vertexDistance );
481 bool isInsideNonMergeArea(
agx::Vec2i* coordinates );
486 bool isInsideNonMergeArea(
agx::Vec2i& coordinates );
503 #if TERRAIN_USE_PARTICLE_SYSTEM 509 void addGeometryContactsForAddedParticles(
SizeTPairVector& bodyIndexContactPairs,
511 size_t localX,
size_t localY,
const size_t sizeX,
const size_t sizeY
523 void mergeParticles();
528 void collectContacts();
533 void clearContacts();
563 agx::Real calculateVolumeDiffAroundOneVertex(
size_t vectorIndex,
agx::Real compression = 0 );
576 size_t accumulateVerticesX(
agx::Vec3& meanPos,
agx::Vec3Vector& vertices,
agx::Vector<agx::RangeReal>& localChangedHeights,
const size_t minX,
const size_t minY,
const size_t sizeX,
const size_t sizeY,
const size_t localX,
const size_t localY,
const size_t maxNum);
600 bool isVisited(
const size_t vertexIndex )
const;
605 void setVisited(
const size_t vertexIndex );
610 void enqueueNeighbors( std::queue<size_t>& queue,
int x,
int y );
612 void updateTempCompression(
const size_t vertexIndex,
agx::Real deltaCompression);
613 void setTempCompression(
const size_t vertexIndex ,
agx::Real compression);
614 agx::Real getTempCompression(
const size_t vertexIndex)
const;
616 void notifyModifiedIndex(
const size_t x,
const size_t y,
const size_t currentIndex,
agx::Real& depth);
641 void setModifiedIndex(
size_t x,
size_t y );
655 bool m_useDynamicHeightField;
658 agx::Real m_verticalYoungsModulusAreaScaler;
659 agx::Real m_horizontalYoungsModulusAreaScaler;
666 size_t m_avalancheStepLifeTime;
667 size_t m_avalanceVertexDistanceExtent;
672 agx::Real m_shovelMinAngleToHorizontalPlane;
677 #if defined(USE_SOIL_PARTICLE_SIMULATION) && USE_SOIL_PARTICLE_SIMULATION == 1 690 #if TERRAIN_USE_PARTICLE_SYSTEM 712 size_t m_particlesLost;
Vec3T< Real > Vec3
The object holding 3 dimensional vectors and providing basic arithmetic.
Inheritance with partial specialization due to bug with ref_ptr containers.
When converting Terrain to particles, we create SoilParticles.
Derive from this class to implement a listener for simulation step events.
This namespace consists of a set of classes for handling geometric intersection tests including boole...
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
The geometry representation used by the collision detection engine.
A basic particle system that contains all the storages and buffers required for basic operation and a...
Vector containing 'raw' data.
The rigid body class, combining a geometric model and a frame of reference.
Main material class which acts as a holder of a Surface Material and a Bulk material.
This class implements an interface for how the terrain accesses the data it needs to access data item...
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
static agx::Vec3 transformVectorToWorld(const agx::Vec3 &v, const agxCollide::Geometry *g)
Transforms a vector given in shape coordinates to world coordinates given geometry g...
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
agx::ref_ptr< Terrain > TerrainRef
AGXPHYSICS_EXPORT agx::Bool equalsZero(const agx::AddedMassInteraction::Matrix6x6 &matrix, agx::Real eps=agx::RealEpsilon)
static agx::Vec3 transformPointToWorld(const agx::Vec3 &p, const agxCollide::Geometry *g)
Transforms a point given in shape coordinates to world given geometry g.
Pointer to a entity instance of type Physics.Particle.
A HeightField is a collision shape that can be created from a grid structure, like an image...