AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
agxTerrain::TerrainWheelPlane Class Reference

The TerrainWheelPlane consists of the parts and logic that is necessary to create. More...

#include <TerrainWheelPlane.h>

+ Inheritance diagram for agxTerrain::TerrainWheelPlane:

Classes

struct  GridAxes
 
struct  RegressionPlanesData
 Container for all regression plane related data used by TerrainWheel. More...
 

Public Types

enum class  PlaneName { FORCE_FEEDBACK , FRONT_ANGLE , REAR_ANGLE , REAR_AND_FRONT_ANGLE_REFERENCE }
 

Public Member Functions

 TerrainWheelPlane (TerrainWheel *wheel, RegressionPlanesParameters *params)
 
std::vector< std::vector< agx::Int > > collectRegressionPlaneIndexGroups () const
 Collect all regression-plane groups that are required by the new regression-plane pipeline.
 
agxCollide::RegressionPlane computeRegressionPlane (agx::Vec3Vector &surfacePoints)
 Fit a regression plane from previously collected terrain surface points.
 
agx::Vec3Vector computeRegressionPlaneSurfacePoints (agx::Vec3Vector &positions, std::size_t index)
 Compute terrain surface sample points for a unique grid-point combination.
 
agx::Real computeScaledLength (agx::Real baseValue, const RegressionPlanesParameters::GridScale &scale) const
 Compute a scaled length value based on a base value and a specified scale (see RegressionPlanesParameters::GridScale).
 
agx::AffineMatrix4x4 computeTransformForPlaneAtPlane (const agx::Vec3 &normal, const agx::Vec3 &point)
 Compute a transformation aligning a plane in world space.
 
agx::AffineMatrix4x4 computeTransformForPlaneAtWheel (const agx::Vec3 &normal, const agx::Vec3 &point)
 Compute a transformation aligning a plane relative to the wheel center.
 
agxCollide::HeightField * createForceFeedbackHeightField ()
 Create the force feedback heightfield.
 
agxCollide::Geometry * createForceFeedbackPlane ()
 Create the geometry which is used for force feedback.
 
bool findGridCombinationAndGroupForPlaneIndex (std::size_t planeIndex, agx::Int &combinationIndex, agx::Int &groupIndex) const
 Given the index of a unique regression plane, attempt to find which (combinationIndex, groupIndex) it corresponds to in the gridCombinations structure.
 
agx::Int findRegressionPlaneIndexForBaseGridIndices (const std::vector< agx::Int > &baseGridIndices) const
 Find the unique regression-plane index corresponding to a given list of base grid indices.
 
bool getEnableForceFeedback () const
 
agxCollide::Geometry * getForceFeedbackGeometry ()
 
agx::Vec2 getForceFeedbackHeightFieldDimensions () const
 Get the dimensions of the force feedback heightfield associated with the wheel.
 
std::vector< agx::Int > getGridCombinationGridIndicesForGroups (agx::Int combinationIndex, const std::vector< agx::Int > &groupIndices) const
 Given a grid-combination index and a list of group indices, return the union of all base-grid indices** referenced by those groups.
 
std::vector< agx::Int > getGridCombinationGroupIndicesForOrigin (agx::Int combinationIndex) const
 Return the group-index list used to determine the origin for a given grid combination.
 
std::vector< agx::Int > getGridCombinationGroupIndicesForReferenceNormal (agx::Int combinationIndex) const
 Return the group-index list used to determine the reference normal for a given grid combination.
 
std::vector< std::vector< agx::Int > > getGridIndexListsForceFeedbackPlane () const
 Retrieve the grid-index lists used for constructing the force-feedback plane.
 
std::vector< std::vector< agx::Int > > getGridIndexListsForGridCombinationIndex (agx::Int combinationIndex) const
 Retrieve the grid-index lists associated with a given grid-combination index.
 
std::vector< std::vector< agx::Int > > getGridIndexListsFrontAnglePlane () const
 Retrieve the grid-index lists used for constructing the front-angle plane.
 
std::vector< std::vector< agx::Int > > getGridIndexListsRearAndFrontAngleReferencePlane () const
 Retrieve the grid-index lists for the rear-and-front angle reference plane.
 
std::vector< std::vector< agx::Int > > getGridIndexListsRearAnglePlane () const
 Retrieve the grid-index lists used for constructing the rear-angle plane.
 
agx::Vec3 getGridOrigin (agx::Int planeIndex) const
 Compute the origin point for a regression-plane group using the new regression-plane configuration system.
 
agx::Vec3 getGridOriginByName (agx::String name) const
 Query the origin associated with a named regression-plane group using the new regression-plane configuration system.
 
agx::Vec3 getGridReferenceNormal (agx::Int planeIndex) const
 Compute the reference normal for a regression-plane group using the new regression-plane configuration system.
 
agx::Vec3 getGridReferenceNormalByName (agx::String name) const
 Query the reference normal associated with a named regression-plane group using the new regression-plane configuration system.
 
bool getPlanesInitialized () const
 
agx::Vec3 getRegressionPlaneAveragedNormalByName (agx::String name) const
 Get the averaged regression-plane normal for a named group.
 
agx::Vec3 getRegressionPlaneAveragePointByName (agx::String name) const
 Get the averaged regression-plane average point for a named group.
 
std::vector< agx::Vec3 > getRegressionPlaneAveragePointsByName (agx::String name) const
 Get all regression-plane average points for a named group.
 
std::vector< agx::Int > getRegressionPlaneIndicesByName (agx::String name) const
 Resolve the list of unique regression-plane indices associated with a logical regression-plane name, using the grid-combination system.
 
std::vector< agx::Vec3 > getRegressionPlaneNormalsByName (agx::String name) const
 Get all regression-plane normals for a named group.
 
RegressionPlanesParameters * getRegressionPlanesParameters () const
 Get the paramaters that control how regression planes are generated, combined, and updated each timestep to represent the terrain under the wheel.
 
void initializeRegressionPlanes ()
 Initialize all regression-plane structures using the grid-combination-based configuration.
 
void initializeRegressionPlanesGridPointsSet ()
 Initialize the per-grid template point sets used when constructing regression planes.
 
void initializeRegressionPlanesNameToRegressionPlaneIndices ()
 Build the name -> regression-plane indices map using the grid-combination-based configuration.
 
void initializeRegressionPlanesUniqueGridPointsCombinationsSet ()
 Build the unique grid-point combinations used by the regression-plane configuration.
 
void initializeRegressionPlanesValidGridPointsSetIndices ()
 Initialize the set of valid base-grid indices used by the new regression-plane pipeline.
 
bool isValid () const
 
void onAdd (agxSDK::Simulation *simulation)
 
void onRemove (agxSDK::Simulation *simulation)
 
bool resolveGridCombinationConfigForPlaneName (const agx::String &name, agx::Int &combinationIndex, std::vector< agx::Int > &normalGroupIndices, std::vector< agx::Int > &originGroupIndices) const
 Resolve the grid-combination configuration for a logical regression-plane name using the grid-combination system.
 
void setEnableForceFeedback (bool enable) const
 
