>The problem with the first approach was 180 degrees. That was the source of the wrong results
>
>I was looking into sin and cos
>
>ps: Add a test for c == 0 ( ie 90 or 270 degrees)
>
>pps: How are you going to make the distinction between quadrants I and III ( same for II and IV)
You can always turn to arc cotangent when you cross over 45 degrees, i.e. when the y axis segment is larger than the x axis segment.
As for the quadrants, there's always checking the sign of the segments, i.e. which is positive which is negative. Going by segments, x and y are ++, -+. --, +-.