0
votes

I have two applications which use to slightly different coordinate systems, they are as follows:

Coordinate System 1 & 2 Range:

  • Range of X = 0 to 850
  • Range of Y = 0 to 1100

Now when I place the same image on these two systems they occur in different spots as the "starting" point of image differs. System 1 places the image based on the coordinates of the top left corner the image and System 2 places the image based on the coordinates of the bottom right corner of the image.

Here is an example the systems placing the image in the same spot:

System 1 Top Left of Coordinate System:

  • x=0
  • y=0

System 2 Top Left of Coordinate System:

  • x=0
  • y=47

System 1 Top Right of Coordinate System:

  • x=699
  • y=0

System 2 Bottom Right of Coordinate System:

  • x=699
  • y=47

System 1 Bottom Right of Coordinate System:

  • x=699
  • y=1053

System 2 Top Right of Coordinate System:

  • x=699
  • y=1100

My question is, how can I create a ratio that takes this into account and applies the same position based on these coordinate systems?

Thank you so much!

1

1 Answers

0
votes

If I understand the problem correctly:

  • Adding an image to System 1 at position (x, y), positions it x units from the left of the system origin and y units from the top of the system origin.
  • Adding an image to System 2 at position (x, y), positions it x units from the right of the system origin and y units from the bottom of the system origin.

To convert from positioning relative to the bottom right, to positioning relative to the top left, you need to change x in System 1 to 850 - imageWidth in System 2, and change y in System 2 to 1100 - imageHeight in System 2. Then you need to shift things since the two systems are quite aligned.

Based on the example you gave for two aligned images, it looks like:

  • If an image with width w and height h is positioned at (x, y) in System 1, then it should be positioned at (699 - w - x, 1100 - h - y) in System 2.
  • If an image with width w and height h is positioned at (x, y) in System 2, then it should be positioned at (w - 699 - x, h - 1100 - y) in System 1.

I hope that answers your question.