Is there a simple formula that would give me the angle of a 2D vector with integer coordinates in -1, 0, +1. More precisely, I'm looking for the fastest way to calculate the following function:
(1,0) -> 0 (1,1) -> 1 (0,1) -> 2 (-1,1) -> 3 (-1,0) -> 4 (-1,-1) -> 5 (0,-1) -> 6 (1,-1) -> 7