AGX Dynamics  2.37.3.2
agxModel::ParticleCoordinateSystem Class Reference

#include <TerrainUtils.h>

Public Types

enum  DirectionFCC {
  VERTEX_POS, POS_X_NEG_Z, POS_Y_NEG_Z, NEG_X_NEG_Z,
  NEG_Y_NEG_Z, POS_X_POS_Y, NEG_X_POS_Y, NEG_X_NEG_Y,
  POS_X_NEG_Y, POS_X_POS_Z, POS_Y_POS_Z, NEG_X_POS_Z,
  NEG_Y_POS_Z
}
 

Public Member Functions

 ParticleCoordinateSystem ()
 
void collectCloseParticleCoordinates (const size_t &hfX, const size_t &hfY, agx::Vec2iVector &particleCoordinates)
 Given one vertex in the height field (that has changed height for example) we get all surrounding particle positions for those 6 triangles that the vertex is found in. More...
 
void collectCloseParticleLowerXYCoordinatesWithHeight (const agxCollide::HeightField *hf, const size_t &hfX, const size_t &hfY, Vec2iHeightDataPairVector &particleCoordinatesWithHeight, Terrain *terrain)
 Given one vertex in the height field (that has changed height for example) we get all surrounding particle positions for those 6 triangles that the vertex is found in. More...
 
agx::Real findFccHeight (agx::Real heightAtVertexPos, agx::Real dX, agx::Real dY, DirectionFCC fccLocalPos)
 Calculate height of height field fcc position, given x and y derivatives and the height of the middle vertex. More...
 
agx::Real findParticleCoordinateHeight (const size_t pcsX, const size_t pcsY, Terrain *terrain)
 Calculate the height of a particle position. More...
 
agx::Vec2 getHeightFieldPosition (const size_t pcsX, const size_t pcsY, const size_t dX=0, const size_t dY=0)
 Get 2D position on the height field in length units. More...
 
agx::Vec3 getHeightFieldPositionFromFCCIndex (size_t fccIndex, const agx::Real minZ, size_t &pcsX, size_t &pcsY)
 Translates a position in the imaginary FCC 3 dimensional grid to a world position Returns positions in the Particle Coordinate system. More...
 
void getParentHeightFieldVertex (const size_t &pcsX, const size_t &pcsY, size_t &hfX, size_t &hfY)
 To find what hf vertex position For example needed when we need to know which material a particle should get. More...
 
size_t indexForFCCLattice (size_t pcsX, size_t pcsY, size_t pcsZ, DirectionFCC dir)
 hfX, hfY are index in height field. More...
 
agx::Real scaleDepth (const agx::Real &depth, const size_t pcsX, const size_t pcsY, const agx::Vec2 &hf2Dpos)
 Given the changed height (depth) of a height field vertex, we get the height change at the particle coordinate system position. More...
 
void updateResolution (const agx::Real &particleRadius, const size_t &heightFieldResolutionX, const size_t &heightFieldResolutionY, const agx::Real &scale)
 If the particle radius is changed, we must update our resolution for the particle coordinate system. More...
 

Detailed Description

Deprecated:
This class is deprecated and will be removed in a future version of AGX.
See also
agxTerrain::Terrain Making it possible to have arbitrary resolution of the particle grid.

Definition at line 126 of file TerrainUtils.h.

Member Enumeration Documentation

◆ DirectionFCC

Enumerator
VERTEX_POS 
POS_X_NEG_Z 
POS_Y_NEG_Z 
NEG_X_NEG_Z 
NEG_Y_NEG_Z 
POS_X_POS_Y 
NEG_X_POS_Y 
NEG_X_NEG_Y 
POS_X_NEG_Y 
POS_X_POS_Z 
POS_Y_POS_Z 
NEG_X_POS_Z 
NEG_Y_POS_Z 

Definition at line 139 of file TerrainUtils.h.

Constructor & Destructor Documentation

