I have an equation to translate coordinate from one coordinate system to another but I don't understand how it works

44 Views Asked by At

I've been given an equation to move coordinates from one system to another, however I do not understand how this equation works.

Here are the two systems side by side(left is system 1, the one I wish to translate from, and the right is system 2, the one I wish to translate to)

Coordinate Systems

 mx = (u – minU) / (tWidth) × mWidth + minX
   
 my = (1 – ((v – minV) / (tHeight)) × mHeight - minY
 

mx: transformed x coordinate on second coordinate system

u: x coordinate we wish to translate on coordinate system 1

tWidth: the width of coordinate system 1, this is 1

minU: the minimum x value we can have on coordinate system 1, this is 0

mWidth: the width of coordinate system 2, this is 2

minX: the minimum x coordinate we may have in system 2, this is 2

The same applies to each y value. This equation works, but I have little idea how. I understand the division/multiplication(this is scaling) but not the subtraction of the minimum x and then the adition.... I would appreciate an explanation.