[Math] A formula to convert a counter-clockwise angle to clockwise angle with an offset

algebra-precalculus

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?

Best Answer

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}]$.

Related Question