Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 9ab8ce85 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

distance cycle: avoid driving beyond end of cycle

parent 5dc2d323
No related branches found
No related tags found
No related merge requests found
......@@ -119,7 +119,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
default:
return retVal;
}
if (ds.IsEqual(newds, 1e-3.SI<Meter>())) {
if (newds.IsEqual(0, 1e-3) || ds.IsEqual(newds, 1e-3.SI<Meter>())) {
return retVal;
}
Log.Debug("Exceeding next ActionDistance at {0}. Reducing max Distance to {1}", nextAction.ActionDistance, newds);
......
......@@ -189,6 +189,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return cycleIterator.RightSample.Distance;
}
} while (cycleIterator.RightSample.Distance < PreviousState.Distance + ds && cycleIterator.MoveNext());
if (cycleIterator.LastEntry) {
return cycleIterator.RightSample.Distance;
}
return null;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment