use signed slope to distinguish uphills and downhills

This commit is contained in:
Michael Krasnyk
2017-03-29 13:43:47 +02:00
parent e39dc3c464
commit 8f8df969a2
3 changed files with 6 additions and 5 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ function segment_function (segment)
local scaled_duration = segment.duration
if sourceData.datum ~= invalid and targetData.datum ~= invalid then
local slope = math.abs(sourceData.datum - targetData.datum) / segment.distance
local slope = (targetData.datum - sourceData.datum) / segment.distance
scaled_weight = scaled_weight / (1.0 - (slope * 5.0))
scaled_duration = scaled_duration / (1.0 - (slope * 5.0))
io.write(" slope: " .. slope .. "\n")