|
AGX Dynamics 2.42.3.1
|
Class responsible for terrain deformation by the TerrainWheel. More...
#include <TerrainWheelDeformer.h>
Inheritance diagram for agxTerrain::TerrainWheelDeformer:Classes | |
| struct | NodeData |
Public Member Functions | |
| TerrainWheelDeformer (TerrainWheel *wheel) | |
| bool | getContactPatch (agx::Vec3iVector &voxels, agx::RealVector &occupancyOverlap) |
| Get the current contact patch. | |
| WheelDeformationProperties * | getWheelDeformationProperties () |
| void | setWheelDeformationProperties (WheelDeformationProperties *properties) |
| Set the WheelDeformationProperties of the TerrainWheelDeformer object. | |
Public Member Functions inherited from agx::Referenced | |
| Referenced () | |
| Default constructor. | |
| Referenced (const Referenced &) | |
| template<typename T > | |
| T * | as () |
| Subclass casting. | |
| template<typename T > | |
| const T * | as () const |
| template<typename T > | |
| T * | asSafe () |
| Safe subclass casting, return nullptr if template type does not match. | |
| template<typename T > | |
| const T * | asSafe () const |
| int | getReferenceCount () const |
| template<typename T > | |
| bool | is () const |
| Subclass test. | |
| Referenced & | operator= (const Referenced &) |
| Assignment operator. Will increment the number of references to the referenced object. | |
| void | reference (void *ptr=nullptr) const |
| Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. | |
| void | unreference (void *ptr=nullptr) const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. | |
| void | unreference_nodelete () const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. | |
Public Attributes | |
| AGXTERRAIN_TERRAINWHEEL_STORE_RESTORE_INTERFACE | |
Protected Types | |
| using | NodeVector = agx::Vector< NodeData > |
Protected Member Functions | |
| TerrainWheelDeformer () | |
| void | calculateOccupancyOverlap (Terrain *terrain, NodeVector &nodes) |
| Calculates the occupancy overlap between wheel and terrain in each terrain node. | |
| bool | canDeform () |
| bool | deformTerrain (Terrain *terrain) |
| void | displaceMass (Terrain *terrain, NodeVector &nodes, agx::HashSet< agx::Vec2u > &depositedIndices, bool renderVoxels=false) |
| Displace mass from the given nodes. | |
| agx::Real | getSlipRatio () const |
| void | removeMass (Terrain *terrain, NodeVector &nodes, agx::HashSet< agx::Vec2u > &indicesRemovedFrom) |
| void | updateContactPatch (const agx::Vec3iVector &voxels) |
| Update contact patch from the given surface voxels. | |
| void | updateHeightField (agx::HashSet< agx::Vec2u > &changedHfIndices) |
Protected Member Functions inherited from agx::Referenced | |
| virtual | ~Referenced () |
| Destructor. | |
| void | allocateObserverVector () const |
| void | deleteUsingDeleteHandler () const |
Additional Inherited Members | |
Static Public Member Functions inherited from agx::Referenced | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Static Protected Member Functions inherited from agx::Referenced | |
| static DeleteHandler * | getDeleteHandler () |
| static void | setDeleteHandler (DeleteHandler *handler) |
| Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. | |
Protected Attributes inherited from agx::Referenced | |
| Mutex | m_mutex |
| ObserverContainer | m_observers |
| AtomicValue | m_refCount |
Class responsible for terrain deformation by the TerrainWheel.
The algorithm calculates mass removal based on the geometric wheel-terrain overlap. This is stored in an internal NodeVector struct, containing the surface vertex indices and the amount of removed occupancy.
The displacement algorithm is divided into bulldozing (forward and lateral directions) and slip-based displacement (to the rear). A bulldozing factor is used to divide the removed mass into the different displacement modes. Another weight is used to determine how much goes to the forward vs lateral bulldozing directions.
The spatial reach for the displacement is determined by different scale modifiers, which are applied as follows:
Weight, factors, and scale modifers are inside the WheelDeformationProperties in addition to booleans to enable/disable various parts of the deformation logic.
Definition at line 42 of file TerrainWheelDeformer.h.
|
protected |
Definition at line 110 of file TerrainWheelDeformer.h.
| agxTerrain::TerrainWheelDeformer::TerrainWheelDeformer | ( | TerrainWheel * | wheel | ) |
|
protected |
|
protected |
Calculates the occupancy overlap between wheel and terrain in each terrain node.
This makes sure we are not removing to much of the soil beneath the wheel.
|
protected |
|
protected |
|
protected |
Displace mass from the given nodes.
Mass will only be removed if there was any mass removed in the previous step. The displacement algorithm here is rather faulty but should suffice for driving scenarios; this is mostly due to how the voxels we displace to are chosen. This will be improved with a velocity field implementation later.
| terrain | - active terrain |
| nodes | - contact nodes, cotaining how much mass should be removed. |
| depositedIndices | - hf changes are stored here and later used to update the hf. |
| renderVoxels | - render voxels affected during displacement: Contact voxels (Blue) Contact voxels that mass was removed from (Red) Forward bulldozing displacement (Purple) Lateral bulldozing displacement (Pink) Backwards slip displacement (Green) |
| bool agxTerrain::TerrainWheelDeformer::getContactPatch | ( | agx::Vec3iVector & | voxels, |
| agx::RealVector & | occupancyOverlap | ||
| ) |
Get the current contact patch.
Each surface voxel voxels[i] correspond to the occupancyOverlap[i]. If a voxel (i,j,k) has an occupancyOverlap > 1.0, this means that the voxel directly below it, (i, j, k-1), is implicitly included in the contact patch.
| voxels | - the surface voxels in the contact patch. |
| occupancyOverlap | - the occupancy overlap in each surface voxel column. |
|
protected |
| WheelDeformationProperties * agxTerrain::TerrainWheelDeformer::getWheelDeformationProperties | ( | ) |
|
protected |
| void agxTerrain::TerrainWheelDeformer::setWheelDeformationProperties | ( | WheelDeformationProperties * | properties | ) |
Set the WheelDeformationProperties of the TerrainWheelDeformer object.
|
protected |
Update contact patch from the given surface voxels.
| voxels | - surface voxels of the contact patch. |
|
protected |
| agxTerrain::TerrainWheelDeformer::AGXTERRAIN_TERRAINWHEEL_STORE_RESTORE_INTERFACE |
Definition at line 70 of file TerrainWheelDeformer.h.