# Convert coordinates from Cartesian system to non-orthogonal axes

I have a 2D coordinate system defined by two non-perpendicular axes. I wish to convert from a standard Cartesian (rectangular) coordinate system into mine. Any tips on how to go about it?

-
1. What's the angle between your axes? 2. Does your system share an origin with the Cartesian one? – J. M. Sep 7 '11 at 16:00
The angle between the axes is arbitrary. If it helps, they could share an origin with the Cartesian one. – andygeers Sep 7 '11 at 16:07
In that case... – J. M. Sep 7 '11 at 16:11
In the standard Cartesian frame, the basis is $e_1,e_2$. Choose $I=(e_1,e_2)$. Now your basis is $a_1,a_2$, choose $A=(a_1,a_2)$. Then the relationship between the new coordinate $x'$ and old one $x$ is $Ix=Ax'$. So $x'=A^{-1}x$ – Shiyu Sep 8 '11 at 1:47

Sure. Let's approach this in a very elementary way: with matrix algebra.

Suppose that our two new 'basis vectors' are given by $(\alpha _1, \alpha _2)$ and $(\beta _1, \beta_2)$, e.g. $(1,1)$ and $(1,0)$.

Then our goal is to find a linear combination of them such that we can express some given vector, which we will imaginatively denote as $(x, y)$. In particular, this will allow us to find where a standard point is in our new, nonstandard coordinate system.

But this is nothing more than solving the system: $$\left( \begin{array}{cc} \alpha_1 & \beta_1 \\ \alpha_2 & \beta_2 \end{array} \right) \left( \begin{array}{c} a \\ b \end{array}\right)= \left( \begin{array}{c} x \\ y\end{array}\right)$$ for the unknown a and b values. In particular, this means that if the matrix is invertible (meaning that your axes are not parallel), then you can immediately find where any particular points are in your system.

Is that what you were looking for?

-

I'll make the assumption that the oblique coordinate system $(u,v)$ with angle $\varphi$ and the Cartesian system $(x,y)$ share an origin.

Consider the following diagram:

First, we have the relationship $x=u+h$. The acute angle formed by the $v$-axis and $h$ is $\varphi$, since alternate interior angles in a pair of parallel lines are congruent. We use trigonometry to deduce the relation $y=h\tan\,\varphi$. Eliminating $h$ gives the equation for $u$: $u=x-y\cot\,\varphi$.

To find an expression for $v$, we see that this length is equal to the length of the hypotenuse of the right triangle with legs $y$ and $h$. This leads to the equation $y=v\sin\,\varphi$. Solving for $v$ gives the equation $v=y\csc\,\varphi$.

Thus, the conversion formulae from Cartesian to oblique coordinates with angle $\varphi$ are

\begin{align*}u&=x-y\cot\,\varphi\\v&=y\csc\,\varphi\end{align*}

For completeness, the formulae for converting from oblique to Cartesian coordinates are

\begin{align*}x&=u+v\cos\,\varphi\\y&=v\sin\,\varphi\end{align*}

-

Let us denote by "old" the usual cartesian system with orthogonal axes and by "new" the system with the skew axes $(\alpha_1, \alpha_2)^T, (\beta_1, \beta_2)^T$ (expressed in the old system). An old vector $(x,y)^T$ can be expressed as a linear combination of the skew vectors: $$\left( \begin{array}{c} x \\ y \end{array}\right) = a \left( \begin{array}{c} \alpha_1 \\ \alpha_2\end{array}\right) + b \left( \begin{array}{c} \beta_1 \\ \beta_2\end{array}\right) = \left( \begin{array}{cc} \alpha_1 & \beta_1 \\ \alpha_2 & \beta_2 \end{array} \right) \left( \begin{array}{c} a \\ b \end{array}\right) = A \left( \begin{array}{c} a \\ b \end{array}\right)$$ Using this equation we can transform vectors from the new skew system to the old orthogonal system. Note that the columns of the matrix A are built from the coordinates of the skew basis vectors.

In order to transform from the the old orthogonal system to new skew system we need to invert the above equation and we get:

$$\left( \begin{array}{c} a \\ b \end{array}\right) = A^{-1} \left( \begin{array}{c} x \\ y \end{array}\right) = \frac{1}{\alpha_1 \beta_2 - \alpha_2 \beta_1} \left( \begin{array}{cc} \beta_2 & -\beta_1 \\ -\alpha_2 & \alpha_1 \end{array}\right) \left( \begin{array}{c} x \\ y \end{array}\right)$$

The above invverse matrix $A^{-1}$ should be computed once and then used for the transformation of all needed points. The inversion is possible when the respective denominator is not zero, i.e. when the new skew axes are not parallel.

-
Jiri's answer is wonderful, but there is a missing minus sign in upper right element in the inverted matrix. – user106231 Nov 7 '13 at 19:50