17 #ifndef AGXCOLLIDE_HEIGHTFIELD_H
18 #define AGXCOLLIDE_HEIGHTFIELD_H
27 #include <agxCollide/GIMPACT/AabbTree.h>
146 size_t minVertexX,
size_t maxVertexX,
147 size_t minVertexY,
size_t maxVertexY);
167 void setHeight(
size_t xIndex,
size_t yIndex,
agx::Real height);
175 agx::Real getHeight(
size_t x,
size_t y)
const;
178 size_t getResolutionX()
const;
181 size_t getResolutionY()
const;
212 agx::Vec3 getVertexFromGrid(
size_t xIndex,
size_t yIndex)
const;
226 void setMinAllowedHeight(
agx::Real minAllowedHeight);
238 void setDynamic(
bool dynamic);
244 bool getDynamic()
const;
256 bool calculateVertexIndicesTouchedByAABB(
270 virtual void calculatePossibleTriangleOverlapsAlongLineSegment(
283 virtual void calculatePossibleTriangleOverlapsAlongLineSegment(
294 void calculateVertexCoordinates(
296 size_t& vertexIndexX,
size_t& vertexIndexY)
const;
304 size_t getTriangleIndex(
305 size_t indexX,
size_t indexY,
306 uint_fast8_t upper)
const;
331 void calculateMassProperties();
338 virtual Shape* clone()
const override;
350 virtual void updateBvhTree()
override;
358 void updateTriangle(
size_t triangleIndex,
bool shouldUpdateBvhNode =
true);
360 void addQuadrantVolume(
int xIndex,
int yIndex,
agx::Real factor);
379 void finalize(
bool updateMassProperties,
const agx::RealVector& heights,
bool flipY =
false);
387 void setHeights(
bool shouldUpdateMassProperties,
const agx::RealVector& heights,
bool flipY =
false);
452 size_t& vertexIndexX,
size_t& vertexIndexY)
const
void calculateMassProperties()
Calculates "mass properties" such as volume, unscaled inertia tensor and center.
Mesh is a common base class for triangle meshes, such as Mesh or HeightField.
size_t getResolutionY() const
Returns the resolution (the number of height values) in dimension y.
Vec3T< T > min(const Vec3T< T > &lhs, const Vec3T< T > &rhs)
bool getDynamic() const
Return if the HeightField is dynamic, which means if it should keep its MassProperties updated...
agx::Real getMaxHeight() const
Returns the (global) maximum height of the HeightField.
#define AGXPHYSICS_EXPORT
BoundingAABB m_localBound
Class for data sharing only to be used by HeightField.
Vec2T< Real > Vec2
The object holding 2 dimensional vectors and providing basic arithmetic.
const HeightFieldMeshData * getHeightFieldMeshData() const
void setDynamic(bool dynamic)
Sets if the HeightField is dynamic, which means if it should keep its MassProperties updated...
agx::Real getMinAllowedHeight() const
Returns the minimum allowed height, which is at the same time the lower bound for a dynamic HeightFie...
agx::Real getMinHeight() const
Returns the (global) minimum height of the HeightField.
agx::Vec2 getScale() const
Returns the scaling factor for a single cell in the HeightField (in dimension x and y)...
Class for more intuitive access to the Mesh's mesh data.
agx::Real getHeight(size_t x, size_t y) const
Gets the height at a grid point.
void setMinAllowedHeight(agx::Real minAllowedHeight)
Sets the new minAllowedHeight, which is at the same time the lower bound for a dynamic HeightField (f...
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
agx::Vec2 projectPointToGrid(const agx::Vec3 &point) const
Projects a point in local HeightField coordinate system to the HeightField grid (which is moved to th...
agx::Vec3 getVertexFromGrid(size_t xIndex, size_t yIndex) const
Returns the vertex at a grid position.
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)
agx::Vec3 getVertex(size_t globalVertexIndex) const
agx::Vec2 getSize() const
Returns the size of the HeightField (in dimension x and y).
Axis aligned bounding box implementation.
Class to represent Images.
size_t getResolutionX() const
Returns the resolution (the number of height values) in dimension x.
size_t getTriangleIndex(size_t indexX, size_t indexY, uint_fast8_t upper) const
Computes the global triangle index within the HeightField.
A HeightField is a collision shape that can be created from a grid structure, like an image...
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
AGX_DECLARE_POINTER_TYPES(SpaceListener)
CollisionMeshDataRef m_collisionMeshData
HeightFieldMeshDataRef m_heightFieldData
void calculateVertexCoordinates(size_t vertexIndex, size_t &vertexIndexX, size_t &vertexIndexY) const
Calculates the vertex indices for x and y given a global vertex index.