YOUR CREATIONS & GUIDES


Ryzom Database https://ryzom.silenda.de/

Its not that complicated to translate coords.

You need source rectangle sLeft,sBottom,sRight,sTop and sX,sY
You need to calculate
sWidth=sRight-sLeft
sHeight=sTop-sBottom
and relative position to anchor (left/bottom)
sRelX = (sX-sLeft)/sWidth
sRelY = (sY-sBottom)/sHeight

Then you can translate sRelX,sRelY to destination rectangle
for which you need dLeft,dBottom,dWidth,dHeight (left/bottom as same anchor point)
dX = dLeft + dWidth*sRelX
dY = dBottom - dHeight*sRelY

For fyros ingame
sLeft=15840, sBottom=-27040, sRight=20320, sTop=-23840
sWidth=4480, sHeight=3200, sX=18161, sY=-25510

and fyros_map.png
dLeft=0, dBottom=728, dWidth=1016, dHeight=728
gives dX=526, dY=379

--

If you now want to go from fyros_map.png back to ingame,
you just swap source/destination rectangles.
Now source is sLeft=0, sBottom=728, sRight=1016, sTop=0
sWidth=1016, sHeight=-728, sX=526, sY=379

and destination is dLeft=15840,dBottom=-27040,dWidth=4480,dHeight=3200

---

Hello!
Show topic
Last visit Thursday, 28 March 15:48:08 UTC
P_:

powered by ryzom-api