11

I have an angle in the coordinate system where $0^\circ$ is East, $90^\circ$ is North, $180^\circ$ is West, and $270^\circ$ is South.

I need to convert them to this one, where $0^\circ$ is North, $90^\circ$ is East, $180^\circ$ is South, and $270^\circ$ is West. Is there a determined algorithm to do this sort of transformation?

Mike Pierce
  • 18,938

2 Answers2

13

If $\theta$ is your original angle, then $(-\theta + 90^{\circ}) \bmod 360^{\circ}$ will work. The negative on $\theta$ deals with the fact that we are changing from counterclockwise to clockwise. The $+90^{\circ}$ deals with the offset of ninety degrees. And lastly we need to mod by $360^{\circ}$ to keep our angle in the desired range $[0^{\circ},360^{\circ}]$.

Mike Pierce
  • 18,938
2

A formula that you are asking:

$E=E_2-E_1$ and $N=N_2-N_1$, and is working for any value of $E$ and $N$.

$$f(E,N)=\pi-\frac{\pi}{2} \left(1+\text{sign }N\right) (1-\text{sign }E^2)-\frac{\pi}{4} \left(2+\text{sign }N\right) \text{sign }E -\text{sign } (N E) \ \text{atan }\frac{\lvert N\rvert-\lvert E\rvert}{\lvert N\rvert+\lvert E\rvert}$$

The formula gives a clockwise angle from $0$-north to $2\pi$.

dantopa
  • 10,342