31 geometry->setLocalTransform( transform );
41 template<
typename ContainerT>
44 if ( container.size() < 2 )
47 agxAssert( std::is_sorted( container.begin(), container.end() ) );
50 for (
agx::UInt i = 1; i < container.size(); ++i ) {
51 if ( container[ i ] == container[ i - 1 ] +
typename ContainerT::value_type( 1 ) )
52 ++result.back().
end();
69 template<
typename ContainerT>
75 if ( result.size() == 1 && result.front().empty() )
83 for (
agx::UInt i = 0; i < result.size(); ++i ) {
84 auto& range = result[ i ];
85 const auto size = range.
size();
86 range.begin() = container[ range.begin() ];
87 range.end() = range.begin() + size;
90 if ( result.size() < 2 )
95 const auto numNodes = track.
nodes().
size();
96 if ( result.front().begin() ==
agx::UInt( 0 ) && result.back().end() == numNodes ) {
97 result.front().begin() = result.back().begin();
110 return index == 0 ? size - 1 : index - 1;
119 return ( index + 1 ) % size;
130 const auto totalNumNodes = track.
nodes().
size();
131 if ( totalNumNodes < 1 )
132 return track.
nodes();
134 const agx::UInt numNodes = signedNumNodes < 0 ?
139 if ( signedNumNodes < 0 ) {
140 beginIndex = nodeIndex > numNodes ?
141 nodeIndex - numNodes :
142 nodeIndex + totalNumNodes - numNodes;
143 endIndex = nodeIndex;
146 beginIndex = ( nodeIndex + 1 ) % totalNumNodes;
147 endIndex = ( nodeIndex + numNodes + 1 ) % totalNumNodes;
void createGeometryBox(const TrackNode &node)
static AffineMatrix4x4T< Real > translate(const Vec3T< Real > &dv)
Return a matrix which translates according to dv.
Segment range object for linked structure.
agxSDK::LinkedSegmentRange< TrackNode > TrackNodeRange
Node range object for tracks.
agx::UInt prevIndex(agx::UInt index, agx::UInt size)
void AGXCORE_EXPORT transform(void *target, const Format *targetFormat, const void *source, const Format *sourceFormat, size_t numElements)
Transform data between two buffers.
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex
Node/segment/shoe object in agxVehicle::Track.
The geometry representation used by the collision detection engine.
IndexRangeContainer splitNonconsecutive(const ContainerT &container)
Given a sorted container this function will split the content into ranges where the elements are cons...
bool add(agxCollide::Geometry *geometry, const agx::AffineMatrix4x4 &localTransform, bool incrementalMassCalculation=false)
Connect a geometry to this rigid body.
agx::IndexRangeT< agx::UInt > IndexRange
agx::RigidBody * getRigidBody() const
Iterator getIterator(agx::UInt index) const
A box shape for geometric intersection tests.
This namespace contains classes related to vehicles dynamics.
agx::UInt nextIndex(agx::UInt index, agx::UInt size)
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...
Assembly object representing a continuous track with a given number of shoes (nodes).
const agx::Vec3 & getHalfExtents() const