math.sin
From GMod Wiki
Revision as of 23:33, 13 April 2011 by -UNC- TZScribblez™ (Talk | contribs)
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: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Math.sin]Math.sin [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | Gets the sine of 30 radians. This is very different from 30 degrees. |
---|---|
Used on | |
Code | local angle = math.sin(30) |
Output | The variable angle will be set to -0.9880316... |
Description | Gets the sine of pi/6 radians. This is equivalent to 30 degrees. |
---|---|
Used on | |
Code | local angle = math.sin( math.pi / 6 ) |
Output | The variable angle will be set to 0.5 |
Additional Notes
- When the description says returns the sine of a number (in radians), it means the argument passed to the function should be in radians.
- For those of you who don't know what a radian is, a radian is equal to the degree measure of an angle times the quantity pi divided by 180. Put simply, radians = degrees * (pi/180). Use math.rad to convert degrees to radians in your code.