0
$\begingroup$

I am using the math from this artice: https://msdn.microsoft.com/en-us/library/jj635757(v=vs.85).aspx to create a generic conversions matrix I can use to convert between 2 coordinate systems.

If I apply it to the examples the math works perfectly, but if I try to use it between 2 coordinate systems defined by these points

$$(x1, y1) = (1, 1)$$ $$(x'1, y'1) = (1, 1)$$ $$(x2, y2) = (2, 2)$$ $$(x'2, y'2) = (2, 2)$$

Basically, this is the same coordinate system so I would expect a transformation on a point to result in the same point.

Using the math from the article I get this

$$\mathbf{M} = \begin{bmatrix} 1 & 1 & 1 & 0 \\ -1 & 1 & 0 & 1 \\ 2 & 2 & 1 & 0 \\ -2 & 2 & 0 & 1 \\ \end{bmatrix} $$

and

$$\mathbf{u} = \begin{bmatrix} 1 \\ 1 \\ 2 \\ 2 \\ \end{bmatrix} $$

And the result is that

$$a=0$$$$b=1$$$$c=0$$$$d=0$$

examplified here as well: https://www.wolframalpha.com/input/?i=inv%7B%7B1,1,1,+0%7D,%7B-1,1,0,1%7D,+%7B2,+2,+1,+0%7D,+%7B-2,+2,+0,+1%7D%7D+.+%7B%7B1%7D,+%7B1%7D,+%7B2%7D,+%7B2%7D+%7D

So when I use these numbers to convert (2, 1) I would like to get (2, 1) but I get (1, 2)

$$x = ax + by + c = 0*2 + 1*1 + 0 = 1$$ $$y = bx - ay + d = 1*2 + 0*1 + 0 = 2$$

$\endgroup$
  • $\begingroup$ Welcome to MSE. Please use MathJax to format your question. $\endgroup$ – user507623 Jan 8 '18 at 13:59
0
$\begingroup$

What you have gotten is a transformation which reflects your coordinate system across the $y=x$ line; in other words, it switches the $x$-axis and the $y$-axis. So $(1,1)$ is still $(1,1)$ and $(2,2)$ is still $(2,2)$, but $(2,1)$ becomes $(1,2)$, as you noted.

For whatever reason, the math in that article doesn't allow a transformation which keeps the coordinate system the same. Getting $x' = x$ which require $a = 1$, but getting $y' = y$ would require $a = -1$.

$\endgroup$
  • $\begingroup$ Is there a way I can create a matrix that will work with the coordinate system that is the same (or very similar)? $\endgroup$ – Kim Jan 8 '18 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.