## How to transform cartesian coordinates into polar coordinate, relate to a segment, also called Azimuth.

Etymology (by Wikipedia)

The word azimuth is in all European languages today. It originates from medieval Arabic al-sumūt, pronounced as-sumūt in Arabic, meaning “the directions” (plural of Arabic al-samt = “the direction”).
Consider the figure

In this post we talk about Azimuth and Distance between two points.

We know the cartesian coordinate of two points: A, B.

If we want to know polar coordinates of point B, relating point A, we assume that A is a new center of a Polar Coordinate System.

In this way we can transport te axes origin from O to A.

Looking the cartesian system A, x’, y’ we call azimuth of point B on point A the angle (AB):

$\tan{(AB)}=\dfrac{x_B - x_A}{y_B - y_A}$

And we determinate the distance AB between A and B:

$AB = \dfrac{x_B - x_A}{\sin{(AB)}}= \dfrac{y_B - y_A}{\cos{(AB)}}$

The proof of these is very easy: just consider the right triangle ABB’, we obtain the relations with Basic right-triangles solvings.

At the same way we can determine Az. (BA) and the distance BA, looking the cartesian system B, x”, y”

$\tan{(BA)}=\dfrac{x_A - x_B}{y_A - y_B}$

$BA = \dfrac{x_A - x_B}{\sin{(BA)}} = \dfrac{y_A - y_B}{\cos{(BA)}}$

It is possible call (BA) the reverse angle of (AB), because: $(BA) = (AB) \pm 180^o$

From the same triangle ABB’ (or ABA’) we can determinate inverse relations. These relations are most used in topography for transform survey data (they are commonly in polar coordinate system, angles and distances) into cartesian coordinates.

We have:

$\Delta x = x_B - x_A = AB \sin{(AB)}~~\rightarrow~~x_B = x_A + AB\sin{(AB)}$ (1)

and

$\Delta y = y_B - y_A = AB\cos{(AB)}~~\rightarrow~~y_B = x_A + AB\cos{(AB)}$ (2)

## NOTE for inverse operations

If we use (1) and (2) directly, from AB and (AB) we obtain the exact values of cartesian coordinates, such as the Frist or the Fourth quadrant. But if we use inverse relations for determine AB or (AB), we have to consider the quadrant.

The inverse operations for determine (AB) from cartesian coordinate give more than one results, and mathematically is an indeterminate problem.

### Samples

Consider A and B both into the frist cartesian quadrant:

$A \equiv (0,0),~~ AB = 21 m ~,~~(AB) = 30^o$

$\rightarrow~~x_B = 0 + 21 \cdot \dfrac{1}{2} =10.5 m ~~,~y_B = \dfrac{21 \cdot \sqrt{3}}{2}=18.2 m$

and if we want to determine (AB) from cartesian coordinates:

$(AB) = \arctan{\dfrac{x_B - x_A}{y_B - y_A}}$

$(AB)=\arctan{\dfrac{10.5}{18.2}m}=\arctan{0.577}$

$\rightarrow~~\tan{(AB)} = 0.577$

In according to what saw in “Inverse trigonometric funcions” post, the inverse relation give more than one results:

in our case: $(AB)_1 = 30^o ~,~~(AB)_2= 210^o$

It is important to delete the N.A. solutions after frist angle calculation for determine the correct Azimuth (AB)!

## Implementations

### A) Determine the values of cartesian coordinates of these points, data from topography survey

 Point Azimuth $\theta$ distance d A 300°56′ 53″ 217,35 mt B 33° 25′ 22″ 296,48 mt C 208° 17′ 14″ 180,07 mt D 132° 31′ 36″ 353,74

For each points we can obtain the cartesian coordinates:

$x = d \sin(\theta)$ and $y = d \sin(\theta)$

We write the results in other two new columns of the table

 Point Azimuth $\theta$ distance d [mt] x [mt] y[mt] A 300°56′ 53″ 217,35 -186,40 111,78 B 33° 25′ 22″ 296,48 163,30 247,44 C 208° 17′ 14″ 180,07 -85,33 -158,57 D 132° 31′ 36″ 353,74 260,70 -239,11

### B) Convert cartesian coordinates into polar of a new rotated and translated system

$(y' y) = \alpha = 320^{o}24'12''$

The coordinate of original system are:

 point x y A +201,26 +241,18 B +157,62 -160,34 C -274,57 -77,83 D -89,65 +290,09 O’ -47,37 +171,14

#### solution:

Using these relations:

$x' = (x - x_{O'}) \cos(\alpha) - (y - y_{O'}) \sin(\alpha)$ $y' = (x - x_{O'}) \sin(\alpha) - (y - y_{O'}) \cos(\alpha)$

The new coordinates are:

 point x’ y’ A + 236,22 -104,50 B -53,32 -386,08 C -333,76 -47,03 D +43,24 +118,61

### C) Determine the intersection point between two lines

We can determine the cartesian coordinate of an intersection point, we have the coordinates of extremes of the lines.

 Point x y A 43.12 154.33 B 320.12 63.88 C 119.22 44.8 D 290.15 245.12

#### Solution

Determine the values of azimuth (AB) and (CD) as slopes of their lines

$m_{AB} = tan(AB) = \dfrac{x_B - x_A}{y_B - y_A}=\dfrac{277.0}{-90.45}=-3.0624654$ $m_{CD} = tan(CD) = \dfrac{x_D - x_C}{y_D - y_C} = \dfrac{170.93}{200.32} = 0.85328474$

Using analytic notation for line equation $y = mx + q$ we have for a line trough a generic point Q: $(y - y_Q)=m(x - x_Q)$

There are infinite lines that passing trough P, we consider the lines that starting from A and from C. We know their slopes $m_{AB} = m_{AP}, m_{CD}=m_{CP}$.

$x_P - x_A = m_{AP}(y_P - y_A);~~x_P = m_{AB} (y_P - y_A) + x_A$ $x_P - x_C = m_{CD}(y_P - y_C);~~[m_{AB} (y_P - y_A) + x_A] - x_C = m_{CD}(y_P - y_C)$ $y_P= \dfrac{(m_{AB} y_A + x_C - x_A - m_{CD} y_C)}{ m_{AB}-m_{CD}} = \dfrac{-434.75}{-3.9157528}~~y_P=111.03$ $x_P = m_{AB}(y_P-y_A) + x_A = 175.74$