I'm trying to come up with a good conversion formula to go from one definition of angles in a circle to another.
In the origin system, zero is up, 90 is right, 180 is down, 270 is left.
In the target system, zero is right, -90 is down, +/- 180 is left, 90 is up.
Going backwards is easy: y=(-x+90)%360. Can anyone figure out how to go forwards in a single equation?
Let $\,\alpha \in [0, 360)\,$ be this angle.
Let $\,\beta\,$ be this angle, but the
+/- 180part makes it ambiguous whether you mean the target angle to be $\beta \in (-270,90]$ vs. $\beta \in (-180,180]\,$:if you mean $\,\beta \in (-270,90]\,$, then just use $\,\beta = 90 - \alpha\,$;
if you mean $\,\beta \in (-180,180]\,$, then use $\,\beta = 180 - (\alpha + 90) \;\%\; 360\,$.