math.atan2

From Garry's Mod
Revision as of 03:27, 24 July 2016 by Zerf (Talk | contribs)
Jump to: navigation, search
 math.atan2( )

Contents

Description

Returns math.atan(y / x) in radians. The result is between -math.pi and math.pi.

Arguments

number y

Y coordinate.

Arguments

number x

X coordinate.

Returns

number

atan2

Examples

Example

atan( 1 ) and atan2( 1, 1 ) are both math.pi / 4

atan2( -1, -1 ) equals to ( (-3) * math.pi ) / 4

print( atan( 1 ) )
print( ata2( 1, 1 ) )
print( atan2( -1, -1 ) )

Output:

0.7853981633974483

0.7853981633974483

-2.356194490192345
Personal tools
Navigation