print -> io.write
This commit is contained in:
parent
38db495879
commit
1b1274fd56
@ -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
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user