AGX Dynamics 2.42.1.1
Loading...
Searching...
No Matches
agxTerrain::BasicGrid Class Referenceabstract

Pure virtual interface class for the data storage grid classes we have. More...

#include <Grid.h>

+ Inheritance diagram for agxTerrain::BasicGrid:

Public Types

using GridCoord = agx::Vec3i
 
using GridCoordVector = agx::VectorPOD< GridCoord >
 
using GridFunction = std::function< void(GridCoord, float)>
 

Public Member Functions

 AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE (agxTerrain::BasicGrid)
 
virtual void clearGrid ()=0
 Clear the grid.
 
virtual bool empty ()=0
 Test if the trid is empty.
 
virtual agx::HashSet< agx::Vec3ifindGeometryVoxelIntersections (const agx::AffineMatrix4x4 &gridTransform, const agxCollide::Geometry *geometry, agx::Real voxelSize, bool onlyOccupiedVoxels=true, bool onlyMidPoint=false) const =0
 Find which voxels that overlap with a geometry.
 
virtual GridCoordVector getActiveVoxelIndices () const =0
 
virtual agx::Vec3 getElementSize () const =0
 Get the element size used for the voxel grid.
 
virtual float getFloatValue (const GridCoord &ijk) const =0
 Return value for voxel ijk.
 
virtual size_t getMemoryUsage () const =0
 Get the memory usage.
 
virtual size_t getNumActiveVoxels () const =0
 Return number of active voxels in the data structure.
 
virtual agx::Real getTotal () const =0
 Returns the sum of all voxel values.
 
virtual std::tuple< float, float > getTotalAndLargest () const =0
 
virtual bool hasIterateSupport () const
 
virtual bool isActiveVoxel (const GridCoord &) const =0
 Test if voxel ijk is active.
 
virtual void iterateVoxels (GridFunction) const
 
void restore (agxStream::InputArchive &in) override=0
 
virtual void setFloatValue (const GridCoord &ijk, float value)=0
 Set value for voxel ijk.
 
virtual void sizeHint (size_t)
 Provide the implementation with a hint about the estimated number of voxels that are needed.
 
void store (agxStream::OutputArchive &out) const override=0
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referencedoperator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings.
 
virtual const char * getClassName () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object.
 
virtual StorageAgent * getStorageAgent () const =0
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object.
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object.
 

Protected Member Functions

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

Additional Inherited Members

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

Detailed Description

Pure virtual interface class for the data storage grid classes we have.

Makes it possible to have multiple implementations for the grid data storage.

Provides a number of batch operations that are expected to be faster to implement with knowledge about the underlying data structure instead of through per-cell element access.

Definition at line 80 of file Grid.h.

Member Typedef Documentation

◆ GridCoord

Definition at line 84 of file Grid.h.

◆ GridCoordVector

◆ GridFunction

using agxTerrain::BasicGrid::GridFunction = std::function<void(GridCoord, float)>

Definition at line 88 of file Grid.h.

Member Function Documentation

◆ AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE()

agxTerrain::BasicGrid::AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE ( agxTerrain::BasicGrid  )

◆ clearGrid()

virtual void agxTerrain::BasicGrid::clearGrid ( )
pure virtual

Clear the grid.

Implemented in agxTerrain::ColumnHeightGrid, and agxTerrain::HashVoxelGrid.

◆ empty()

virtual bool agxTerrain::BasicGrid::empty ( )
pure virtual

Test if the trid is empty.

Implemented in agxTerrain::ColumnHeightGrid, and agxTerrain::HashVoxelGrid.

◆ findGeometryVoxelIntersections()

virtual agx::HashSet< agx::Vec3i > agxTerrain::BasicGrid::findGeometryVoxelIntersections ( const agx::AffineMatrix4x4 gridTransform,
const agxCollide::Geometry geometry,
agx::Real  voxelSize,
bool  onlyOccupiedVoxels = true,
bool  onlyMidPoint = false 
) const
pure virtual

