Fix raster handling
This commit is contained in:
parent
f957c8fb7b
commit
6c0a14c5dc
@ -598,6 +598,9 @@ function WayHandlers.weights(profile,way,result,data)
|
||||
if (result.backward_mode ~= mode.inaccessible and result.backward_speed > 0) then
|
||||
result.backward_rate = 1
|
||||
end
|
||||
elseif profile.standard_rate then
|
||||
result.forward_rate = 1
|
||||
result.backward_rate = 1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -42,8 +42,8 @@ RasterDatum RasterSource::GetRasterData(const int lon, const int lat) const
|
||||
return {};
|
||||
}
|
||||
|
||||
const std::size_t xth = static_cast<std::size_t>(round((lon - xmin) / xstep));
|
||||
const std::size_t yth = static_cast<std::size_t>(round((ymax - lat) / ystep));
|
||||
const std::size_t xth = static_cast<std::size_t>(round((lat - xmin) / xstep));
|
||||
const std::size_t yth = static_cast<std::size_t>(round((lon - ymin) / ystep));
|
||||
|
||||
return {raster_data(xth, yth)};
|
||||
}
|
||||
@ -57,9 +57,7 @@ RasterDatum RasterSource::GetRasterInterpolate(const int lon, const int lat) con
|
||||
}
|
||||
|
||||
const auto xthP = (lon - xmin) / xstep;
|
||||
const auto ythP =
|
||||
(ymax - lat) /
|
||||
ystep; // the raster texture uses a different coordinate system with y pointing downwards
|
||||
const auto ythP = (lat - ymin) / ystep;
|
||||
|
||||
const std::size_t top = static_cast<std::size_t>(fmax(floor(ythP), 0));
|
||||
const std::size_t bottom = static_cast<std::size_t>(fmin(ceil(ythP), height - 1));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user