Thread: 2.1 update
View Single Post
09/05/15, 11:57 AM   #64
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by merlight View Post
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.
Ah, ok. I have misunderstand what were values in formula.

So for Alik'r Desert it will be (3 decimal places, I don't have more for old coordinates):

scale_x = (0.9008 - 0.2224) / (0.957 - 0.178) = 0.871
scale_y = (0.6435 - 0.3484) / (0.665 - 0.326) = 0.871

offset_x = 0.9008 - 0.957 * 0.871 = 0.067
offsey_y = 0.6435 - 0.665 * 0.871 = 0.064

Code:
function translate_old_coords(x, y)
    return x * scale_x + offset_x, y * scale_y + offset_y
end
Sandblown Mine:
new_x = 0.877 * 0.871 + 0.067 = 0.831 (expected 0.8312)
new_y = 0.592 * 0.871 + 0.064 = 0.580 (expected 0.5806)


Lost City of the Na-Totambu:
new_x = 0.732 * 0.871 + 0.067 = 0.705 (expected 0.7050)
new_y = 0.373 * 0.871 + 0.064 = 0.389 (expected 0.3890)

Last edited by Garkin : 09/05/15 at 12:06 PM.
  Reply With Quote