Skip to content

Commit

Permalink
core: hack missing post path traction and grades
Browse files Browse the repository at this point in the history
The path's context only extends until the end of the path. Hence, for an SvL located further along, the tractive effort and the slopes are missing. In this commit, we hack it to make it work, but we could potentially extend the path's context so it goes until the last SvL, if it breaks nothing.

Signed-off-by: Erashin <[email protected]>
  • Loading branch information
Erashin committed Mar 4, 2025
1 parent b82438d commit 574a3e7
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ public double getMinGrade(double begin, double end) {
// TODO: Optimise method by adding in a cache.
int indexBegin = getIndexBeforePos(begin);
int indexEnd = getIndexBeforePos(end);
// TODO: Remove if we extend path properties until last SvL > path.length.
if (indexBegin == indexEnd && indexBegin == gradePositions.length - 1)
// Take last grade value in this case
return gradeValues[gradeValues.length - 1];
var lowestGradient = gradeValues[indexBegin];
for (int i = indexBegin; i < indexEnd; i++) {
var grad = gradeValues[i];
Expand Down

0 comments on commit 574a3e7

Please sign in to comment.