AGX Dynamics  2.35.0.1
agxVehicle::utils Namespace Reference

Functions

void createGeometryBox (const TrackNode &node)
 
TrackNodeRange createRangeExcludingNodeIndex (const Track &track, agx::UInt nodeIndex, agx::Int signedNumNodes)
 Creates a node range where nodeIndex is excluded and number of nodes to include is signed. More...
 
agx::UInt nextIndex (agx::UInt index, agx::UInt size)
 
agx::UInt prevIndex (agx::UInt index, agx::UInt size)
 
template<typename ContainerT >
IndexRangeContainer splitNonconsecutive (const ContainerT &container)
 Given a sorted container this function will split the content into ranges where the elements are consecutive. More...
 
template<typename ContainerT >
IndexRangeContainer splitNonconsecutive (const Track &track, const ContainerT &container)
 Splits a sorted container into ranges where each split happens when container[ i ] - container[ i - 1 ] > 1. More...
 

Function Documentation

◆ createGeometryBox()

◆ createRangeExcludingNodeIndex()

TrackNodeRange agxVehicle::utils::createRangeExcludingNodeIndex ( const Track &  track,
agx::UInt  nodeIndex,
agx::Int  signedNumNodes 
)
inline

Creates a node range where nodeIndex is excluded and number of nodes to include is signed.

E.g., given [0 1 2 3 4 5]: nodeIndex = 3, numNodes = +3 -> [4 5 0] nodeIndex = 3, numNodes = -4 -> [5 0 1 2].

Definition at line 128 of file TrackUtils.h.

References agxVehicle::Track::getIterator(), agx::InvalidIndex, agxVehicle::Track::nodes(), and agxSDK::LinkedSegmentRange< T >::size().

◆ nextIndex()

agx::UInt agxVehicle::utils::nextIndex ( agx::UInt  index,
agx::UInt  size 
)
inline
Returns
the next index so if index == size - 1 the result will be 0

Definition at line 116 of file TrackUtils.h.

References agxAssert, and agx::InvalidIndex.

◆ prevIndex()

agx::UInt agxVehicle::utils::prevIndex ( agx::UInt  index,
agx::UInt  size 
)
inline
Returns
the previous index so if index == 0 the result will be size - 1

Definition at line 107 of file TrackUtils.h.

References agxAssert, and agx::InvalidIndex.

◆ splitNonconsecutive() [1/2]

template<typename ContainerT >
IndexRangeContainer agxVehicle::utils::splitNonconsecutive ( const ContainerT &  container)

Given a sorted container this function will split the content into ranges where the elements are consecutive.

Parameters
container- sorted container with values
Returns
ranges where each range holds elements in consecutive order

Definition at line 42 of file TrackUtils.h.

References agxAssert, and agx::IndexRangeT< T >::end().

Referenced by splitNonconsecutive().

◆ splitNonconsecutive() [2/2]

template<typename ContainerT >
IndexRangeContainer agxVehicle::utils::splitNonconsecutive ( const Track &  track,
const ContainerT &  container 
)

Splits a sorted container into ranges where each split happens when container[ i ] - container[ i - 1 ] > 1.

The ranges are transformed back to the track node indices and if the last node is included the first range will include the last nodes. E.g., three ranges with number of nodes = 60: [0 1 2][45 46][57 58 59] will at the end be two ranges: [57 58 59 0 1 2][45 46].

Definition at line 70 of file TrackUtils.h.

References agxAssert, agxVehicle::Track::nodes(), agx::Container::size(), agxSDK::LinkedSegmentRange< T >::size(), and splitNonconsecutive().