Computes trigonometric functions.
sine = sin(degrees) cosine = cos(degrees) tangent = tan(degrees) sine = math.sin(radians) cosine = math.cos(radians) tangent = math.tan(radians) degrees = asin(sine) degrees = acos(cosine) degrees = atan(tangent) radians = math.asin(sine) radians = math.acos(cosine) radians = math.atan(tangent)
Arguments/Returns[]
- degrees
- number - An angle expressed as 1/360 of a circle.
- radians
- number - An angle expressed as 1/(2*pi) of a circle.
- sine, cosine, tangent
- number - Ratios of lengths in a right-angled triangle.
Details[]
- WoW was originally developed on Lua 4.0, when all common functions were in the global namespace.[1]
- Lua 5.0 introduced the
math
library and changed the trigonometric functions from degrees to radians.[2] - Despite transitioning to a variant of Lua 5.1 and incorporating the math library with radians, WoW retains the original functions with degrees.
Example[]
print(sin(0)) -- 0
print(sin(90)) -- 1
print(math.sin(math.pi/2)) -- 1
print(asin(1)) -- 90
print(math.asin(1)) -- 1.5707963267949
print(math.asin(1) / math.pi) -- 0.5
External links[]
The following links query Gethe's FrameXML clone on GitHub, or the Globe "wut?" tool on Townlong-Yak.
Function | FrameXML search queries | |
---|---|---|
sin | FrameXML | Globe wut? |
cos | FrameXML | Globe wut? |
tan | FrameXML | Globe wut? |
asin | FrameXML | Globe wut? |
acos | FrameXML | Globe wut? |
atan | FrameXML | Globe wut? |
math.sin | Not available | Globe wut? |
math.cos | Globe wut? | |
math.tan | Globe wut? | |
math.asin | Globe wut? | |
math.acos | Globe wut? | |
math.atan | Globe wut? |
References[]
- ^ R. Ierusalimschy, L.H.d. Figuiredo, W. Celes 2007-04-03. The Evolution of Lua pp. 10-11.
- ^ R. Ierusalimschy, L.H.d. Figuiredo, W. Celes 2003-04-11. Lua 5.0 Reference Manual: 5.5 Mathematical Functions.