print -> io.write

This commit is contained in:
Patrick Niklaus 2016-03-23 15:40:11 +01:00
parent 38db495879
commit 1b1274fd56
2 changed files with 8 additions and 8 deletions

View File

@ -32,15 +32,15 @@ end
function segment_function (source, target, distance, weight) function segment_function (source, target, distance, weight)
local sourceData = sources:interpolate(raster_source, source.lon, source.lat) local sourceData = sources:interpolate(raster_source, source.lon, source.lat)
local targetData = sources:interpolate(raster_source, target.lon, target.lat) local targetData = sources:interpolate(raster_source, target.lon, target.lat)
print ("evaluating segment: " .. sourceData.datum .. " " .. targetData.datum) io.write("evaluating segment: " .. sourceData.datum .. " " .. targetData.datum .. "\n")
local invalid = sourceData.invalid_data() local invalid = sourceData.invalid_data()
if sourceData.datum ~= invalid and targetData.datum ~= invalid then if sourceData.datum ~= invalid and targetData.datum ~= invalid then
local slope = math.abs(sourceData.datum - targetData.datum) / distance local slope = math.abs(sourceData.datum - targetData.datum) / distance
print (" slope: " .. slope) io.write(" slope: " .. slope .. "\n")
print (" was speed: " .. weight.speed) io.write(" was speed: " .. weight.speed .. "\n")
weight.speed = weight.speed * (1 - (slope * 5)) weight.speed = weight.speed * (1 - (slope * 5))
print (" new speed: " .. weight.speed) io.write(" new speed: " .. weight.speed .. "\n")
end end
end end

View File

@ -32,15 +32,15 @@ end
function segment_function (source, target, distance, weight) function segment_function (source, target, distance, weight)
local sourceData = sources:query(raster_source, source.lon, source.lat) local sourceData = sources:query(raster_source, source.lon, source.lat)
local targetData = sources:query(raster_source, target.lon, target.lat) local targetData = sources:query(raster_source, target.lon, target.lat)
print ("evaluating segment: " .. sourceData.datum .. " " .. targetData.datum) io.write("evaluating segment: " .. sourceData.datum .. " " .. targetData.datum .. "\n")
local invalid = sourceData.invalid_data() local invalid = sourceData.invalid_data()
if sourceData.datum ~= invalid and targetData.datum ~= invalid then if sourceData.datum ~= invalid and targetData.datum ~= invalid then
local slope = math.abs(sourceData.datum - targetData.datum) / distance local slope = math.abs(sourceData.datum - targetData.datum) / distance
print (" slope: " .. slope) io.write(" slope: " .. slope .. "\n")
print (" was speed: " .. weight.speed) io.write(" was speed: " .. weight.speed .. "\n")
weight.speed = weight.speed * (1 - (slope * 5)) weight.speed = weight.speed * (1 - (slope * 5))
print (" new speed: " .. weight.speed) io.write(" new speed: " .. weight.speed .. "\n")
end end
end end