34 const size_t resolutionX,
35 const size_t resolutionY,
73 bool =
true)
const override;
80 int lowestAllowedVoxelIndex,
106 std::function<
float(
const agx::Vec3i&)> getCompression,
107 std::function<
bool(
const agx::Vec2i&)> canRemoveIndex,
111 bool useParticleFreeDeformers)
override;
115 std::function<
float(
const agx::Vec3i& )> getCompression,
116 std::function<
bool(
const agx::Vec2i& )> canRemoveIndex,
148 return VoxelGridUtils::getGridPositionFromVoxelIndex(voxelIndex, m_voxelSize);
153 return VoxelGridUtils::getVoxelIndexFromGridPosition(position, m_voxelSize);
165 float occupancy = 0.0;
170 GridData m_solidMassArray;
172 size_t m_resolutionX;
173 size_t m_resolutionY;
#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.
virtual bool empty() override
Test if the trid is empty.
agx::Vec2i getResolution()
virtual bool hasIterateSupport() const override
virtual agx::Real getTotal() const override
Returns the sum of all voxel values.
virtual std::tuple< float, float > getTotalAndLargest() const override
virtual agx::Vec3iVector findVoxelsInLine(const agx::Line &gridLine) const override
agxCollide::BoundingAABB getBoundingBox() const override
agx::Vec3i getVoxelIndexFromGridPosition(agx::Vec3 position) const
virtual float getFloatValue(const GridCoord &ijk) const override
Return value for voxel ijk.
virtual ActiveZoneIntersectionData removeVolumeInActiveZone(const agx::AffineMatrix4x4 &gridTransformation, const ActiveZoneShapes &activeZoneShapes, const MeshIntersectionTestData &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, agx::Real minAllowedHeight, bool useParticleFreeDeformers) override
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.
ColumnHeightGrid(const float defaultValue, const size_t resolutionX, const size_t resolutionY, const agx::Int depth, agx::Real voxelSize)
virtual void setValuesBelowHeightField(const agxCollide::HeightField *heightField, agx::Real voxelSize, int lowestAllowedVoxelIndex, BasicGrid *compactionGrid) override
virtual size_t getMemoryUsage() const override
Get the memory usage.
virtual void setFloatValue(const GridCoord &ijk, float value) override
Set value for voxel ijk.
virtual void clearGrid() override
Clear the grid.
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, agx::Real minAllowedHeight) override
agx::Vec3 getGridPositionFromVoxelIndex(const agx::Vec3i &voxelIndex) const
virtual bool isActiveVoxel(const GridCoord &) const override
Test if voxel ijk is active.
void setOccupancyInSurfaceVoxel(const agx::Vec2i terrainIndex, float occupancy)
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.
virtual agx::HashSet< agx::Vec3i > findGeometryVoxelIntersections(const agx::AffineMatrix4x4 &gridTransform, const agxCollide::Geometry *geometry, agx::Real voxelSize, bool=true) const override
Find which voxels that overlap with a geometry.
std::pair< int, float > getVoxelZAndOccupancyFromLocalHeight(agx::Real height, agx::Real voxelSize)
int getSurfaceHeightIndex(const agx::Vec2i terrainIndex)
virtual agx::HashSet< agx::Vec3i > findConvexVoxelIntersections(const agx::AffineMatrix4x4 &gridTransform, const agxCollide::Convex *convex, agx::Real voxelSize) override
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
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.
Vector containing 'raw' data.
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
std::tuple< const agxCollide::Mesh *, agx::AffineMatrix4x4, agxCollide::BoundingAABB > MeshIntersectionTestData
std::tuple< const agxCollide::Shape *, agx::AffineMatrix4x4, agxCollide::BoundingAABB > ShapeIntersectionTestData