SHIP:Sail:atan2

From Serious Documentation
Jump to: navigation, search
Function Returns Introduced Description
atan2 Float v5.1.0 Calculates the radian angle of the specified x,y coordinates

See Also:

Prototype

Float atan2(Float y, Float x);

Parameters/Return Value

Parameter Data Type Description
y Float the y coordinate to take the arctan of
x Float the x coordinate to take the arctan of
Return Float atan2(y, x)

Detailed Description

The atan() function returns the arctan of the supplied value in radians. If you want to return an angle in degrees you can use toDegrees(atan2(y, x))

Examples

Example Result Notes
toDegrees(atan2(-1, -1)); -135
toDegrees(atan2(1, 1)); 45
toDegrees(atan2(0.5f, 2.4f)); 12
toDegrees(atan2(1, 0)); 90