i want to verify that is my formulas are correct or not for finding angle of a point form the origin.
1st => (Atan(y/x) * (180/PI))
2nd => 180 - (Atan(y/-x) * (180/PI))
3rd => 180 + (Atan(-y/-x) * (180/PI))
4th => 360 - (Atan(y/x) * (180/PI)
i want to verify that is my formulas are correct or not for finding angle of a point form the origin.
1st => (Atan(y/x) * (180/PI))
2nd => 180 - (Atan(y/-x) * (180/PI))
3rd => 180 + (Atan(-y/-x) * (180/PI))
4th => 360 - (Atan(y/x) * (180/PI)
Copyright © 2021 JogjaFile Inc.
Your formulas look ok. (except the 4th Quadrant, should be + sign)
But, instead of forcing positive atan argument, why not just do atan(y/x) ?
atan(y/x) principle angle is between $±\pi/2$
If you don't mind negative angles, 1st and the 4th Quadrant is covered.
Since period of $\tan x$ is $\pi$, for 2nd and 3rd Quadrant, just add or subtract $\pi$
If atan2(y, x) is available, it will sort out these details. If not, you can build your own.
see Charles Petzold's blog, Atan2 and Exceptions (and why there aren't any)