AGX Dynamics  2.37.3.2
agxTerrain::ColumnHeightGrid Class Reference

Class implementing the BasicGrid interface. More...

#include <ColumnHeightGrid.h>

+ Inheritance diagram for agxTerrain::ColumnHeightGrid:

Public Types

using GridData = agx::Vector< agx::Vector< std::pair< int, float > >>
 
- Public Types inherited from agxTerrain::BasicGrid
using GridCoord = agx::Vec3i
 
using GridCoordVector = agx::VectorPOD< GridCoord >
 
using GridFunction = std::function< void(GridCoord, float)>
 

Public Member Functions

 ColumnHeightGrid (const float defaultValue, const size_t resolutionX, const size_t resolutionY, const agx::Int depth, agx::Real voxelSize)
 
 ~ColumnHeightGrid ()
 
virtual void clearGrid () override
 Clear the grid. More...
 
virtual bool empty () override
 Test if the trid is empty. More...
 
virtual agx::HashSet< agx::Vec3i > findConvexVoxelIntersections (const agx::AffineMatrix4x4 &gridTransform, const agxCollide::Convex *convex, agx::Real voxelSize) override
 
virtual agx::HashSet< agx::Vec3i > findGeometryVoxelIntersections (const agx::AffineMatrix4x4 &gridTransform, const agxCollide::Geometry *geometry, agx::Real voxelSize, bool=true) const override
 Find which voxels that overlap with a geometry. More...
 
virtual bool findMeshVoxelIntersections (const agx::AffineMatrix4x4 &gridTransform, const agxCollide::Mesh *mesh, agx::Real voxelSize, agx::Vec3iVector &result) override
 
virtual agx::HashSet< agx::Vec3i > findVoxelsAboveTriangles (const agx::AffineMatrix4x4 &gridTransform, const TriangleVector &triangles, agx::Real voxelSize, agx::Real margin) override
 
virtual agx::Vec3iVector findVoxelsInLine (const agx::Line &gridLine) const override
 
virtual void findVoxelSurfaceFromIndex (const agx::Vec3i &index, agx::Vec3i &result) override
 
virtual GridCoordVector getActiveVoxelIndices () const override
 
agxCollide::BoundingAABB getBoundingBox () const override
 
const char * getClassName () const override
 
int getDepth () const
 
virtual agx::Vec3 getElementSize () const override
 Get the element size used for the voxel grid. More...
 
virtual float getFloatValue (const GridCoord &ijk) const override
 Return value for voxel ijk. More...
 
virtual size_t getMemoryUsage () const override
 Get the memory usage. More...
 
virtual size_t getNumActiveVoxels () const override
 Return number of active voxels in the data structure. More...
 
agx::Vec2i getResolution ()
 
agxStream::StorageAgent * getStorageAgent () const override
 
int getSurfaceHeightIndex (const agx::Vec2i terrainIndex)
 
virtual agx::Real getTotal () const override
 Returns the sum of all voxel values. More...
 
virtual std::tuple< float, float > getTotalAndLargest () const override
 
std::pair< int, float > getVoxelZAndOccupancyFromLocalHeight (agx::Real height, agx::Real voxelSize)
 
virtual bool hasIterateSupport () const override
 
virtual bool isActiveVoxel (const GridCoord &) const override
 Test if voxel ijk is active. More...
 
virtual void iterateVoxels (GridFunction func) const override
 
virtual ActiveZoneIntersectionData removeVolumeInActiveZone (const agx::AffineMatrix4x4 &gridTransformation, const ActiveZoneShapes &activeZoneShapes, const MeshIntersectionTestData &innerShape, const agx::Plane &innerShapeBoundary, const agx::Bound3 &activeZoneGeometryBound, const agx::Vec3iVector voxelsInPrimaryActiveZoneLastTimeStep, std::function< float(const agx::Vec3i &)> getCompression, std::function< bool(const agx::Vec2i &)> canRemoveIndex, agx::Real voxelSize, agx::Real minOccupancyRemoval, agx::Real minAllowedHeight, bool useParticleFreeDeformers) override
 
virtual ActiveZoneIntersectionData removeVolumeInShape (const agx::AffineMatrix4x4 &gridTransformation, const ShapeIntersectionTestData &shape, std::function< float(const agx::Vec3i &)> getCompression, std::function< bool(const agx::Vec2i &)> canRemoveIndex, std::function< bool(const agx::Vec3 &, const agx::Vec3i &)> isWithinBoundry, agx::Real voxelSize, agx::Real minOccupancyRemoval, agx::Real minAllowedHeight) override
 
virtual void restore (agxStream::InputArchive &in) override
 
virtual void setFloatValue (const GridCoord &ijk, float value) override
 Set value for voxel ijk. More...
 
void setGridColumnOccupancy (const agx::Vec2i terrainIndex, int voxelZ, float occupancy)
 
void setOccupancyInSurfaceVoxel (const agx::Vec2i terrainIndex, float occupancy)
 
virtual void setValuesBelowHeightField (const agxCollide::HeightField *heightField, agx::Real voxelSize, int lowestAllowedVoxelIndex, BasicGrid *compactionGrid) override
 
virtual void sizeHint (size_t) override
 Provide the implementation with a hint about the estimated number of voxels that are needed. More...
 
virtual void store (agxStream::OutputArchive &out) const override
 
- Public Member Functions inherited from agxTerrain::Grid
 AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE (agxTerrain::Grid)
 
- Public Member Functions inherited from agxTerrain::BasicGrid
 AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE (agxTerrain::BasicGrid)
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor. More...
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting. More...
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match. More...
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test. More...
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object. More...
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings. More...
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object. More...
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object. More...
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive. More...
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object. More...
 

Static Public Member Functions

static agxStream::Serializable * create ()
 
static agxStream::Serializable * create (agxStream::InputArchive &)
 
static const char * getConstructClassId ()
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Public Member Functions inherited from agxStream::Serializable
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled. More...
 

Protected Member Functions

 ColumnHeightGrid ()
 
void allocateMassArray ()
 
agx::Vec3 getGridPositionFromVoxelIndex (const agx::Vec3i &voxelIndex, agx::Real voxelSize) const
 
agx::Vec3i getVoxelIndexFromGridPosition (agx::Vec3 position, agx::Real voxelSize) const
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor. More...
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor. More...
 
 Serializable (const Serializable &other)
 Copy constructor. More...
 
void generateUuid ()
 

Additional Inherited Members

- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More...
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

Class implementing the BasicGrid interface.

Definition at line 27 of file ColumnHeightGrid.h.

Member Typedef Documentation

◆ GridData

Definition at line 32 of file ColumnHeightGrid.h.

Constructor & Destructor Documentation

◆ ColumnHeightGrid() [1/2]

agxTerrain::ColumnHeightGrid::ColumnHeightGrid ( const float  defaultValue,
const size_t  resolutionX,
const size_t  resolutionY,
const agx::Int  depth,
agx::Real  voxelSize 
)

◆ ~ColumnHeightGrid()

agxTerrain::ColumnHeightGrid::~ColumnHeightGrid ( )

◆ ColumnHeightGrid() [2/2]

agxTerrain::ColumnHeightGrid::ColumnHeightGrid ( )
protected

Member Function Documentation

◆ allocateMassArray()

void agxTerrain::ColumnHeightGrid::allocateMassArray ( )
protected

◆ clearGrid()

virtual void agxTerrain::ColumnHeightGrid::clearGrid ( )
overridevirtual

Clear the grid.

Implements agxTerrain::BasicGrid.

◆ create() [1/2]

static agxStream::Serializable* agxTerrain::ColumnHeightGrid::create ( agxStream::InputArchive &  )
inlinestatic

Definition at line 143 of file ColumnHeightGrid.h.

◆ create() [2/2]

static agxStream::Serializable* agxTerrain::ColumnHeightGrid::create ( )
inlinestatic

Definition at line 143 of file ColumnHeightGrid.h.

◆ empty()

virtual bool agxTerrain::ColumnHeightGrid::empty ( )
overridevirtual

Test if the trid is empty.

Implements agxTerrain::BasicGrid.

◆ findConvexVoxelIntersections()

virtual agx::HashSet<agx::Vec3i> agxTerrain::ColumnHeightGrid::findConvexVoxelIntersections ( const agx::AffineMatrix4x4 &  gridTransform,
const agxCollide::Convex *  convex,
agx::Real  voxelSize 
)
overridevirtual

Implements agxTerrain::Grid.

◆ findGeometryVoxelIntersections()

virtual agx::HashSet<agx::Vec3i> agxTerrain::ColumnHeightGrid::findGeometryVoxelIntersections ( const agx::AffineMatrix4x4 &  gridTransform,
const agxCollide::Geometry *  geometry,
agx::Real  voxelSize,
bool  onlyOccupiedVoxels = true 
) const
overridevirtual

