math.tan

From GMod Wiki

Jump to: navigation, search
Function
Syntax math.tan( Number )
Where is this used?
Description:
Returns the tangent of a number (in radians).
Returns: Number number
Part of Library: Math
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Math.tan]Math.tan [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionGets the tangent of 45 degrees (returned in radians).
Used onNewerShared.png
Code
local angle = math.tan(45)
OutputThe variable angle will be set to 1.619775...
DescriptionGet the tangent of 45 degrees after having converted it to radians. This would be useful if you are using degrees in your code and want to get the tangent of an angle not expressed in radians.
Used onNewerShared.png
Code
local angle = math.tan( math.rad(45) )
OutputThe variable angle will be set to 1. This is the tangent of 45 NOT in radians.


See Also

Math

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox