math.sin

From GMod Wiki

Revision as of 23:33, 13 April 2011 by -UNC- TZScribblez™ (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax math.sin( Number )
Where is this used?
Description:
Returns the sine 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.sin]Math.sin [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionGets the sine of 30 radians. This is very different from 30 degrees.
Used onNewerShared.png
Code
local angle = math.sin(30)
OutputThe variable angle will be set to -0.9880316...


DescriptionGets the sine of pi/6 radians. This is equivalent to 30 degrees.
Used onNewerShared.png
Code
local angle = math.sin( math.pi / 6 )
OutputThe variable angle will be set to 0.5


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


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox