atan2 [function]
atan2( y, x )
returns the extended arctangent of y/x (angle in radians), as real
- Signs of
x
andy
are used to determine the quadrant, thusy
is expected to be the sine of the angle to be returned (they
coordinate of a point) andx
- the cosine (thex
coordinate).
Due to the common requirement to use this function to determine the angle between two somewhat random points (usually from a simulation), it will not emit a warning when both arguments are 0 - it will return 0 instead.
atan2( 0, 1 ); // real (0) atan2( 1, 0 ); // real (1.5708) atan2( -1, -1 ); // real (-2.35619) atan2( 0, 0 ); // real (0)