if i remember correct everything is positive from 0 to pi/2, in pi/2 to p only the sin is positive, cos is positive from p to 3pi/2
so if I get a negative θ and z for example is from 0 to pi/2 I should just have tan^-1(b/a)
if I am from pi/2 to p, I should have p - tan^-1(b/a)
from p to...