For this problem, you can use the formula \(tg(q) = {y \over x}\). We need to find the angle q
(i.e. \(q = arctg({y \over x})\)).
There is one point where \(q < 0\). In this case, we will do this:
if (q < 0) q = q + 2 * pi;
where
\(pi = 3.141592654\).