Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
Advertisement

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.

References[]

 
  1. ^ R. Ierusalimschy, L.H.d. Figuiredo, W. Celes 2007-04-03. The Evolution of Lua pp. 10-11.
  2. ^ R. Ierusalimschy, L.H.d. Figuiredo, W. Celes 2003-04-11. Lua 5.0 Reference Manual: 5.5 Mathematical Functions.
Advertisement