31 const size_t resolutionX,
32 const size_t resolutionY,
74 bool onlyMidPoint =
false )
const override;
78 agx::Real radius,
agx::Real width,
bool onlyOccupiedVoxels =
true,
bool onlyMidPoint =
false)
const;
83 bool onlyOccupiedVoxels =
true,
bool onlyMidPoint =
false)
const;
90 int lowestAllowedVoxelIndex,
116 std::function<
float(
const agx::Vec3i&)> getCompression,
117 std::function<
bool(
const agx::Vec2i&)> canRemoveIndex,
121 bool useParticleFreeDeformers)
override;
125 std::function<
float(
const agx::Vec3i& )> getCompression,
126 std::function<
bool(
const agx::Vec2i& )> canRemoveIndex,
206 size_t m_resolutionX;
207 size_t m_resolutionY;
214 bool m_enableMinHeights;
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXTERRAIN_EXPORT
Axis aligned bounding box implementation.
A convex class for geometric intersection tests.
The geometry representation used by the collision detection engine.
A HeightField is a collision shape that can be created from a grid structure, like an image.
Mesh is a common base class for triangle meshes, such as Mesh or HeightField.
Pure virtual interface class for the data storage grid classes we have.
std::function< void(GridCoord, float)> GridFunction
Class implementing the BasicGrid interface.
bool setMinimumHeight(agx::Vec2i terrainIndex, agx::Real minimumHeight)
agx::Vec3iVector findCylinderGeometryVoxelIntersections(const agx::AffineMatrix4x4 &gridTransform, const agxCollide::Geometry *geometry, agx::Real voxelSize, agx::Real radius, agx::Real width, bool onlyOccupiedVoxels=true, bool onlyMidPoint=false) const
bool getEnableMinimumHeights() const
GridElement getVoxelZAndOccupancyFromLocalHeight(agx::Real height)
virtual bool empty() override
Test if the trid is empty.
const GridElement & getGridElement(const agx::Vec2i &ij) const
agx::Vec2i getResolution()
virtual bool hasIterateSupport() const override
virtual agx::Real getTotal() const override
Returns the sum of all voxel values.
GridElement getVoxelAndOccupancy(const agx::Vec2i &terrainIndex)
void allocateMinHeights()
virtual std::tuple< float, float > getTotalAndLargest() const override
virtual agx::Vec3iVector findVoxelsInLine(const agx::Line &gridLine) const override
agx::Real getMinimumHeight(agx::Vec2i terrainIndex) const
agxCollide::BoundingAABB getBoundingBox() const override
virtual float getFloatValue(const GridCoord &ijk) const override
Return value for voxel ijk.
virtual void iterateVoxels(GridFunction func) const override
virtual void sizeHint(size_t) override
Provide the implementation with a hint about the estimated number of voxels that are needed.
virtual GridCoordVector getActiveVoxelIndices() const override
virtual agx::Vec3 getElementSize() const override
Get the element size used for the voxel grid.
virtual void setValuesBelowHeightField(const agxCollide::HeightField *heightField, agx::Real voxelSize, int lowestAllowedVoxelIndex, BasicGrid *compactionGrid) override
virtual agx::HashSet< agx::Vec3i > findGeometryVoxelIntersections(const agx::AffineMatrix4x4 &gridTransform, const agxCollide::Geometry *geometry, agx::Real voxelSize, bool=true, bool onlyMidPoint=false) const override
Find which voxels that overlap with a geometry.
virtual size_t getMemoryUsage() const override
Get the memory usage.
agx::Int getLowestAllowableVoxelIndexZ() const
virtual void setFloatValue(const GridCoord &ijk, float value) override
Set value for voxel ijk.
virtual void clearGrid() override
Clear the grid.
agx::Int getVoxelZFromHeight(agx::Real height) const
agx::Real getHeightFromVoxelZAndOccupancy(int voxelZ, float occupancy)
agx::RealVector getMinimumHeights() const
bool isIndexOutsideBounds(agx::Vec2i index) const
agx::Int getMinimumHeightIndexZ(agx::Vec2i terrainIndex) const
agx::Real getLowestMinimumHeight() const
void setLowestMinimumHeight(agx::Real minimumHeight)
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, std::function< agx::Real(const agx::Vec2i &)> getMinAllowedHeight) override
ColumnHeightGrid(const float defaultValue, const size_t resolutionX, const size_t resolutionY, const agx::Real lowestMinimumHeight, const agx::Real voxelSize, const agx::RealVector &minimumHeights=agx::RealVector())
virtual bool isActiveVoxel(const GridCoord &) const override
Test if voxel ijk is active.
void setOccupancyInSurfaceVoxel(const agx::Vec2i terrainIndex, float occupancy)
void setMinimumHeights(const agx::RealVector &minimumHeights)
virtual ActiveZoneIntersectionData removeVolumeInActiveZone(const agx::AffineMatrix4x4 &gridTransformation, const ActiveZoneShapes &activeZoneShapes, const ActiveZoneShapes &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, std::function< agx::Real(const agx::Vec2i &)> getMinAllowedHeight, bool useParticleFreeDeformers) override
void setGridColumnOccupancy(const agx::Vec2i terrainIndex, int voxelZ, float occupancy)
virtual void findVoxelSurfaceFromIndex(const agx::Vec3i &index, agx::Vec3i &result) override
virtual size_t getNumActiveVoxels() const override
Return number of active voxels in the data structure.
void setEnableMinimumHeights(bool enable)
agx::Vec3iVector cylinderVoxelAABBIntersections(const agx::AffineMatrix4x4 &gridTransform, const agxCollide::Geometry *geometry, agx::Real voxelSize, agx::Real radius, agx::Real width, bool onlyOccupiedVoxels=true, bool onlyMidPoint=false) const
virtual agx::HashSet< agx::Vec3i > findConvexVoxelIntersections(const agx::AffineMatrix4x4 &gridTransform, const agxCollide::Convex *convex, agx::Real voxelSize) override
int getSurfaceHeightIndex(const agx::Vec2i terrainIndex) const
virtual agx::HashSet< agx::Vec3i > findVoxelsAboveTriangles(const agx::AffineMatrix4x4 &gridTransform, const TriangleVector &triangles, agx::Real voxelSize, agx::Real margin) override
virtual bool findMeshVoxelIntersections(const agx::AffineMatrix4x4 &gridTransform, const agxCollide::Mesh *mesh, agx::Real voxelSize, agx::Vec3iVector &result) override
agx::Real getLocalHeight(const agx::Vec2i terrainIndex)
Extended pure virtual interface for Grid storage classes.
Inheritance with partial specialization due to bug with ref_ptr containers.
Class representing the mathematical concept of a plane, also called a half- space.
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
std::tuple< const agxCollide::Shape *, agx::AffineMatrix4x4, agxCollide::BoundingAABB > ShapeIntersectionTestData