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

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

bugfix: distance-based cycle: computation of road gradient was wrong after refactoring

parent 2a9971c6
No related branches found
No related tags found
No related merge requests found
......@@ -156,25 +156,25 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
private Radian ComputeGradient(Meter ds)
{
var leftSamplePoint = CycleIntervalIterator.LeftSample;
//var leftSamplePoint = CycleIntervalIterator.LeftSample;
var cycleIterator = CycleIntervalIterator.Clone();
while (cycleIterator.RightSample.Distance < PreviousState.Distance + ds && !cycleIterator.LastEntry) {
cycleIterator.MoveNext();
}
var leftSamplePoint = cycleIterator.LeftSample;
var rightSamplePoint = cycleIterator.RightSample;
var gradient = leftSamplePoint.RoadGradient;
if (leftSamplePoint.Distance.IsEqual(rightSamplePoint.Distance)) {
return gradient;
return leftSamplePoint.RoadGradient;
}
CurrentState.Altitude = VectoMath.Interpolate(leftSamplePoint.Distance, rightSamplePoint.Distance,
leftSamplePoint.Altitude, rightSamplePoint.Altitude, PreviousState.Distance + ds);
gradient = VectoMath.InclinationToAngle(((CurrentState.Altitude - PreviousState.Altitude) /
(ds)).Value());
var gradient = VectoMath.InclinationToAngle(((CurrentState.Altitude - PreviousState.Altitude) /
(ds)).Value());
//return 0.SI<Radian>();
return gradient;
}
......
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