Commit 059483bd authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

Merge branch '530-check-sapt-against-whole-track'

parents c0c50594 32603058
......@@ -216,71 +216,28 @@ std::vector< WPosition > WAngleHelper::findSmoothestPath( std::vector< WPosition
return findSmoothestPath( positions );
}
std::vector< WPosition > out;
std::vector< WPosition > pos;
auto posIter = positions.begin();
auto fibIter = fiber.begin();
osg::Vec3* oldFib = nullptr;
// Selection before fiber
if( posIter->z() < fibIter->z() )
// intertwine positions and fiber.
while( posIter < positions.end() )
{
std::vector< WPosition > pos;
while( posIter < positions.end() && posIter->z() < fibIter->z() )
if( fibIter >= fiber.end() || posIter->z() < fibIter->z() )
{
pos.push_back( *posIter );
posIter++;
}
pos.push_back( *fibIter );
pos = findSmoothestPath( pos );
out.insert( out.end(), pos.begin(), pos.end() );
}
// Selection between fiber
while( fibIter < fiber.end() && posIter < positions.end() )
{
if( fibIter->z() == posIter->z() )
else if( posIter->z() == fibIter->z() )
{
posIter++;
}
else if( fibIter->z() > posIter->z() )
{
std::vector< WPosition > pos;
if( oldFib != nullptr )
{
pos.push_back( WPosition( *oldFib ) );
}
while( posIter < positions.end() && posIter->z() < fibIter->z() )
{
pos.push_back( *posIter );
posIter++;
}
pos.push_back( WPosition( *fibIter ) );
pos = findSmoothestPath( pos );
out.insert( out.end(), pos.begin(), pos.end() );
}
else
{
oldFib = &( *fibIter );
pos.push_back( *fibIter );
fibIter++;
}
}
// Selection after fiber
if( posIter < positions.end() )
{
std::vector< WPosition > pos;
if( oldFib != nullptr )
{
pos.push_back( WPosition( *oldFib ) );
}
while( posIter != positions.end() )
{
pos.push_back( *posIter );
posIter++;
}
pos = findSmoothestPath( pos );
out.insert( out.end(), pos.begin(), pos.end() );
}
return out;
return findSmoothestPath( pos );
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment