There are two functions to compute the tangent in the C + + standard library, one is Atan (y/x) and the other is atan2 (y, x).
Atan2 (y, x) is a 4 quadrant tangent, and its value depends not only on the tangent y/x, but also on which quadrant the point (x, y) falls into: When the point (x, y) falls into the first image limit, the atan2 (y, x) range is 0 ~ PI/2; When the point (x, y) falls into the second image limit, the range of atan2 (y, x) is PI/2 ~ Pi; When the point (x, y) falls into the third image limit, the range of atan2 (y, x) is-PI~-PI/2; When the point (x, y) falls into the four-image limit, the range of atan2 (y, x) is-pi/2~0.
and Atan (y/x) only according to the tangent of y/x to find the corresponding angle (can be seen as just 2 quadrant tangent): When the y/x > 0 o'clock, Atan (y/x) value range is 0 ~ PI/2; when y/x < 0 o'clock, Atan (y/x) value range is-pi/ 2~0.
So atan2 (y, x) = Atan (y/x) only occurs at the point (x, y) that falls into the first quadrant (x>0, y>0) or the fourth quadrant (X>0, y<0).
For example, suppose y = 1.0, X =-1.0, then Atan (y/x) = Atan ( -1.0) =-pi/4, and atan2 (y, x) = 3*pi/4.