Lua Shader Angle and Trigonometry Functions

From GiderosMobile
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Function parameters specified as angle are assumed to be in units of radians. In no case will any of these functions result in a divide by zero error. If the divisor of a ratio is 0, then results will be undefined.

Function Syntax Description
rad rad(degrees) Converts degrees to radians, i.e pi/180*degrees.
deg deg(radians) Converts radians to degrees, i.e 180/pi*radians.
sin sin(angle) The standard trigonometric sine function.
cos cos(angle) The standard trigonometric cosine function.
tan tan(angle) The standard trigonometric tangent.
asin asin(x) Arc sine. Returns an angle whose sine is x.
acos acos(x) Arc cosine. Returns an angle whose cosine is x.
atan atan(y_over_x) Arc tangent. Returns an angle whose tangent is y_over_x.
atan2 atan2(y,x) Arc tangent. Returns an angle whose tangent is y/x.
sinh sinh(x) Returns the hyperbolic cosine function. (e^x - e^-x)/2
cosh cosh(x) The standard trigonometric cosine function. (e^x + e^-x)/2
tanh tan(x) Returns the hyperbolic tangent function. sinh(x)/cosh(x)
asinh asinh(x) Arc hyperbolic sine; returns the inverse of sinh.
acosh acosh(x) Arc hyperbolic cosine; returns the non-negative inverse of cosh.
atanh atan(x) Arc hyperbolic tangent; returns the inverse of tanh.