AGX Dynamics 2.42.3.0
Loading...
Searching...
No Matches
HashVoxelGrid.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or
9having been advised so by Algoryx Simulation AB for a time limited evaluation,
10or having purchased a valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agxTerrain/Grid.h>
20
21namespace agxTerrain
22{
23
28 {
29 public:
31
32 HashVoxelGrid( float defaultValue, agx::Real voxelSize );
33
35
36 virtual agx::Vec3 getElementSize() const override;
37
38 virtual size_t getMemoryUsage() const override;
39
40 virtual bool empty() override;
41
42 virtual void clearGrid() override;
43
44 virtual GridCoordVector getActiveVoxelIndices() const override;
45
46 virtual void setFloatValue(const GridCoord& ijk, float value) override;
47
48 virtual float getFloatValue(const GridCoord& ijk) const override;
49
50 virtual bool isActiveVoxel(const GridCoord& ijk) const override;
51
52 virtual size_t getNumActiveVoxels() const override;
53
54 virtual agx::Real getTotal() const override;
55
56 virtual std::tuple<float, float> getTotalAndLargest() const override;
57
58 virtual void sizeHint( size_t hint ) override;
59
60 virtual bool hasIterateSupport() const override;
61
62 virtual void iterateVoxels( GridFunction /*func*/ ) const override;
63
64 // Serialization
66
67 protected:
68
70
71 private:
72 VoxelHashType m_table;
73 agx::Vec3 m_voxelSize;
74
75 float m_default;
76 };
77}
78
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
#define AGXTERRAIN_EXPORT
Pure virtual interface class for the data storage grid classes we have.
Definition: Grid.h:81
std::function< void(GridCoord, float)> GridFunction
Definition: Grid.h:88
Class implementing the BasicGrid interface.
Definition: HashVoxelGrid.h:28
virtual size_t getMemoryUsage() const override
Get the memory usage.
virtual bool hasIterateSupport() const override
virtual std::tuple< float, float > getTotalAndLargest() const override
virtual agx::Real getTotal() const override
Returns the sum of all voxel values.
virtual bool isActiveVoxel(const GridCoord &ijk) const override
Test if voxel ijk is active.
virtual GridCoordVector getActiveVoxelIndices() const override
virtual size_t getNumActiveVoxels() const override
Return number of active voxels in the data structure.
virtual void setFloatValue(const GridCoord &ijk, float value) override
Set value for voxel ijk.
virtual void clearGrid() override
Clear the grid.
virtual bool empty() override
Test if the trid is empty.
virtual void sizeHint(size_t hint) override
Provide the implementation with a hint about the estimated number of voxels that are needed.
virtual agx::Vec3 getElementSize() const override
Get the element size used for the voxel grid.
HashVoxelGrid(float defaultValue, agx::Real voxelSize)
virtual void iterateVoxels(GridFunction) const override
virtual float getFloatValue(const GridCoord &ijk) const override
Return value for voxel ijk.
Inheritance with partial specialization due to bug with ref_ptr containers.
Vector containing 'raw' data.
Definition: agx/Vector.h:246
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
Definition: Geometry.h:59
double Real
Definition: Real.h:41