# Cartesian coordinate conversion

I have a Cartesian coordinate system that is rotated and translated relative to another Cartesian coordinate system. I would like to be able to take any (x,y) in the first system and calculate the equivalent (x,y) in the second one. The coordinate systems have the same units and scale, so only a translation and rotation is applied.

This should just be 'simple' trigonometry, but I can't seem to get anything to work.

Any suggestions?

Thanks,

Gerald

-

Ignore the points $A,B,C,D$ in the following sketch.

The translation corresponds to the change of variables

$$x=\overline{x}+X,\qquad y=\overline{y}+Y,\tag{1}$$

and the rotation corresponds to

$$X=x^{\prime }\cos \theta -y^{\prime }\sin \theta,\qquad Y=x^{\prime }\sin \theta +y^{\prime }\cos \theta .\tag{2}$$

If you combine $(1)$ and $(2)$, you get

$$x=\overline{x}+x^{\prime }\cos \theta -y^{\prime }\sin \theta,\qquad y=\overline{y}+x^{\prime }\sin \theta +y^{\prime }\cos \theta .\tag{3}$$

You can invert this system of equations to get $x',y'$ in terms of $x,y$ and $\overline{x},\overline{y}$:

$$x^{\prime }=x\cos \theta +y\sin \theta -\overline{x}\cos \theta -\overline{y}\sin \theta \tag{4a}$$

$$y^{\prime }=-x\sin \theta +y\cos \theta +\overline{x}\sin \theta -\overline{y}\cos \theta .\tag{4b}$$

The rotation and the translation transformation can be expressed by matrices. The rotation transformation in two dimensions is described in this Wikipedia section.

-
Thank you very much! –  Gerald Jun 19 '12 at 0:10
@Gerald You are welcome! –  Américo Tavares Jun 19 '12 at 0:44