math.AngleDifference

From Garry's Mod
Jump to: navigation, search
 math.AngleDifference( )

Contents

Description

Calculates the difference between two angles.

Arguments

number a

The first angle.

Arguments

number b

The second angle.

Returns

number

The difference between the angles between -180 and 180

Examples

Example

Find the angle difference between various angles

print("Angle difference between 159 and 240 is " .. math.AngleDifference(159, 240))
print("Angle difference between 240 and 159 is " .. math.AngleDifference(240, 159))
print("Angle difference between 58 and 145 is " .. math.AngleDifference(58, 145))

Output:


Angle difference between 159 and 240 is -81

Angle difference between 240 and 159 is 81

Angle difference between 58 and 145 is -87
Personal tools
Navigation