void setIsForceFeedbackHeightField (agxCollide::Geometry *geometry, bool enable)
 Mark or unmark a geometry as a force feedback heightfield.
 
void setRegressionPlanesParameters (RegressionPlanesParameters *params)
 Set the paramaters that control how regression planes are generated, combined, and updated each timestep to represent the terrain under the wheel.
 
void showRegressionPlaneDebugText ()
 Display on-screen labels for the currently active regression-plane categories.
 
void updateForceFeedbackHeightField (const agx::Vec3 &normal, const agx::Vec3 &point, const agx::AffineMatrix4x4 &transform)
 Update the transformation of the force feedback heightfield.
 
bool updateRearAndFrontAngles ()
 
void updateRegressionPlaneNormalsAndAveragePoints ()
 Compute and update cached regression-plane normals and average points, both per-plane and per named group.
 
void updateRegressionPlanesForwardSign ()
 Update the sign of the forward direction of the grid coordinate systems specifying the directions in which to place grid points.
 
void updateTerrainWheelPlane (bool &shouldUpdateMajorObjects, const agx::RealVector &weights)
 
void updateUniqueRegressionPlanes ()
 Update all unique regression planes using the new regression-plane pipeline.
 
- 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.
 

Static Public Member Functions

static bool isForceFeedbackHeightField (const agxCollide::Geometry *geometry)
 Check whether the given geometry is marked as a force feedback heightfield.
 
static agx::String planeNameToString (PlaneName plane)
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 

Public Attributes

 AGXTERRAIN_TERRAINWHEEL_STORE_RESTORE_INTERFACE
 
agxCollide::GeometryRef m_forceFeedbackGeometry {nullptr}
 
agxCollide::HeightFieldRef m_forceFeedbackHeightField {nullptr}
 
agx::Vec2 m_forceFeedbackHeightFieldDimensions
 
bool m_initialized
 
RegressionPlanesData m_regressionPlanesData
 
agx::Int m_regressionPlanesForwardSign = 1
 
bool m_regressionPlanesHaveValidContactFrame {false}
 
RegressionPlanesParametersRef m_regressionPlanesParameters
 
TerrainWheel * m_wheel
 

Protected Member Functions

 TerrainWheelPlane ()
 
agxTerrain::TerrainWheelQuantities * getQuantities ()
 
agx::Real getRadius () const
 
agxTerrain::TerrainWheelSettings * getSettings () const
 
agx::Real getTerrainElementSize () const
 
agx::Vec3 getWheelPosition () const
 
agx::AffineMatrix4x4 getWheelTransform () const
 
agx::Real getWidth () const
 
void setPlanesInitialized (bool enable)
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 

Additional Inherited Members

- 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
 

Detailed Description

The TerrainWheelPlane consists of the parts and logic that is necessary to create.

  • The force feedback plane, ie the geometry which the TerrainWheel experiences force feedback against
  • The regression planes which are used to determine entry and exit angles and the positioning of the force feedback plane

Definition at line 51 of file TerrainWheelPlane.h.

Member Enumeration Documentation

◆ PlaneName

Enumerator
FORCE_FEEDBACK 
FRONT_ANGLE 
REAR_ANGLE 
REAR_AND_FRONT_ANGLE_REFERENCE 

Definition at line 62 of file TerrainWheelPlane.h.

Constructor & Destructor Documentation

◆ TerrainWheelPlane() [1/2]

agxTerrain::TerrainWheelPlane::TerrainWheelPlane ( TerrainWheel *  wheel,
RegressionPlanesParameters *  params 
)

◆ TerrainWheelPlane() [2/2]

agxTerrain::TerrainWheelPlane::TerrainWheelPlane ( )
protected

Member Function Documentation

◆ collectRegressionPlaneIndexGroups()

std::vector< std::vector< agx::Int > > agxTerrain::TerrainWheelPlane::collectRegressionPlaneIndexGroups ( ) const

Collect all regression-plane groups that are required by the new regression-plane pipeline.

A "group" is a vector of base-grid indices belonging to a single entry inside a grid combination (i.e. one subgroup of 'gridCombinations[k]').

This method produces a flat list of such groups in an order consistent with how unique regression planes and name-to-plane mappings are built.

Processing steps:

  1. Collect the primary grid-combination indices:
    • force-feedback plane combination
    • front-angle plane combination
    • rear-angle plane combination
    • rear-and-front angle reference plane combination
  2. Collect all helper combination indices referenced indirectly via:
    • 'gridCombinationsIndicesReferenceNormal'
    • 'gridCombinationsIndicesOrigin'
  3. For each gathered combination index:
    • Append each non-empty group inside 'gridCombinations[cIdx]' to the output.

Result:

The returned vector is a flattened list of all grid groups needed to construct:

  • regression planes involved directly in force-feedback and angle computation
  • any supporting reference-plane configurations

This list ensures that all regression-plane groups required anywhere in the new system are fully accounted for.

Returns
A list of plane-group vectors, where each vector contains base grid indices belonging to one regression-plane definition.

◆ computeRegressionPlane()

agxCollide::RegressionPlane agxTerrain::TerrainWheelPlane::computeRegressionPlane ( agx::Vec3Vector &  surfacePoints)

Fit a regression plane from previously collected terrain surface points.

This method constructs an agxCollide::RegressionPlane from surfacePoints and verifies that the fitted result has planar dimension type.

If the fit does not produce a valid planar result, the returned regression plane will have a non-PLANE dimension type and a warning may be logged if PRINT_GENERAL_INFO is enabled.

Parameters
surfacePointsWorld-space terrain surface points to use for the plane fit.
Returns
The fitted regression plane.

◆ computeRegressionPlaneSurfacePoints()

agx::Vec3Vector agxTerrain::TerrainWheelPlane::computeRegressionPlaneSurfacePoints ( agx::Vec3Vector &  positions,
std::size_t  index 
)

Compute terrain surface sample points for a unique grid-point combination.

For the given unique plane index, this method:

  • Queries the reference normal using getGridReferenceNormal(index).
  • Builds wheel-aligned forward/lateral axes in world space.
  • Queries the per-plane grid origin using getGridOrigin(index).
  • For each wheel-local template point in positions: Optionally applies front/rear angle adaptation along the local x-axis, depending on the source grid's gridsIsAdaptToRearAndFrontAngles flag. Projects the point into world space from the grid origin using the forward and lateral axes. Samples the terrain height at that location. Adds the resulting world-space terrain surface point to the returned set.

Points for which terrain height interpolation fails are skipped. Therefore, the returned vector may contain fewer points than positions. When debug rendering is enabled, the sampled surface points are rendered using the per-plane debug coloring rules.

Parameters
positionsWheel-local template sampling points (x = longitudinal, y = lateral, z = 0) for the unique plane identified by index. The contents are used as input and are not modified.
indexUnique regression-plane index, used to look up reference normal, origin, source grid indices, and debug colors.
Returns
World-space terrain surface points collected for the given unique plane index.

◆ computeScaledLength()

