Originally Posted by Garkin
You have to count with distance from the center, not from the top / left side.
scale_x = (new_dx - 0.5) / (old_dx - 0.5)
scale_y = (new_dy - 0.5) / (old_dy - 0.5)
function translate_old_coords(x, y)
return 0.5 + ((x - 0.5) * scale_x), 0.5 + ((y - 0.5) * scale_y)
end
|
No. new_dx and old_dx are X-distances between two POIs. Map center is not involved in my formula, precisely because the whole map might be shifted, in which case rescaling is not enough.