Reputation: 563
According to LibGDX's coordinate system, (0, 0) is the bottom left corner. I would like to be able to specify where (0, 0) is in world coordinates.
In the picture, the point (200, 200)
is relative to the zero in the bottom left corner. How can I (mathematically or built-in function) change the coordinates to be relative to the other zero?
The I have the coordinates of the second zero relative to the zero in the bottom left corner, and for this purpose let's set it to (800, 500)
Upvotes: 1
Views: 1288
Reputation: 363
Sorry if I'm misunderstanding your question, but you should just be able to add the new "0" to your coordinates.
As an example, to modify the point (200, 200) to be relative to (800, 500) you would change it to (1000, 700), or (200 + 800, 200 + 500).
Upvotes: 0
Reputation: 397
Simply find the distance between (200, 200) and (800, 500) before you set the new zero.
x distance: x1 - x2
y distance: y1 - y2
xDist = 200 - 800 = -600
yDist = 200 - 500 = -300
So your new point in relation to the new zero is (-600, -300).
Upvotes: 1