AGX Dynamics  2.37.2.0
HashVoxelGrid.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or
9 having been advised so by Algoryx Simulation AB for a time limited evaluation,
10 or having purchased a valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #pragma once
18 
19 #include <agxTerrain/Grid.h>
20 
21 namespace agxTerrain
22 {
23 
28  {
29  public:
31 
32  HashVoxelGrid( float defaultValue, agx::Real voxelSize );
33 
34  ~HashVoxelGrid();
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  virtual agx::HashSet<agx::Vec3i> findGeometryVoxelIntersections(const agx::AffineMatrix4x4& gridTransform,
65  const agxCollide::Geometry* geometry,
66  agx::Real voxelSize,
67  bool onlyOccupiedVoxels = true ) const override;
68 
69  // Serialization
71 
72  protected:
73  HashVoxelGrid();
74 
75  private:
76  VoxelHashType m_table;
77  agx::Vec3 m_voxelSize;
78 
79  float m_default;
80  };
81 }
82 
Pure virtual interface class for the data storage grid classes we have.
Definition: Grid.h:71
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes...
Definition: Geometry.h:59
Class implementing the BasicGrid interface.
Definition: HashVoxelGrid.h:27
The geometry representation used by the collision detection engine.
Definition: Geometry.h:92
Vector containing &#39;raw&#39; data.
Definition: Vector.h:245
#define AGXTERRAIN_EXPORT
#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
std::function< void(GridCoord, float)> GridFunction
Definition: Grid.h:79
double Real
Definition: Real.h:42
Inheritance with partial specialization due to bug with ref_ptr containers.