Graphics Reference
In-Depth Information
GLSL supports the familiar set of trigonometric and inverse trigonomet-
ric functions. As with all the other functions, these can operate componentwise
on vectors. Arguments identified with angle are assumed to be in radians.
genType radians( genType degrees) Converts degrees to radians: (π/180)* degrees .
genType degrees( genType radians) Converts radians to degrees: (180/π)* radians .
genType sin( genType angle)
genType cos( genType angle)
genType tan( genType angle)
The standard trigonometric sine, cosine, and tangent func-
tions, with the argument angle in radians.
genType asin(genType x) Arc sine. Returns the primary radian value of the angle
whose sine is x. The range of returned values is [−π/2,π/2].
Undeined if | x |>1.
genType acos(genType x) Arc cosine. Returns the primary radian value of the angle
whose cosine is x . The range of returned values is [0,π].
Results are undefined if | x |>1.
genType atan(genType y, genType x) Arc tangent. Returns the primary radian value of the angle
whose tangent is y / x . The signs of x and y determine the
angle's quadrant. The range of returned values is [−π,π].
Undefined if x and y are both 0.
Arc tangent. Returns the primary radian value of the angle
whose tangent is y_over_x . The range of returned values is
[−π/2,π/2].
genType atan( genType y_over_x)
GLSL also supports the full range of hyperbolic trigonometric functions,
sinh, cosh, and tanh, and their inverses.
GLSL has the usual exponential, logarithmic, and square root functions,
including exponential and logarithmic functions of base 2. These can also
operate componentwise on vectors.
genType pow(genType x, genType y) Power function. Returns x raised to the y power, x y .
Undefined if x < 0, or if x = 0 and y ≤ 0.
Returns the natural exponentiation of x , e x .
genType exp(genType x)
genType log(genType x)
Returns the natural logarithm of x , the value y for which
x = e y . Undefined if x ≤ 0.
Returns 2 raised to the x power: 2 x .
genType exp2(genType x)
Returns the base 2 logarithm of x , the value y for which
x = 2 y . Undefined if x <= 0.
genType log2(genType x)
Returns the nonnegative square root of x . Undefined if x < 0.
genType sqrt(genType x)
genType inversesqrt( genType x)
Returns 1/
x Undefined if x ≤ 0.
Search WWH ::




Custom Search