How to map points from one dimension to another?

305 Views Asked by At

I want to map graph from one coordinate system to another, the aspect ratio must be preserved.

The change is:

x [-2, +2] to [0, 800]

y [-1.5, +1.5] to [0, 600]

I want to understand how such transformation is performed from a given old dimensions to new one. How does one go from old xmin, xman to new xmin, xmax and same for the y coordinates??

I assume that as long as the new and old system's aspect ratio is same, the image will not be stretched or compressed.

I only need a formula that shall make it possible to find what point in what system corresponds to what point in the other system.

1

There are 1 best solutions below

4
On BEST ANSWER

The formula for linear-transformation is:

$$newVal=(oldVal-oldMin)\cdot\frac{newMax-newMin}{oldMax-oldMin}+newMin$$


Hence:

  • $x'=(x-(-2))\cdot\frac{800-0}{2-(-2)}+0$
  • $y'=(y-(-1.5))\cdot\frac{600-0}{1.5-(-1.5)}+0$