agx::Real agxTerrain::TerrainWheelPlane::computeScaledLength ( agx::Real  baseValue,
const RegressionPlanesParameters::GridScale &  scale 
) const

Compute a scaled length value based on a base value and a specified scale (see RegressionPlanesParameters::GridScale).

The scale determines which reference quantity the base value is multiplied by:

  • "RADIUS" scales by the wheel radius,
  • "WIDTH" scales by the wheel width, and
  • "ELEMENT_SIZE" scales by the terrain element size.
  • "UNITY" returns the base value as-is,
Parameters
baseValue- The unscaled base value.
scale- The scale specifier (see RegressionPlanesParameters::GridScale enum).
Returns
The computed scaled length.

◆ computeTransformForPlaneAtPlane()

agx::AffineMatrix4x4 agxTerrain::TerrainWheelPlane::computeTransformForPlaneAtPlane ( const agx::Vec3 &  normal,
const agx::Vec3 &  point 
)

Compute a transformation aligning a plane in world space.

This method constructs an affine transform that orients and positions a plane according to the provided normal and point. The resulting transform ensures that:

  • The plane's local normal matches the specified normal vector.
  • The plane's center coincides exactly with the provided point.
Parameters
normalReference normal defining the plane's orientation.
pointCenter point of the plane in world coordinates.
Returns
Affine transform aligning the plane's normal and center to the specified parameters.

◆ computeTransformForPlaneAtWheel()

agx::AffineMatrix4x4 agxTerrain::TerrainWheelPlane::computeTransformForPlaneAtWheel ( const agx::Vec3 &  normal,
const agx::Vec3 &  point 
)

Compute a transformation aligning a plane relative to the wheel center.

This method constructs an affine transform based on the given plane normal and point, aligning the plane so that its normal passes through the wheel center. The resulting transform can be applied to orient and position the plane such that:

  • The plane's normal vector, originating from its center, intersects the wheel center when transformed.
  • The distance between the wheel center and the plane equals the dot product of "the vector from the plane's reference point to the wheel center" and "the plane's normal".
Parameters
normalReference normal defining the plane's orientation.
pointPoint on the plane used as a reference for positioning.
Returns
Affine transform aligning the plane so its normal passes through the wheel center.

◆ createForceFeedbackHeightField()

agxCollide::HeightField * agxTerrain::TerrainWheelPlane::createForceFeedbackHeightField ( )

Create the force feedback heightfield.

This method instantiates a force feedback heightfield that serves as the analytical contact surface for computing wheel-terrain interaction forces. The heightfield is created once and subsequently updated in position and orientation by other methods to follow the wheel's motion over the terrain.

Parameters
forceFeedbackPlaneDimensionsThe planar dimensions (X and Y extents) of the force feedback heightfield, specified in the wheel's local frame.
Returns
Pointer to the created heightfield geometry.

◆ createForceFeedbackPlane()

agxCollide::Geometry * agxTerrain::TerrainWheelPlane::createForceFeedbackPlane ( )

Create the geometry which is used for force feedback.

The geometry contains the height field shape.

◆ findGridCombinationAndGroupForPlaneIndex()

bool agxTerrain::TerrainWheelPlane::findGridCombinationAndGroupForPlaneIndex ( std::size_t  planeIndex,
agx::Int &  combinationIndex,
agx::Int &  groupIndex 
) const

Given the index of a unique regression plane, attempt to find which (combinationIndex, groupIndex) it corresponds to in the gridCombinations structure.

Each unique plane is defined by a group of base grid indices stored in: m_regressionPlanesData.uniqueGridPointsCombinationsSourceGridIndex[planeIndex].

Each grid combination is defined by groups of base grid indices stored in: gridCombinations[i][j].

Processing:

  • Normalize the unique plane's base grid indices (filter -> sort -> deduplicate).
  • For every gridCombinations[i][j], normalize that group as well.
  • If a normalized group exactly matches the normalized indices for the unique plane, the function succeeds.

On success:

  • combinationIndex is set to i
  • groupIndex is set to j
  • returns true

On failure:

  • combinationIndex = -1
  • groupIndex = -1
  • returns false
Parameters
planeIndexIndex into the unique regression-plane list.
combinationIndexOutput: matching index i in gridCombinations.
groupIndexOutput: matching group j in gridCombinations[i].
Returns
true if a matching (i, j) is found; false otherwise.

◆ findRegressionPlaneIndexForBaseGridIndices()

agx::Int agxTerrain::TerrainWheelPlane::findRegressionPlaneIndexForBaseGridIndices ( const std::vector< agx::Int > &  baseGridIndices) const

Find the unique regression-plane index corresponding to a given list of base grid indices.

The input baseGridIndices is interpreted as a group of base grids (typically one of the inner vectors from gridCombinations[k]).

The function:

  1. Filters the indices to those that appear in m_regressionPlanesData.validGridPointsSetIndices.
  2. Sorts and deduplicates this filtered list (the "normalized" group).
  3. Compares it against the normalized content of each entry in m_regressionPlanesData.uniqueGridPointsCombinationsSourceGridIndex.
  4. Returns the index of the unique regression plane whose group matches.

If no matching unique plane exists, or the normalized input is empty, the function returns -1.

Parameters
baseGridIndicesRaw list of base grid indices describing a plane group.
Returns
>= 0 : index into uniqueGridPointsCombinationsSet / uniquePlanes.
-1 : no matching unique plane exists.

◆ getEnableForceFeedback()

bool agxTerrain::TerrainWheelPlane::getEnableForceFeedback ( ) const

◆ getForceFeedbackGeometry()

agxCollide::Geometry * agxTerrain::TerrainWheelPlane::getForceFeedbackGeometry ( )

◆ getForceFeedbackHeightFieldDimensions()

agx::Vec2 agxTerrain::TerrainWheelPlane::getForceFeedbackHeightFieldDimensions ( ) const

Get the dimensions of the force feedback heightfield associated with the wheel.

The data used to compute these dimensions is stored in the member variable m_regressionPlanesParameters. The dimensions are returned along:

  • the X-axis of the wheel (the wheel's longitudinal direction), and
  • the X-axis of the wheel (the wheel's lasteral direction)
Returns
A 2D vector containing the force feedback heightfield dimensions in the X (longitudinal) and Y (lateral) directions, respectively.

◆ getGridCombinationGridIndicesForGroups()

std::vector< agx::Int > agxTerrain::TerrainWheelPlane::getGridCombinationGridIndicesForGroups ( agx::Int  combinationIndex,
const std::vector< agx::Int > &  groupIndices 
) const

Given a grid-combination index and a list of group indices, return the union of all base-grid indices** referenced by those groups.

A grid combination consists of several grid groups, where each group is a list of base grid indices (as configured in setRegressionPlanesGridCombinations). This method selects specific groups inside that combination and aggregates all their base-grid indices into a single deduplicated list.

Behavior:

  • If 'combinationIndex' is negative or out of range -> returns an empty vector.
  • Any group index in 'groupIndices' that is negative or out of range is ignored.
  • Base-grid indices from the selected groups are concatenated in order of appearance.
  • The final list is deduplicated while preserving first-seen order.

Example: If: gridCombinations[k] = { {1}, {2,3,5}, {3,8} } and groupIndices = { 1, 2 } then the result is: { 2, 3, 5, 8 } (where the duplicate "3" from group 2 appears only once, and the order is kept).

Parameters
combinationIndexIndex of the grid combination whose groups will be inspected.
groupIndicesList of group indices (within the specified combination) indicating which groups' base-grid indices should be aggregated.
Returns
A deduplicated list of base-grid indices belonging to the selected groups, or an empty vector if the combination index is invalid.

◆ getGridCombinationGroupIndicesForOrigin()

std::vector< agx::Int > agxTerrain::TerrainWheelPlane::getGridCombinationGroupIndicesForOrigin ( agx::Int  combinationIndex) const

Return the group-index list used to determine the origin for a given grid combination.

Each combined regression-plane configuration may define which plane's computed origin (aggregated regression center point) should be used for each of its grid groups. These values are configured via setRegressionPlanesGridCombinationsIndicesOrigin().

Meaning of returned values:

  • A value I >= 0 means: Use the origin computed from gridCombinations[I].
  • A value I == -1 means: Use the wheel center as the origin.

Behavior:

  • If combinationIndex < 0 -> returns an empty vector.
  • If combinationIndex is out of range -> returns an empty vector.
Parameters
combinationIndexThe index of the grid combination whose origin-selection indices should be retrieved.
Returns
A list where result[j] gives the origin source index for grid group j within the specified combination.

◆ getGridCombinationGroupIndicesForReferenceNormal()

std::vector< agx::Int > agxTerrain::TerrainWheelPlane::getGridCombinationGroupIndicesForReferenceNormal ( agx::Int  combinationIndex) const

Return the group-index list used to determine the reference normal for a given grid combination.

Each combined regression-plane configuration may contain multiple grid groups. For each group, a reference-normal source index is configured via setRegressionPlanesGridCombinationsIndicesReferenceNormal(). This method retrieves that list of indices for the specified combination.

Meaning of returned values:

  • A value I >= 0 means: Use the average normal computed from gridCombinations[I].
  • A value I == -1 means: Use the fixed world-up vector **(0,0,1)** as the reference normal.

Behavior:

  • If combinationIndex < 0 -> returns an empty vector.
  • If combinationIndex is out of range -> returns an empty vector.
Parameters
combinationIndexThe index of the grid combination whose reference-normal group indices should be retrieved.
Returns
A list where result[j] gives the reference-normal source index for grid group j within the specified combination.

◆ getGridIndexListsForceFeedbackPlane()

std::vector< std::vector< agx::Int > > agxTerrain::TerrainWheelPlane::getGridIndexListsForceFeedbackPlane ( ) const

Retrieve the grid-index lists used for constructing the force-feedback plane.

This is a convenience wrapper around getGridIndexListsForGridCombinationIndex(), automatically using the configured grid-combination index for the force-feedback plane.

The force-feedback plane is the plane that interacts physically with the wheel (contact, forces, torques), and its grid-combination definition determines which underlying regression-plane grids contribute to its construction.

Returns
The grid-index groups associated with the force-feedback plane's configured grid combination. Returns an empty list if no valid index is configured.

◆ getGridIndexListsForGridCombinationIndex()

std::vector< std::vector< agx::Int > > agxTerrain::TerrainWheelPlane::getGridIndexListsForGridCombinationIndex ( agx::Int  combinationIndex) const

Retrieve the grid-index lists associated with a given grid-combination index.

Each grid combination (configured via setRegressionPlanesGridCombinations) consists of one or more grid groups, where each group is a list of grid indices that should be aggregated together when constructing a combined regression plane.

This method returns those grid groups for the specified combination index.

Behavior:

  • If 'combinationIndex < 0', an empty result is returned.
  • If 'combinationIndex' is out of range of the configured grid combinations, an empty result is returned.
  • Otherwise, the method returns 'gridCombinations[combinationIndex]', which is a vector where: result[i] is grid group i, result[i][j] is the j-th grid index in that group.

Example: If 'gridCombinations[3] == { {1}, {2,3,5} }', then calling this method with '3' returns: { {1}, {2,3,5} }

Parameters
combinationIndexThe index into the regression-plane grid combination list.
Returns
A 2D list of grid index groups associated with the given combination index. Returns an empty list if the index is negative or invalid.

◆ getGridIndexListsFrontAnglePlane()

std::vector< std::vector< agx::Int > > agxTerrain::TerrainWheelPlane::getGridIndexListsFrontAnglePlane ( ) const

Retrieve the grid-index lists used for constructing the front-angle plane.

This is a convenience wrapper around getGridIndexListsForGridCombinationIndex(), using the configured grid-combination index for the front-angle plane.

The front-angle plane is used to determine the wheel's front pitch angle by examining its regression-plane normal.

Returns
The grid-index groups associated with the front-angle plane's grid combination. Returns an empty list if the index is invalid.

◆ getGridIndexListsRearAndFrontAngleReferencePlane()

std::vector< std::vector< agx::Int > > agxTerrain::TerrainWheelPlane::getGridIndexListsRearAndFrontAngleReferencePlane ( ) const

Retrieve the grid-index lists for the rear-and-front angle reference plane.

This wrapper uses getGridIndexListsForGridCombinationIndex() with the configured index for the plane that provides the reference normal used when computing both the rear and front wheel angles.

This plane does not necessarily participate directly in force feedback, but provides the reference orientation against which the angle planes are measured.

Returns
The grid-index groups corresponding to the reference plane's grid combination. Returns an empty list if no valid index is set.

◆ getGridIndexListsRearAnglePlane()

std::vector< std::vector< agx::Int > > agxTerrain::TerrainWheelPlane::getGridIndexListsRearAnglePlane ( ) const

Retrieve the grid-index lists used for constructing the rear-angle plane.

This wraps getGridIndexListsForGridCombinationIndex(), selecting the grid-combination index assigned to the rear-angle plane.

The rear-angle plane defines the wheel's rear pitch angle, using its regression-plane normal for angle computation.

Returns
The grid-index groups associated with the rear-angle plane's grid combination, or an empty list if no valid index is configured.

◆ getGridOrigin()

agx::Vec3 agxTerrain::TerrainWheelPlane::getGridOrigin ( agx::Int  planeIndex) const

Compute the origin point for a regression-plane group using the new regression-plane configuration system.

This method determines the correct origin for the plane identified by 'planeIndex' using:

  • 'gridCombinations'
  • 'gridCombinationsIndicesOrigin'
  • per-plane regression data (averaged normals and averaged points)

Behavior overview:

  1. The unique plane index is mapped to its (combinationIndex, groupIndex)** using 'findGridCombinationAndGroupForPlaneIndex()'. If this mapping fails, the wheel center is used as the origin.
  2. The method then consults 'gridCombinationsIndicesOrigin[combinationIndex][groupIndex]' to determine which referenced combination should supply the origin.

    Interpretation of the referenced value:

    • refCombIdx == -1: Origin = wheel center.
    • refCombIdx >= 0: Origin is computed by averaging all regression-plane centers belonging to the referenced combination.
  3. For the referenced combination, the averaged plane normal and averaged plane point are computed. These define an averaged regression plane.
  4. The final origin is computed as the projection of the wheel center onto this averaged plane (via 'computeCenterOfPlaneAtWheel()').

Configuration errors:

  • If the origin-entry list has too few entries for the number of groups, a descriptive runtime error is thrown.
  • If a referenced combination index is out of range, a descriptive error is thrown.
Parameters
planeIndexThe global unique index of the regression plane whose origin should be computed.
Returns
The computed origin point for the plane, or the wheel center if no origin is configured or if configuration errors require fallback.

◆ getGridOriginByName()

agx::Vec3 agxTerrain::TerrainWheelPlane::getGridOriginByName ( agx::String  name) const

Query the origin associated with a named regression-plane group using the new regression-plane configuration system.

A regression-plane "name" (e.g. '"force_feedback_plane"', '"front_angle_plane"', etc.) may correspond to multiple plane indices. This method:

  1. Resolves all plane indices associated with the given name using 'getRegressionPlaneIndicesByName(name)'.
  2. For each resolved plane index, computes its origin using 'getGridOrigin()', which may depend on:
    • 'gridCombinations'
    • 'gridCombinationsIndicesOrigin'
    • averaged regression-plane centers
  3. Returns the average of all successfully computed origins.

Fallback behavior:

  • If no valid regression-plane indices are found, or all origins fail, the method returns **(0,0,0)**.
Parameters
nameThe name identifying one or more regression-plane groups.
Returns
The averaged origin of all referenced regression planes, or (0,0,0) if none are available.

◆ getGridReferenceNormal()

agx::Vec3 agxTerrain::TerrainWheelPlane::getGridReferenceNormal ( agx::Int  planeIndex) const

Compute the reference normal for a regression-plane group using the new regression-plane configuration system.

This method determines the correct reference normal for the plane identified by 'planeIndex' using:

  • 'gridCombinations'
  • 'gridCombinationsIndicesReferenceNormal'
  • per-plane regression normals

The reference normal is used as the "up direction" when constructing a grid orientation basis for the plane.

Behavior overview:

  1. The unique plane index is mapped to its (combinationIndex, groupIndex)** using 'findGridCombinationAndGroupForPlaneIndex()'. If this fails, the fallback **(0,0,1)** (Z-up) is returned.
  2. The method consults 'gridCombinationsIndicesReferenceNormal[combinationIndex][groupIndex]' to determine which referenced combination should supply the normal.

    Interpretation:

    • refCombIdx == -1: Reference normal = (0,0,1) (global up).
    • refCombIdx >= 0: The reference normal is the average of all regression-plane normals belonging to the referenced combination.
  3. The normals of all base-grid groups in the referenced combination are found and averaged. The resulting vector is normalized.

Configuration errors:

  • Too few entries in the reference-normal index list -> runtime error.
  • Referenced combination index out of range -> runtime error.
Parameters
planeIndexThe global unique index of the regression plane whose reference normal should be computed.
Returns
The computed reference normal for the plane, or (0,0,1) if no valid configuration is provided.

◆ getGridReferenceNormalByName()

agx::Vec3 agxTerrain::TerrainWheelPlane::getGridReferenceNormalByName ( agx::String  name) const

Query the reference normal associated with a named regression-plane group using the new regression-plane configuration system.

A regression-plane "name" may correspond to multiple plane indices. This method:

  1. Resolves all plane indices associated with the given name using 'getRegressionPlaneIndicesByName(name)'.
  2. For each resolved plane index, computes its reference normal using 'getGridReferenceNormal()', which may depend on:
    • 'gridCombinations'
    • 'gridCombinationsIndicesReferenceNormal'
    • averaged regression-plane normals
  3. Accumulates all valid normals and returns the normalized average.

Fallback behavior:

  • If no valid normals are available, returns the Z-up vector **(0,0,1)**.
Parameters
nameThe name identifying one or more regression-plane groups.
Returns
The normalized average reference normal of all referenced planes, or (0,0,1) if none are available.

◆ getPlanesInitialized()

bool agxTerrain::TerrainWheelPlane::getPlanesInitialized ( ) const

◆ getQuantities()

agxTerrain::TerrainWheelQuantities * agxTerrain::TerrainWheelPlane::getQuantities ( )
protected

◆ getRadius()

agx::Real agxTerrain::TerrainWheelPlane::getRadius ( ) const
protected

◆ getRegressionPlaneAveragedNormalByName()

agx::Vec3 agxTerrain::TerrainWheelPlane::getRegressionPlaneAveragedNormalByName ( agx::String  name) const

Get the averaged regression-plane normal for a named group.

The name is resolved to a list of unique regression-plane indices, and a group key is constructed from those indices. This method then:

1) Looks up a cached averaged normal in m_regressionPlanesData.groupKeyToAveragedNormal. 2) If present, returns the cached value. 3) Otherwise, accumulates per-plane normals from m_regressionPlanesData.uniquePlaneNormals, computes their arithmetic mean, and normalizes the result.