Find which voxels that overlap with a geometry.

Implemented in agxTerrain::HashVoxelGrid, and agxTerrain::ColumnHeightGrid.

◆ getActiveVoxelIndices()

virtual GridCoordVector agxTerrain::BasicGrid::getActiveVoxelIndices ( ) const
pure virtual

◆ getElementSize()

virtual agx::Vec3 agxTerrain::BasicGrid::getElementSize ( ) const
pure virtual

Get the element size used for the voxel grid.

Implemented in agxTerrain::ColumnHeightGrid, and agxTerrain::HashVoxelGrid.

◆ getFloatValue()

virtual float agxTerrain::BasicGrid::getFloatValue ( const GridCoord ijk) const
pure virtual

Return value for voxel ijk.

Implemented in agxTerrain::ColumnHeightGrid, and agxTerrain::HashVoxelGrid.

◆ getGridPositionFromVoxelIndex()

agx::Vec3 agxTerrain::BasicGrid::getGridPositionFromVoxelIndex ( const agx::Vec3i voxelIndex) const
inlineprotected

Definition at line 181 of file Grid.h.

◆ getMemoryUsage()

virtual size_t agxTerrain::BasicGrid::getMemoryUsage ( ) const
pure virtual

Get the memory usage.

Implemented in agxTerrain::ColumnHeightGrid, and agxTerrain::HashVoxelGrid.

◆ getNumActiveVoxels()

virtual size_t agxTerrain::BasicGrid::getNumActiveVoxels ( ) const
pure virtual

Return number of active voxels in the data structure.

Implemented in agxTerrain::ColumnHeightGrid, and agxTerrain::HashVoxelGrid.

◆ getTotal()

virtual agx::Real agxTerrain::BasicGrid::getTotal ( ) const
pure virtual

Returns the sum of all voxel values.

Implemented in agxTerrain::ColumnHeightGrid, and agxTerrain::HashVoxelGrid.

◆ getTotalAndLargest()

virtual std::tuple< float, float > agxTerrain::BasicGrid::getTotalAndLargest ( ) const
pure virtual

◆ getVoxelIndexFromGridPosition()

agx::Vec3i agxTerrain::BasicGrid::getVoxelIndexFromGridPosition ( agx::Vec3  position) const
inlineprotected

Definition at line 190 of file Grid.h.

◆ hasIterateSupport()

virtual bool agxTerrain::BasicGrid::hasIterateSupport ( ) const
inlinevirtual

Reimplemented in agxTerrain::ColumnHeightGrid, and agxTerrain::HashVoxelGrid.

Definition at line 149 of file Grid.h.

◆ isActiveVoxel()

virtual bool agxTerrain::BasicGrid::isActiveVoxel ( const GridCoord ) const
pure virtual

Test if voxel ijk is active.

Implemented in agxTerrain::ColumnHeightGrid, and agxTerrain::HashVoxelGrid.

◆ iterateVoxels()

virtual void agxTerrain::BasicGrid::iterateVoxels ( GridFunction  ) const
inlinevirtual

Reimplemented in agxTerrain::ColumnHeightGrid, and agxTerrain::HashVoxelGrid.

Definition at line 157 of file Grid.h.

◆ restore()

void agxTerrain::BasicGrid::restore ( agxStream::InputArchive in)
overridepure virtual

◆ setFloatValue()

virtual void agxTerrain::BasicGrid::setFloatValue ( const GridCoord ijk,
float  value 
)
pure virtual

Set value for voxel ijk.

Implemented in agxTerrain::ColumnHeightGrid, and agxTerrain::HashVoxelGrid.

◆ sizeHint()

virtual void agxTerrain::BasicGrid::sizeHint ( size_t  )
inlinevirtual

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

Reimplemented in agxTerrain::HashVoxelGrid, and agxTerrain::ColumnHeightGrid.

Definition at line 144 of file Grid.h.

◆ store()

void agxTerrain::BasicGrid::store ( agxStream::OutputArchive out) const
overridepure virtual

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