AGX Dynamics  2.35.0.1
agxTerrain::HashVoxelGrid Class Reference

Class implementing the BasicGrid interface. More...

#include <HashVoxelGrid.h>

+ Inheritance diagram for agxTerrain::HashVoxelGrid:

Public Types

using VoxelHashType = agx::HashTable< agx::Vec3i, 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

 HashVoxelGrid (float defaultValue, agx::Real voxelSize)
 
 ~HashVoxelGrid ()
 
virtual void clearGrid () override
 Clear the grid. More...
 
virtual bool empty () override
 Test if the trid is empty. More...
 
virtual agx::HashSet< agx::Vec3i > findGeometryVoxelIntersections (const agx::AffineMatrix4x4 &gridTransform, const agxCollide::Geometry *geometry, agx::Real voxelSize, bool onlyOccupiedVoxels=true) const override
 Find which voxels that overlap with a geometry. More...
 
virtual GridCoordVector getActiveVoxelIndices () const override
 
const char * getClassName () const override
 
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...
 
agxStream::StorageAgent * getStorageAgent () const override
 
virtual agx::Real getTotal () const override
 Returns the sum of all voxel values. More...
 
virtual std::tuple< float, float > getTotalAndLargest () const override
 
virtual bool hasIterateSupport () const override
 
virtual bool isActiveVoxel (const GridCoord &ijk) const override
 Test if voxel ijk is active. More...
 
virtual void iterateVoxels (GridFunction) const override
 
virtual void restore (agxStream::InputArchive &in) override
 
virtual void setFloatValue (const GridCoord &ijk, float value) override
 Set value for voxel ijk. More...
 
virtual void sizeHint (size_t hint) 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::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

 HashVoxelGrid ()
 
- 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 HashVoxelGrid.h.

Member Typedef Documentation

◆ VoxelHashType

Constructor & Destructor Documentation

◆ HashVoxelGrid() [1/2]

agxTerrain::HashVoxelGrid::HashVoxelGrid ( float  defaultValue,
agx::Real  voxelSize 
)

◆ ~HashVoxelGrid()

agxTerrain::HashVoxelGrid::~HashVoxelGrid ( )

◆ HashVoxelGrid() [2/2]

agxTerrain::HashVoxelGrid::HashVoxelGrid ( )
protected

Member Function Documentation

◆ clearGrid()

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

Clear the grid.

Implements agxTerrain::BasicGrid.

◆ create() [1/2]

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

Definition at line 70 of file HashVoxelGrid.h.

◆ create() [2/2]

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

Definition at line 70 of file HashVoxelGrid.h.

◆ empty()

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

Test if the trid is empty.

Implements agxTerrain::BasicGrid.

◆ findGeometryVoxelIntersections()

virtual agx::HashSet<agx::Vec3i> agxTerrain::HashVoxelGrid::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.

◆ getActiveVoxelIndices()

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

Implements agxTerrain::BasicGrid.

◆ getClassName()

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

Reimplemented from agxStream::Serializable.

Definition at line 70 of file HashVoxelGrid.h.

◆ getConstructClassId()

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

Definition at line 70 of file HashVoxelGrid.h.

◆ getElementSize()

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

Get the element size used for the voxel grid.

Implements agxTerrain::BasicGrid.

◆ getFloatValue()

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

Return value for voxel ijk.

Implements agxTerrain::BasicGrid.

◆ getMemoryUsage()

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

Get the memory usage.

Implements agxTerrain::BasicGrid.

◆ getNumActiveVoxels()

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

Return number of active voxels in the data structure.

Implements agxTerrain::BasicGrid.

◆ getStorageAgent()

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

Implements agxStream::Serializable.

Definition at line 70 of file HashVoxelGrid.h.

◆ getTotal()

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

Returns the sum of all voxel values.

Implements agxTerrain::BasicGrid.

◆ getTotalAndLargest()

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

Implements agxTerrain::BasicGrid.

◆ hasIterateSupport()

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

Reimplemented from agxTerrain::BasicGrid.

◆ isActiveVoxel()

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

Test if voxel ijk is active.

Implements agxTerrain::BasicGrid.

◆ iterateVoxels()

virtual void agxTerrain::HashVoxelGrid::iterateVoxels ( GridFunction  ) const
overridevirtual

Reimplemented from agxTerrain::BasicGrid.

◆ restore()

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

Implements agxTerrain::BasicGrid.

◆ setFloatValue()

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

Set value for voxel ijk.

Implements agxTerrain::BasicGrid.

◆ sizeHint()

virtual void agxTerrain::HashVoxelGrid::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::HashVoxelGrid::store ( agxStream::OutputArchive &  out) const
overridevirtual

Implements agxTerrain::BasicGrid.


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