If no valid normals are available, the returned vector is (0,0,0).

Parameters
nameLogical group name (e.g. "force_feedback_plane", "front_angle_plane", "rear_angle_plane", "rear_and_front_angle_reference_plane").
Returns
Normalized average of all per-plane normals in the group, or (0,0,0) if the group is empty or contains no valid normals.

◆ getRegressionPlaneAveragePointByName()

agx::Vec3 agxTerrain::TerrainWheelPlane::getRegressionPlaneAveragePointByName ( agx::String  name) const

Get the averaged regression-plane average point for a named group.

For the set of plane indices associated with name, this method:

1) Builds a group key and checks the cache m_regressionPlanesData.groupKeyToAveragedAveragePoint. 2) If a cached averaged point exists, returns it. 3) Otherwise, sums the per-plane average points taken from m_regressionPlanesData.uniquePlaneAveragePoints and divides by the number of contributing planes.

If no valid average points are available, the method returns (0,0,0).

Parameters
nameLogical group name (e.g. "force_feedback_plane", "front_angle_plane", "rear_angle_plane", "rear_and_front_angle_reference_plane").
Returns
Arithmetic mean of all per-plane average points in the group, or (0,0,0) if the group is empty or contains no valid points.

◆ getRegressionPlaneAveragePointsByName()

std::vector< agx::Vec3 > agxTerrain::TerrainWheelPlane::getRegressionPlaneAveragePointsByName ( agx::String  name) const

Get all regression-plane average points for a named group.

The name is resolved to a list of unique regression-plane indices via getRegressionPlaneIndicesByName(). For that index set, this method:

1) Builds a stable group key (comma-separated indices). 2) Checks the cache m_regressionPlanesData.groupKeyToAveragePoints. 3) If a cached entry is found, returns it. 4) Otherwise, collects the per-plane average points from m_regressionPlanesData.uniquePlaneAveragePoints and returns them as a new vector.

Each average point is the centroid of the corresponding regression plane's sampled contact points.

