how to map series of coordinates onto a series of coordinates with different resolution

61 Views Asked by At

I have a set of target coordinates and a set of actually clicked coordinates which should be approximately the same, but not identical. The y coordinates are equal, however, the x-coordinates differ, such that negative coordinates are closer together than larger/positive coordinates. e.g.:

target_y  actual_y
-691     -580
-675     -520
-650     -500
-638     -480
-588    - 420
-538     -320
-480     -260
-355    -60
-301    160
-301    360
-297     -560
-295     380
-222     100
-205     120
-203    120
-169     220
-103     300
-102    240
-41     360
-17     420
17      500
72      560
72      580
112     600

the difference is equal for all series, so I want to determine a function that tranforms the actual_y into the range of the target_y. I am thinking of something like target=0.2*actual-50. how can I find the correct function?

-- my edit was not needed, sorry

2

There are 2 best solutions below

0
On BEST ANSWER

Let $m_T:= \min_{y\in\text{Target}} y$, $M_T:= \max_{y\in\text{Target}} y$, $m_A:= \min_{y\in\text{Actual}} y$ and $M_A:= \max_{y\in\text{Actual}} y$.

If I understand you correctly, you are now looking for an affine map $f:\mathbb{R}\rightarrow \mathbb{R}$ such that $f\left(m_A\right)=m_T$ and $f\left(M_A\right)=M_T$.

First calculate $m_A,m_T,M_A$ and $M_T$. With $f\left(x\right)=a\cdot x + b$ you get the linear system \begin{align} a\cdot m_A+b=& m_T\\ a\cdot M_A+b=& M_T. \end{align} By substraction and division you get $a=\frac{m_T-M_T}{m_A-M_A}.$ Plug this in one of the two equations to get the value for $b$.

1
On

If you look at a plot of the actual Y as a function of the target Y, you observe that the mapping is approximately linear, with errant points.

enter image description here

In your case I would recommend to just use the equation of the straight line through the first and last points.