Find which voxels that overlap with a geometry.

Implements agxTerrain::BasicGrid.

◆ findMeshVoxelIntersections()

virtual bool agxTerrain::ColumnHeightGrid::findMeshVoxelIntersections ( const agx::AffineMatrix4x4 &  gridTransform,
const agxCollide::Mesh *  mesh,
agx::Real  voxelSize,
agx::Vec3iVector &  result 
)
overridevirtual

Implements agxTerrain::Grid.

◆ findVoxelsAboveTriangles()

virtual agx::HashSet<agx::Vec3i> agxTerrain::ColumnHeightGrid::findVoxelsAboveTriangles ( const agx::AffineMatrix4x4 &  gridTransform,
const TriangleVector &  triangles,
agx::Real  voxelSize,
agx::Real  margin 
)
overridevirtual

Implements agxTerrain::Grid.

◆ findVoxelsInLine()

virtual agx::Vec3iVector agxTerrain::ColumnHeightGrid::findVoxelsInLine ( const agx::Line &  gridLine) const
overridevirtual

Implements agxTerrain::Grid.

◆ findVoxelSurfaceFromIndex()

virtual void agxTerrain::ColumnHeightGrid::findVoxelSurfaceFromIndex ( const agx::Vec3i &  index,
agx::Vec3i &  result 
)
overridevirtual

Implements agxTerrain::Grid.

◆ getActiveVoxelIndices()

virtual GridCoordVector agxTerrain::ColumnHeightGrid::getActiveVoxelIndices ( ) const
overridevirtual

Implements agxTerrain::BasicGrid.

◆ getBoundingBox()

agxCollide::BoundingAABB agxTerrain::ColumnHeightGrid::getBoundingBox ( ) const
overridevirtual

Implements agxTerrain::Grid.

◆ getClassName()

const char* agxTerrain::ColumnHeightGrid::getClassName ( ) const
inlineoverridevirtual
Returns
the class name of this class.

Reimplemented from agxStream::Serializable.

Definition at line 143 of file ColumnHeightGrid.h.

◆ getConstructClassId()

static const char* agxTerrain::ColumnHeightGrid::getConstructClassId ( )
inlinestatic

Definition at line 143 of file ColumnHeightGrid.h.

◆ getDepth()

int agxTerrain::ColumnHeightGrid::getDepth ( ) const
Returns
the maximum allowable voxel index depth that the ColumnHeightGrid has.

◆ getElementSize()

virtual agx::Vec3 agxTerrain::ColumnHeightGrid::getElementSize ( ) const
overridevirtual

Get the element size used for the voxel grid.

Implements agxTerrain::BasicGrid.

◆ getFloatValue()

virtual float agxTerrain::ColumnHeightGrid::getFloatValue ( const GridCoord &  ijk) const
overridevirtual

Return value for voxel ijk.

Implements agxTerrain::BasicGrid.

◆ getGridPositionFromVoxelIndex()

agx::Vec3 agxTerrain::ColumnHeightGrid::getGridPositionFromVoxelIndex ( const agx::Vec3i &  voxelIndex,
agx::Real  voxelSize 
) const
protected

◆ getMemoryUsage()

virtual size_t agxTerrain::ColumnHeightGrid::getMemoryUsage ( ) const
overridevirtual

Get the memory usage.

Implements agxTerrain::BasicGrid.

◆ getNumActiveVoxels()

virtual size_t agxTerrain::ColumnHeightGrid::getNumActiveVoxels ( ) const
overridevirtual

Return number of active voxels in the data structure.

Implements agxTerrain::BasicGrid.

◆ getResolution()

agx::Vec2i agxTerrain::ColumnHeightGrid::getResolution ( )

◆ getStorageAgent()

agxStream::StorageAgent* agxTerrain::ColumnHeightGrid::getStorageAgent ( ) const
inlineoverridevirtual
Returns
the storage agent

Implements agxStream::Serializable.

Definition at line 143 of file ColumnHeightGrid.h.

◆ getSurfaceHeightIndex()

int agxTerrain::ColumnHeightGrid::getSurfaceHeightIndex ( const agx::Vec2i  terrainIndex)

◆ getTotal()

virtual agx::Real agxTerrain::ColumnHeightGrid::getTotal ( ) const
overridevirtual

Returns the sum of all voxel values.

Implements agxTerrain::BasicGrid.

◆ getTotalAndLargest()