Parameters
nameLogical group name (e.g. "force_feedback_plane", "front_angle_plane", "rear_angle_plane", "rear_and_front_angle_reference_plane").
Returns
Vector of per-plane average points for the named group. Returns an empty vector if the name maps to no planes.

◆ getRegressionPlaneIndicesByName()

std::vector< agx::Int > agxTerrain::TerrainWheelPlane::getRegressionPlaneIndicesByName ( agx::String  name) const

Resolve the list of unique regression-plane indices associated with a logical regression-plane name, using the grid-combination system.

Steps:

  1. Resolve the grid-combination index and group indices for the given name via resolveGridCombinationConfigForPlaneName().
  2. For each group of base grid indices in the selected combination, find the corresponding unique regression-plane index using findRegressionPlaneIndexForBaseGridIndices().
  3. Deduplicate the resulting list while preserving order.

If no valid planes can be resolved for the given name, the function reports a LOGGER_WARNING and returns an empty vector.

Parameters
nameLogical plane name: "force_feedback_plane", "front_angle_plane", "rear_angle_plane", "rear_and_front_angle_reference_plane".
Returns
Vector of unique regression-plane indices corresponding to the plane name. Empty if resolution fails.

◆ getRegressionPlaneNormalsByName()

std::vector< agx::Vec3 > agxTerrain::TerrainWheelPlane::getRegressionPlaneNormalsByName ( agx::String  name) const

Get all regression-plane normals for a named group.

The name is resolved to a list of unique regression-plane indices via getRegressionPlaneIndicesByName(). For that index set, this method:

1) Builds a stable group key (comma-separated list of indices). 2) Looks up a cached vector of normals in m_regressionPlanesData.groupKeyToNormals. 3) If a cached entry exists, returns it directly. 4) Otherwise, gathers per-plane normals from m_regressionPlanesData.uniquePlaneNormals and returns them as a new vector.

The normals are unit-length vectors in world coordinates.

Parameters
nameLogical group name (e.g. "force_feedback_plane", "front_angle_plane", "rear_angle_plane", "rear_and_front_angle_reference_plane").
Returns
Vector of per-plane normals associated with the given name. If the name does not map to any regression planes, the returned vector is empty.

◆ getRegressionPlanesParameters()

RegressionPlanesParameters * agxTerrain::TerrainWheelPlane::getRegressionPlanesParameters ( ) const

Get the paramaters that control how regression planes are generated, combined, and updated each timestep to represent the terrain under the wheel.

◆ getSettings()

agxTerrain::TerrainWheelSettings * agxTerrain::TerrainWheelPlane::getSettings ( ) const
protected

◆ getTerrainElementSize()

agx::Real agxTerrain::TerrainWheelPlane::getTerrainElementSize ( ) const
protected

◆ getWheelPosition()

agx::Vec3 agxTerrain::TerrainWheelPlane::getWheelPosition ( ) const
protected

◆ getWheelTransform()

agx::AffineMatrix4x4 agxTerrain::TerrainWheelPlane::getWheelTransform ( ) const
protected

◆ getWidth()

agx::Real agxTerrain::TerrainWheelPlane::getWidth ( ) const
protected

◆ initializeRegressionPlanes()

void agxTerrain::TerrainWheelPlane::initializeRegressionPlanes ( )

Initialize all regression-plane structures using the grid-combination-based configuration.

This is the master entry point for the regression-plane initialization pipeline. It performs:

1) initializeRegressionPlanesValidGridPointsSetIndices()

  • Identify and validate all base grid indices referenced anywhere in the configuration.

2) initializeRegressionPlanesGridPointsSet()

  • Build the wheel-local XY sampling templates for each valid grid.

3) initializeRegressionPlanesUniqueGridPointsCombinationsSet()

  • Build the full set of unique combined grid-point groups (include/exclude handling, adaptation handling, etc.).

4) initializeRegressionPlanesNameToRegressionPlaneIndices()

  • Build the name -> plane-index map used by the runtime.

This function defines the complete initialization sequence for the regression-plane system.

◆ initializeRegressionPlanesGridPointsSet()

void agxTerrain::TerrainWheelPlane::initializeRegressionPlanesGridPointsSet ( )

Initialize the per-grid template point sets used when constructing regression planes.

For each grid index listed in m_regressionPlanesData.validGridPointsSetIndices, this method constructs a wheel-local XY template of sampling points (z = 0), stored in: m_regressionPlanesData.gridPointsSet[gi]

All other grid indices remain empty.

Details:

Shape
  Each grid must specify "rectangle" or "ellipse" in gridsShape[gi].
  Any other value causes a runtime error.

Resolution (Nx, Ny)
  Taken from gridsNumGridPoints[gi], clamped to >= 1.

Center (cx, cy)
  Read from gridsCenterPoint[gi] and scaled using
  gridsCenterPointScale[gi] via computeScaledLength().

Step Size (dx, dy)
  Read from gridsStepSize[gi] and scaled using gridsStepSizeScale[gi].
  Non-positive values default to m_terrainElementSize.

Point Generation
  Points lie on an (Nx * Ny) lattice centered at (cx, cy).
  For "ellipse", points outside the inscribed ellipse are discarded.
  A small epsilon is added to ellipse radii to ensure axis-aligned
  lattice points are included and degenerate cases work cleanly.

Preconditions: initializeRegressionPlanesValidGridPointsSetIndices() has been run, so validGridPointsSetIndices contains a validated set of grid indices.

Postconditions: For each valid grid index gi, gridPointsSet[gi] contains the complete set of wheel-frame XY sampling points (z = 0).

◆ initializeRegressionPlanesNameToRegressionPlaneIndices()

void agxTerrain::TerrainWheelPlane::initializeRegressionPlanesNameToRegressionPlaneIndices ( )

Build the name -> regression-plane indices map using the grid-combination-based configuration.

This function constructs the internal mapping from plane names (e.g. "force_feedback_plane", "front_angle_plane", etc.) to lists of regression-plane indices, using:

  • gridCombinations
  • gridCombinationIndexForceFeedbackPlane
  • gridCombinationIndexFrontAnglePlane
  • gridCombinationIndexRearAnglePlane
  • gridCombinationIndexRearAndFrontAngleReferencePlane

Processing steps:

1) Collect all raw base-grid index groups via collectRegressionPlaneIndexGroups().

2) Normalize each group by:

  • removing grid indices that are not part of the validated set validGridPointsSetIndices
  • sorting and deduplicating

3) Deduplicate the normalized groups while preserving first-seen order. Each deduplicated group becomes one "unique regression plane."

4) For each named plane type, obtain its grid-index groups using the getters:

Normalize each target group and map it to its corresponding unique-plane index.

The results are written to:

m_regressionPlanesData.nameToPlaneIndices

and the mapping is marked as valid.

◆ initializeRegressionPlanesUniqueGridPointsCombinationsSet()

void agxTerrain::TerrainWheelPlane::initializeRegressionPlanesUniqueGridPointsCombinationsSet ( )

Build the unique grid-point combinations used by the regression-plane configuration.