◆ ParticleCoordinateSystem()

agxModel::ParticleCoordinateSystem::ParticleCoordinateSystem ( )
inline

Definition at line 130 of file TerrainUtils.h.

Member Function Documentation

◆ collectCloseParticleCoordinates()

void agxModel::ParticleCoordinateSystem::collectCloseParticleCoordinates ( const size_t &  hfX,
const size_t &  hfY,
agx::Vec2iVector &  particleCoordinates 
)

Given one vertex in the height field (that has changed height for example) we get all surrounding particle positions for those 6 triangles that the vertex is found in.

◆ collectCloseParticleLowerXYCoordinatesWithHeight()

void agxModel::ParticleCoordinateSystem::collectCloseParticleLowerXYCoordinatesWithHeight ( const agxCollide::HeightField *  hf,
const size_t &  hfX,
const size_t &  hfY,
Vec2iHeightDataPairVector &  particleCoordinatesWithHeight,
Terrain *  terrain 
)

Given one vertex in the height field (that has changed height for example) we get all surrounding particle positions for those 6 triangles that the vertex is found in.

Also we get the height of the heightfield at that position

◆ findFccHeight()

agx::Real agxModel::ParticleCoordinateSystem::findFccHeight ( agx::Real  heightAtVertexPos,
agx::Real  dX,
agx::Real  dY,
DirectionFCC  fccLocalPos 
)

Calculate height of height field fcc position, given x and y derivatives and the height of the middle vertex.

◆ findParticleCoordinateHeight()

agx::Real agxModel::ParticleCoordinateSystem::findParticleCoordinateHeight ( const size_t  pcsX,
const size_t  pcsY,
Terrain *  terrain 
)

Calculate the height of a particle position.

◆ getHeightFieldPosition()

agx::Vec2 agxModel::ParticleCoordinateSystem::getHeightFieldPosition ( const size_t  pcsX,
const size_t  pcsY,
const size_t  dX = 0,
const size_t  dY = 0 
)

Get 2D position on the height field in length units.

Given particle coordinate system position. dX and dY are if we are looking for position on fcc position, not on a particle system vertex.

◆ getHeightFieldPositionFromFCCIndex()

agx::Vec3 agxModel::ParticleCoordinateSystem::getHeightFieldPositionFromFCCIndex ( size_t  fccIndex,
const agx::Real  minZ,
size_t &  pcsX,
size_t &  pcsY 
)

Translates a position in the imaginary FCC 3 dimensional grid to a world position Returns positions in the Particle Coordinate system.

◆ getParentHeightFieldVertex()

void agxModel::ParticleCoordinateSystem::getParentHeightFieldVertex ( const size_t &  pcsX,
const size_t &  pcsY,
size_t &  hfX,
size_t &  hfY 
)

To find what hf vertex position For example needed when we need to know which material a particle should get.

◆ indexForFCCLattice()

size_t agxModel::ParticleCoordinateSystem::indexForFCCLattice ( size_t  pcsX,
size_t  pcsY,
size_t  pcsZ,
DirectionFCC  dir 
)

hfX, hfY are index in height field.

Fcc lattice has double resolution, and height information dir is if we refer to the same position as height field vertex or any of the 8 surrounding position

◆ scaleDepth()

agx::Real agxModel::ParticleCoordinateSystem::scaleDepth ( const agx::Real &  depth,
const size_t  pcsX,
const size_t  pcsY,
const agx::Vec2 &  hf2Dpos 
)

Given the changed height (depth) of a height field vertex, we get the height change at the particle coordinate system position.

◆ updateResolution()

void agxModel::ParticleCoordinateSystem::updateResolution ( const agx::Real &  particleRadius,
const size_t &  heightFieldResolutionX,
const size_t &  heightFieldResolutionY,
const agx::Real &  scale 
)

If the particle radius is changed, we must update our resolution for the particle coordinate system.


The documentation for this class was generated from the following file: