17 #ifndef AGXMODEL_TERRAIN_DATA_INTERFACE_H
18 #define AGXMODEL_TERRAIN_DATA_INTERFACE_H
40 #define MAX_NUMBER_MATERIALS 256
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
A HeightField is a collision shape that can be created from a grid structure, like an image.
agxCollide::ContactPoint * contactPoint
size_t getLocalVertexIndexWithLargestInfluence() const
agx::Vec2i coordinates[3]
This class implements an interface for how the terrain accesses the data it needs to access data item...
SizeTVector m_materialIndexMap
size_t getMaterialIndex(const size_t x, const size_t y) const
void remove(const agx::Material *material)
Removes a material from the terrain.
void updateCompression(size_t x, size_t y, agx::Real deltaDiggingHeightShrink, agx::Real compressionFromOverlap)
void add(const agx::Material *material, const size_t materialIndex, const agx::Real particleAdhesion=agx::Real(0), const agx::Real deformability=agx::Real(0), agx::Real angleOfRepose=agx::Real(0))
Adds a material to the terrain.
virtual agx::Real calculateYoungsModulus(size_t x, size_t y, agx::Real defaultYoungsModulus, agx::Real deformability, agx::Real localDepth=agx::Real(0)) const
Calculate the YoungsModulus value for a given grid point.
agx::Real m_maxYoungsChangePerTimestepPOW2
size_t getResolutionY() const
agx::Real calculateSurfaceViscosity(agx::Real frictionCoefficient)
agx::ContactMaterialRef createParticleContactMaterial(agxSDK::Simulation *simulation, const agx::Material *mat1, const agx::Material *mat2, const bool adhesiveForce, agx::Real adhesiveOverlap, agx::Real youngsParticleMultiplier, agx::Real surfaceViscosity=agx::Real(0), agx::FrictionModel::SolveType frictionSolveType=agx::FrictionModel::SPLIT)
TerrainDataInterface(const agxCollide::HeightField *heightField, const agx::Material *defaultTerrainMaterial=nullptr)
agx::RigidBody * getParticle()
void setMaxCompressionMultiplier(agx::Real maxCompressionMultiplier)
Set how much harder than default Young's modulus the ground can get by being compressed?
SizeTConstMaterialRefPairTable::const_iterator getMaterialIndexEndIterator() const
Returns end iterator to the materials on this terrain.
bool getData(const agxModel::Terrain *terrain, const agxCollide::ContactPoint &cp, ImpactVolumeData &ivd) const
bool getData(const agxModel::Terrain *terrain, const agx::Vec3 pos, ImpactVolumeData &ivd) const
virtual agx::MaterialRef createParticleMaterial(const agx::Material *material, const agx::Real particleAdhesion)
void createContactMaterials(agxSDK::Simulation *simulation, agx::Real adhesiveOverlap, agx::Real particleYoungsMultiplier)
Create contact materials for everything interacting with particles (including particle-particle conta...
size_t getNumberOfVertices() const
agx::RealVector m_materialIndexToTanOfAngleOfRepose
agx::Real getInverseFrictionMultiplier() const
returns the inverse friction multiplier.
const agx::Material * getParticleMaterial(const size_t materialIndex) const
const agx::Material * getParticleMaterial(const size_t x, const size_t y) const
void updateAvalanceHeatMap(const size_t x, const size_t y, const size_t value)
void disableDynamicHeightFieldParticles(size_t numberOfUsedParticles)
agx::Real m_maxCompressionMultiplier
void tickDownAvalancheHeatMap()
integrate heat map
agx::Real getShovelGroundCuttingForce() const
size_t m_numberOfUsedParticles
agx::RigidBodyRefVector & getDynamicHeightFieldParticles()
void clearImpactVolumeData()
Resets the number of impactVolumeDatas used.
SizeTConstMaterialRefPairTable::const_iterator getMaterialIndexBeginIterator() const
Returns begin iterator to the materials on this terrain.
ConstMaterialRefVector m_externalMaterialsInteractingWithParticles
void setMaxYoungsChangePerTimestep(agx::Real maxScaleOfYoungsOneTimestep)
Due to high velocities we may have deep Terrain penetrations.
void removeExistingParticleParticleContactMaterials(agxSDK::Simulation *simulation)
Clear existing contact materials created for particles.
agx::RealVector m_compression
virtual agx::Real getCompression(size_t x, size_t y) const
void addExternalMaterial(agx::Material *material, agx::Real surfaceViscosity=agx::Real(1E-3))
Add an external material to the terrain.
ImpactVolumeData * getImpactVolumeData(agxCollide::ContactPoint *cp, const Terrain *terrain)
Calculates ImpactVolumeData from a given contact point.
virtual const agx::FrictionModel * calculateContactMaterialProperties(ConstContactMaterialVector &contactMaterials, agx::ContactMaterial &newCM, const agx::Real totalYoungsModulus)
Uses all found contactMaterials for a geometry contact, and creates a temporary contact material.
void setMaterialMapping(const size_t x, const size_t y, const size_t materialIndex)
Maps materials to grid points.
agx::Real getDepthForMaxCompression() const
const agx::Material * getMaterial(const size_t materialIndex) const
agx::Real getPossibleCompression(agx::Real deformability, agx::Real oldCompression, agx::Real maxYoungsMultiplier)
void allocateDynamicHeightFieldParticles(Terrain *terrain)
agx::Real m_shovelGroundCuttingForce
void setShovelGroundCuttingForce(agx::Real force)
When a shovel is cutting through the terrain, the user has the ability to set a minimum force that is...
size_t getVectorIndex(size_t x, size_t y) const
const agx::Material * getMaterial(const size_t x, const size_t y) const
static agx::Real compressionMultiplier(agx::Real deformability, agx::Real compression)
Calculate a multiplier for how much harder the ground gets given a compression and its deformability.
size_t getAvalancheHeatMapValue(const size_t index)
ImpactVolumeDataRefVector m_impactVolumeDataStorage
void setDepthForMaxCompression(agx::Real depthForMaxCompression)
Set the depth for maximum compression.
agx::RigidBodyRefVector m_dynamicHeightFieldParticles
void updateAvalanceHeatMap(const size_t vectorIndex, const size_t value)
Set the number of time steps left for avalanches at a vertex.
virtual void setCompression(size_t x, size_t y, const agx::Real val)
Set the compression at a specified grid point (x,y)
bool getMaterialsAreDirty() const
returns true if DEFORMABILITY or YOUNGS_SCALER has been set
void setInverseFrictionMultiplier(agx::Real inverseFrictionMultiplier)
Set the inverse friction multiplier.
void regretParticleFromBack(size_t indexFromBack)
SizeTVector m_avalancheHeatMap
virtual void setMaterialMapping(const std::string &filePath)
Maps materials to grid points.
void getCoordinates(size_t i, int &x, int &y) const
Get the x,y coordinate of the i:th point in the grid (starting from 0,0)
agx::Real m_inverseFrictionMultiplier
void setParticleFrictionSolveType(agx::FrictionModel::SolveType solveType)
Set the solve type of the particles when they interact with each other.
virtual ~TerrainDataInterface()
agx::RealVector m_externalMaterialSurfaceViscosity
agx::Real m_depthForMaxCompression
agx::RealVector m_materialIndexToDeformability
virtual agx::Real scaleDeformation(agx::Real lastDeformation, agx::Real deformability) const
2^( 1 + lastDeformation * deformability ) = newYoungs / lastYoungs we have set maxvalue of RHS
bool getTriangleIndexPoints(const Terrain *terrain, const agx::Vec3 point, ImpactVolumeData &ivd) const
SizeTConstMaterialRefPairTable m_indexToMaterial
bool collectNearbyVertices(const Terrain *terrain, ImpactVolumeData &ivd) const
agx::Real getMaxCompressionMultiplier() const
size_t getAvalancheHeatMapSize()
agx::Real getDeformability(const size_t x, const size_t y) const
agx::Real getTanOfTheAngleOfRepose(const size_t x, const size_t y) const
void getCoordinates(size_t i, size_t &x, size_t &y) const
Get the x,y coordinate of the i:th point in the grid (starting from 0,0)
size_t m_numberOfUsedImpactVolumes
size_t getResolutionX() const
agx::FrictionModel::SolveType getParticleFrictionSolveType() const
void setCompression(agx::Real val)
Set the deformation at all grid points.
agx::FrictionModel::SolveType m_particleFrictionSolveType
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Base class for all friction models with interface and some utility/necessary methods implemented.
@ SPLIT
First Normal equation is calculated in the DIRECT solver, then in a second pass the normal and the fr...
Inheritance with partial specialization due to bug with ref_ptr containers.
Main material class which acts as a holder of a Surface Material and a Bulk material.
Base class providing referencing counted objects.
The rigid body class, combining a geometric model and a frame of reference.
Smart pointer for handling referenced counted objects.
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.
agx::ref_ptr< TerrainDataInterface > TerrainDataInterfaceRef
agx::Vector< const agx::ContactMaterial * > ConstContactMaterialVector
agx::ref_ptr< ImpactVolumeData > ImpactVolumeDataRef
std::pair< agx::ref_ptr< const agx::Material >, agx::ref_ptr< const agx::Material > > ConstMaterialRefPair
agx::Vector< size_t > SizeTVector
agx::HashTable< size_t, ConstMaterialRefPair > SizeTConstMaterialRefPairTable
agx::Vector< ImpactVolumeDataRef > ImpactVolumeDataRefVector
agx::Vector< agx::ref_ptr< const agx::Material > > ConstMaterialRefVector
agx::Vector< ImpactVolumeData * > ImpactVolumeDataPtrVector
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...