Built-in functions: math_atan2()

The function math_atan2() is a complementary function of math_tan().

Declaration

float math_atan2( float aY, float aX )

Parameters

aY

The Y coordinate of a point to calculate the angle.

aX

The X coordinate of a point to calculate the angle.

Discussion

The inverse trigonometric function math_atan2() calculates the arctangent for the given point aY, aX. The function returns an angle value expressed in degree lying in the range -180.0 .. +180.0. For example:

var float angle = math_atan2( 1.0, -1.0 ); // angle = 135.0