math/rad

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m
m (Also menu state)
 
Line 3: Line 3:
 
|Parent=math
 
|Parent=math
 
|Description=Converts an angle in degrees to it's equivalent in radians.
 
|Description=Converts an angle in degrees to it's equivalent in radians.
|Realm=Shared
+
|Realm=Shared and Menu
 
|IsClass=No
 
|IsClass=No
 
}}
 
}}

Latest revision as of 03:31, 24 July 2016

 math.rad( )

Contents

Description

Converts an angle in degrees to it's equivalent in radians.

Arguments

number degrees

The angle measured in degrees.

Returns

number

radians

Examples

Example

Convert various angles in degrees to their equivalent in radians.

print( "Degrees: 360, Radians: " .. math.rad( 360 ) ) -- 2*pi
print( "Degrees: 180, Radians: " .. math.rad( 180 ) ) -- pi
print( "Degrees: 90, Radians: " .. math.rad( 90 ) ) -- pi/2
print( "Degrees: 1, Radians: " .. math.rad( 1 ) ) -- pi/180

Output:


Degrees: 360, Radians: 6.2831853071796

Degrees: 180, Radians: 3.1415926535898
Degrees: 90, Radians: 1.5707963267949

Degrees: 1, Radians: 0.017453292519943
Personal tools
Navigation