virtual std::tuple<float, float> agxTerrain::ColumnHeightGrid::getTotalAndLargest ( ) const
overridevirtual

Implements agxTerrain::BasicGrid.

◆ getVoxelIndexFromGridPosition()

agx::Vec3i agxTerrain::ColumnHeightGrid::getVoxelIndexFromGridPosition ( agx::Vec3  position,
agx::Real  voxelSize 
) const
protected

◆ getVoxelZAndOccupancyFromLocalHeight()

std::pair<int, float> agxTerrain::ColumnHeightGrid::getVoxelZAndOccupancyFromLocalHeight ( agx::Real  height,
agx::Real  voxelSize 
)

◆ hasIterateSupport()

virtual bool agxTerrain::ColumnHeightGrid::hasIterateSupport ( ) const
overridevirtual

Reimplemented from agxTerrain::BasicGrid.

◆ isActiveVoxel()

virtual bool agxTerrain::ColumnHeightGrid::isActiveVoxel ( const GridCoord &  ) const
overridevirtual

Test if voxel ijk is active.

Implements agxTerrain::BasicGrid.

◆ iterateVoxels()

virtual void agxTerrain::ColumnHeightGrid::iterateVoxels ( GridFunction  func) const
overridevirtual

Reimplemented from agxTerrain::BasicGrid.

◆ removeVolumeInActiveZone()

virtual ActiveZoneIntersectionData agxTerrain::ColumnHeightGrid::removeVolumeInActiveZone ( const agx::AffineMatrix4x4 &  gridTransformation,
const ActiveZoneShapes &  activeZoneShapes,
const MeshIntersectionTestData &  innerShape,
const agx::Plane &  innerShapeBoundary,
const agx::Bound3 &  activeZoneGeometryBound,
const agx::Vec3iVector  voxelsInPrimaryActiveZoneLastTimeStep,
std::function< float(const agx::Vec3i &)>  getCompression,
std::function< bool(const agx::Vec2i &)>  canRemoveIndex,
agx::Real  voxelSize,
agx::Real  minOccupancyRemoval,
agx::Real  minAllowedHeight,
bool  useParticleFreeDeformers 
)
overridevirtual

Implements agxTerrain::Grid.

◆ removeVolumeInShape()

virtual ActiveZoneIntersectionData agxTerrain::ColumnHeightGrid::removeVolumeInShape ( const agx::AffineMatrix4x4 &  gridTransformation,
const ShapeIntersectionTestData &  shape,
std::function< float(const agx::Vec3i &)>  getCompression,
std::function< bool(const agx::Vec2i &)>  canRemoveIndex,
std::function< bool(const agx::Vec3 &, const agx::Vec3i &)>  isWithinBoundry,
agx::Real  voxelSize,
agx::Real  minOccupancyRemoval,
agx::Real  minAllowedHeight 
)
overridevirtual

Implements agxTerrain::Grid.

◆ restore()

virtual void agxTerrain::ColumnHeightGrid::restore ( agxStream::InputArchive &  in)
overridevirtual

Implements agxTerrain::BasicGrid.

◆ setFloatValue()

virtual void agxTerrain::ColumnHeightGrid::setFloatValue ( const GridCoord &  ijk,
float  value 
)
overridevirtual

Set value for voxel ijk.

Implements agxTerrain::BasicGrid.

◆ setGridColumnOccupancy()

void agxTerrain::ColumnHeightGrid::setGridColumnOccupancy ( const agx::Vec2i  terrainIndex,
int  voxelZ,
float  occupancy 
)

◆ setOccupancyInSurfaceVoxel()

void agxTerrain::ColumnHeightGrid::setOccupancyInSurfaceVoxel ( const agx::Vec2i  terrainIndex,
float  occupancy 
)

◆ setValuesBelowHeightField()

virtual void agxTerrain::ColumnHeightGrid::setValuesBelowHeightField ( const agxCollide::HeightField *  heightField,
agx::Real  voxelSize,
int  lowestAllowedVoxelIndex,
BasicGrid *  compactionGrid 
)
overridevirtual

Implements agxTerrain::Grid.

◆ sizeHint()

virtual void agxTerrain::ColumnHeightGrid::sizeHint ( size_t  )
overridevirtual

Provide the implementation with a hint about the estimated number of voxels that are needed.

Reimplemented from agxTerrain::BasicGrid.

◆ store()

virtual void agxTerrain::ColumnHeightGrid::store ( agxStream::OutputArchive &  out) const
overridevirtual

Implements agxTerrain::BasicGrid.


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