Each "group" is a list of base-grid indices belonging to one regression plane (from gridCombinations). This function builds the combined set of sampling points for each unique group.

Processing steps:

1) Collect raw index groups using collectRegressionPlaneIndexGroups().

2) For each group:

  • Produce a "normalized" index list containing only valid grid indices, sorted and deduplicated.
  • Deduplicate groups using this normalized form, preserving the first-seen order. The deduplicated groups define the set of unique regression-plane groups.

3) For each unique group, construct its combined point set:

  • For each grid gi in the group (in order): If contribution mode is "include": Add its template points, merging duplicates. When duplicates occur, prefer points from grids that do NOT adapt to rear/front angles. If contribution mode is "exclude": Remove any points from the combination that match the grid's template points.
  • Grid shape ("rectangle"/"ellipse"), scaled centers, half-extents, and step sizes are used to determine inclusion/exclusion and boundary behavior. A small inflate margin ensures robust boundary treatment.

4) Store results in:

  • m_regressionPlanesData.uniqueGridPointsCombinationsSet
  • m_regressionPlanesData.uniqueGridPointsCombinationsSourceGridIndex

These represent the complete combined sampling sets for all regression planes defined by the configuration.

◆ initializeRegressionPlanesValidGridPointsSetIndices()

void agxTerrain::TerrainWheelPlane::initializeRegressionPlanesValidGridPointsSetIndices ( )

Initialize the set of valid base-grid indices used by the new regression-plane pipeline.

This function interprets 'gridCombinations' as the complete and authoritative description of which base regression-plane grids are used anywhere in the new system.

Processing steps:

  1. Validate all referenced grid indices Every base-grid index appearing inside 'gridCombinations' is checked against '[0, numGrids)', where 'numGrids' is the number of configured grids (from 'gridsCenterPoint'). Invalid indices are rejected, reported with LOGGER_WARNING, and ignored.
  2. Collect all referenced base-grid indices All groups from all combinations are traversed, and all referenced grid indices are appended to a collection.
  3. Sort and deduplicate The collected indices are sorted and duplicates removed, producing the set of unique, valid grid indices used anywhere in the new configuration.

The final set is stored in 'm_regressionPlanesData.validGridPointsSetIndices'.

Note: This function is not yet used in the legacy initialization pipeline. It is a helper for future systems based exclusively on the new regression-plane configuration.

◆ isForceFeedbackHeightField()

static bool agxTerrain::TerrainWheelPlane::isForceFeedbackHeightField ( const agxCollide::Geometry *  geometry)
static

Check whether the given geometry is marked as a force feedback heightfield.

This method queries the tagging state of a geometry to determine if it is registered as part of the force feedback system. Such geometries are used in specialized contact processing between the terrain and wheel to compute reaction and deformation forces. Regular geometries return false.

Parameters
geometryPointer to the AGX collision geometry to check.
Returns
True if the geometry is marked as a force feedback heightfield, false otherwise.

◆ isValid()

bool agxTerrain::TerrainWheelPlane::isValid ( ) const

◆ onAdd()

void agxTerrain::TerrainWheelPlane::onAdd ( agxSDK::Simulation *  simulation)

◆ onRemove()

void agxTerrain::TerrainWheelPlane::onRemove ( agxSDK::Simulation *  simulation)

◆ planeNameToString()

static agx::String agxTerrain::TerrainWheelPlane::planeNameToString ( PlaneName  plane)
static

◆ resolveGridCombinationConfigForPlaneName()

bool agxTerrain::TerrainWheelPlane::resolveGridCombinationConfigForPlaneName ( const agx::String &  name,
agx::Int &  combinationIndex,
std::vector< agx::Int > &  normalGroupIndices,
std::vector< agx::Int > &  originGroupIndices 
) const

Resolve the grid-combination configuration for a logical regression-plane name using the grid-combination system.

This method identifies which entry in:

  • gridCombinations
  • gridCombinationsIndicesReferenceNormal
  • gridCombinationsIndicesOrigin should be used for the named regression-plane category.

On success:

  • combinationIndex is set to the selected grid-combination index.
  • normalGroupIndices is filled with the group indices inside that combination that supply the reference-normal information.
  • originGroupIndices is filled with the group indices inside that combination that supply the origin-point information.

If the name does not correspond to a configured regression-plane category, or if the associated combination index is negative, the function returns false and all outputs are cleared.

Parameters
nameLogical plane name: "force_feedback_plane", "front_angle_plane", "rear_angle_plane", "rear_and_front_angle_reference_plane".
combinationIndexOutput: grid-combination index (>= 0 on success, -1 on failure).
normalGroupIndicesOutput: group indices for normal computation.
originGroupIndicesOutput: group indices for origin computation.
Returns
true if a valid configuration was found; false otherwise.

◆ setEnableForceFeedback()

void agxTerrain::TerrainWheelPlane::setEnableForceFeedback ( bool  enable) const

◆ setIsForceFeedbackHeightField()

void agxTerrain::TerrainWheelPlane::setIsForceFeedbackHeightField ( agxCollide::Geometry *  geometry,
bool  enable 
)

Mark or unmark a geometry as a force feedback heightfield.

This method tags the given geometry as participating in the force feedback system. When enabled, the geometry is recognized during contact processing and treated as a special heightfield for generating terrain-wheel interaction forces. When disabled, the geometry is excluded from such processing and behaves as a regular collision object.

Parameters
geometryPointer to the AGX collision geometry to tag or untag as a force feedback heightfield.
enableTrue to mark the geometry as a force feedback heightfield, false to remove the tag.

◆ setPlanesInitialized()

void agxTerrain::TerrainWheelPlane::setPlanesInitialized ( bool  enable)
protected

◆ setRegressionPlanesParameters()

void agxTerrain::TerrainWheelPlane::setRegressionPlanesParameters ( RegressionPlanesParameters *  params)

Set the paramaters that control how regression planes are generated, combined, and updated each timestep to represent the terrain under the wheel.

◆ showRegressionPlaneDebugText()

void agxTerrain::TerrainWheelPlane::showRegressionPlaneDebugText ( )

Display on-screen labels for the currently active regression-plane categories.

When the RENDER_REGRESSION_PLANES option is enabled, this function renders a small legend overlay that associates each plane category with the color used for its debug geometry. The following categories are drawn:

  • HeightField: FORCE FEEDBACK
  • Axes: GRID
  • Reg.Plane: FORCE FEEDBACK
  • Reg.Plane: FRONT ANGLE
  • Reg.Plane: REAR ANGLE
  • Reg.Plane: (REF) REAR AND FRONT ANGLE

For each regression-plane category, all plane indices associated with its name are obtained via getRegressionPlaneIndicesByName(...), and one label per plane is drawn using that plane's debug color triplet.

Text is laid out from the lower-left corner of the screen and stacked downward with a fixed vertical spacing. This function does not modify the simulation state; it only affects debug UI output.

Precondition
RENDER_REGRESSION_PLANE is enabled and a renderer is available.
initializeRegressionPlanes() and initializeRegressionPlanesNameToRegressionPlaneIndices() have been called, and updateUniqueRegressionPlanes() plus updateRegressionPlaneNormalsAndAveragePoints() have produced a current set of unique regression planes and colors.

◆ updateForceFeedbackHeightField()

void agxTerrain::TerrainWheelPlane::updateForceFeedbackHeightField ( const agx::Vec3 &  normal,
const agx::Vec3 &  point,
const agx::AffineMatrix4x4 &  transform 
)

Update the transformation of the force feedback heightfield.

This method reorients and repositions the force feedback heightfield so that it follows the wheel's motion and maintains correct alignment with the local terrain surface. The heightfield rotates together with the wheel.

The heightfield's center point is computed as: c_ff = c_w - ((c_w - point) * normal) * normal which represents the projection of the wheel center onto the heightfield along the heightfield normal.

Parameters
normalReference normal used to align the heightfield's orientation.
pointPoint on the force feedback heightfield used to position it in space.
transformTransform to update the force feedback heightfield with.

◆ updateRearAndFrontAngles()

bool agxTerrain::TerrainWheelPlane::updateRearAndFrontAngles ( )

◆ updateRegressionPlaneNormalsAndAveragePoints()

void agxTerrain::TerrainWheelPlane::updateRegressionPlaneNormalsAndAveragePoints ( )

Compute and update cached regression-plane normals and average points, both per-plane and per named group.

This method operates on the current set of unique regression planes in m_regressionPlanesData.uniquePlanes and the name-to-plane index mapping in m_regressionPlanesData.nameToPlaneIndices (built by initializeRegressionPlanesNameToRegressionPlaneIndices()).

It performs two levels of caching:

1) Per-plane caches:

  • m_regressionPlanesData.uniquePlaneNormals Unit normal for each unique regression plane.
  • m_regressionPlanesData.uniquePlaneAveragePoints Average point of each unique regression plane.

2) Per-group caches (group of plane indices): For each distinct index set associated with any plane name (e.g. "force_feedback_plane", "front_angle_plane", "rear_angle_plane", "rear_and_front_angle_reference_plane"):

  • groupKeyToNormals List of per-plane normals in that group.
  • groupKeyToAveragePoints List of per-plane average points in that group.
  • groupKeyToAveragedNormal Normalized arithmetic mean of the group's normals.
  • groupKeyToAveragedAveragePoint Arithmetic mean of the group's average points.

These caches support efficient access patterns for querying per-plane and per-group regression-plane properties in subsequent steps and debug rendering.

Precondition
initializeRegressionPlanes() has been called for the current configuration, updateUniqueRegressionPlanes() has been run for the current step, and initializeRegressionPlanesNameToRegressionPlaneIndices() has built a valid name -> indices mapping.
Postcondition
m_regressionPlanesData.uniquePlaneNormals and m_regressionPlanesData.uniquePlaneAveragePoints are resized to match uniquePlanes, and all group-level maps (groupKeyTo*) are rebuilt to reflect the current plane indices and contents.

◆ updateRegressionPlanesForwardSign()

void agxTerrain::TerrainWheelPlane::updateRegressionPlanesForwardSign ( )

Update the sign of the forward direction of the grid coordinate systems specifying the directions in which to place grid points.

These grid points are used to compute regression planes.

Assume (world coordinates) that the wheel axis is Y and that the wheel moves linearly in the positive x-direction and that, at that point, a particular regression plane is to the right of the wheel. If the wheel then starts to move in the negative x-direction, then that plane will be to the left of the wheel due to the flipped forward sign.

Also, the forward sign updated by this method is used to determine which angle should be the front angle and which should be the rear angle.

◆ updateTerrainWheelPlane()

void agxTerrain::TerrainWheelPlane::updateTerrainWheelPlane ( bool &  shouldUpdateMajorObjects,
const agx::RealVector &  weights 
)

◆ updateUniqueRegressionPlanes()

void agxTerrain::TerrainWheelPlane::updateUniqueRegressionPlanes ( )

Update all unique regression planes using the new regression-plane pipeline.

This method recomputes the regression plane for each unique grid-point combination in m_regressionPlanesData.uniqueGridPointsCombinationsSet and stores the results in m_regressionPlanesData.uniquePlanes.

For each combination:

  • The corresponding template points are copied into a local vector.
  • computeRegressionPlane(...) is invoked with that point set and the plane's index.
  • The resulting agxCollide::RegressionPlane is written back into the uniquePlanes array.

If no terrains are currently in contact, the function skips all computation for this step (optionally printing a debug message when PRINT_GENERAL_INFO is enabled).

Precondition
initializeRegressionPlanes() has been called and m_regressionPlanesData.uniqueGridPointsCombinationsSet has been populated for the current configuration.
Postcondition
m_regressionPlanesData.uniquePlanes has the same size as m_regressionPlanesData.uniqueGridPointsCombinationsSet and contains up-to-date regression planes for this simulation step.

Member Data Documentation

◆ AGXTERRAIN_TERRAINWHEEL_STORE_RESTORE_INTERFACE

agxTerrain::TerrainWheelPlane::AGXTERRAIN_TERRAINWHEEL_STORE_RESTORE_INTERFACE

Definition at line 110 of file TerrainWheelPlane.h.

◆ m_forceFeedbackGeometry

agxCollide::GeometryRef agxTerrain::TerrainWheelPlane::m_forceFeedbackGeometry {nullptr}

Definition at line 1356 of file TerrainWheelPlane.h.

◆ m_forceFeedbackHeightField

agxCollide::HeightFieldRef agxTerrain::TerrainWheelPlane::m_forceFeedbackHeightField {nullptr}

Definition at line 1353 of file TerrainWheelPlane.h.

◆ m_forceFeedbackHeightFieldDimensions

agx::Vec2 agxTerrain::TerrainWheelPlane::m_forceFeedbackHeightFieldDimensions

Definition at line 1350 of file TerrainWheelPlane.h.

◆ m_initialized

bool agxTerrain::TerrainWheelPlane::m_initialized

Definition at line 1346 of file TerrainWheelPlane.h.

◆ m_regressionPlanesData

RegressionPlanesData agxTerrain::TerrainWheelPlane::m_regressionPlanesData

Definition at line 1396 of file TerrainWheelPlane.h.

◆ m_regressionPlanesForwardSign

agx::Int agxTerrain::TerrainWheelPlane::m_regressionPlanesForwardSign = 1

Definition at line 1366 of file TerrainWheelPlane.h.

◆ m_regressionPlanesHaveValidContactFrame

bool agxTerrain::TerrainWheelPlane::m_regressionPlanesHaveValidContactFrame {false}

Definition at line 1363 of file TerrainWheelPlane.h.

◆ m_regressionPlanesParameters

RegressionPlanesParametersRef agxTerrain::TerrainWheelPlane::m_regressionPlanesParameters

Definition at line 1347 of file TerrainWheelPlane.h.

◆ m_wheel

TerrainWheel* agxTerrain::TerrainWheelPlane::m_wheel

Definition at line 1345 of file TerrainWheelPlane.h.


The documentation for this class was generated from the following file: