• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /// @ref core
2 /// @file glm/detail/func_exponential.hpp
3 ///
4 /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
5 ///
6 /// @defgroup core_func_exponential Exponential functions
7 /// @ingroup core
8 ///
9 /// These all operate component-wise. The description is per component.
10 
11 #pragma once
12 
13 #include "type_vec1.hpp"
14 #include "type_vec2.hpp"
15 #include "type_vec3.hpp"
16 #include "type_vec4.hpp"
17 #include <cmath>
18 
19 namespace glm
20 {
21 	/// @addtogroup core_func_exponential
22 	/// @{
23 
24 	/// Returns 'base' raised to the power 'exponent'.
25 	///
26 	/// @param base Floating point value. pow function is defined for input values of 'base' defined in the range (inf-, inf+) in the limit of the type precision.
27 	/// @param exponent Floating point value representing the 'exponent'.
28 	/// @tparam genType Floating-point scalar or vector types.
29 	///
30 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/pow.xml">GLSL pow man page</a>
31 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
32 	template <typename T, precision P, template <typename, precision> class vecType>
33 	GLM_FUNC_DECL vecType<T, P> pow(vecType<T, P> const & base, vecType<T, P> const & exponent);
34 
35 	/// Returns the natural exponentiation of x, i.e., e^x.
36 	///
37 	/// @param v exp function is defined for input values of v defined in the range (inf-, inf+) in the limit of the type precision.
38 	/// @tparam genType Floating-point scalar or vector types.
39 	///
40 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp.xml">GLSL exp man page</a>
41 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
42 	template <typename T, precision P, template <typename, precision> class vecType>
43 	GLM_FUNC_DECL vecType<T, P> exp(vecType<T, P> const & v);
44 
45 	/// Returns the natural logarithm of v, i.e.,
46 	/// returns the value y which satisfies the equation x = e^y.
47 	/// Results are undefined if v <= 0.
48 	///
49 	/// @param v log function is defined for input values of v defined in the range (0, inf+) in the limit of the type precision.
50 	/// @tparam genType Floating-point scalar or vector types.
51 	///
52 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log.xml">GLSL log man page</a>
53 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
54 	template <typename T, precision P, template <typename, precision> class vecType>
55 	GLM_FUNC_DECL vecType<T, P> log(vecType<T, P> const & v);
56 
57 	/// Returns 2 raised to the v power.
58 	///
59 	/// @param v exp2 function is defined for input values of v defined in the range (inf-, inf+) in the limit of the type precision.
60 	/// @tparam genType Floating-point scalar or vector types.
61 	///
62 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp2.xml">GLSL exp2 man page</a>
63 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
64 	template <typename T, precision P, template <typename, precision> class vecType>
65 	GLM_FUNC_DECL vecType<T, P> exp2(vecType<T, P> const & v);
66 
67 	/// Returns the base 2 log of x, i.e., returns the value y,
68 	/// which satisfies the equation x = 2 ^ y.
69 	///
70 	/// @param v log2 function is defined for input values of v defined in the range (0, inf+) in the limit of the type precision.
71 	/// @tparam genType Floating-point scalar or vector types.
72 	///
73 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log2.xml">GLSL log2 man page</a>
74 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
75 	template <typename T, precision P, template <typename, precision> class vecType>
76 	GLM_FUNC_DECL vecType<T, P> log2(vecType<T, P> const & v);
77 
78 	/// Returns the positive square root of v.
79 	///
80 	/// @param v sqrt function is defined for input values of v defined in the range [0, inf+) in the limit of the type precision.
81 	/// @tparam genType Floating-point scalar or vector types.
82 	///
83 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sqrt.xml">GLSL sqrt man page</a>
84 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
85 	//template <typename genType>
86 	//GLM_FUNC_DECL genType sqrt(genType const & x);
87 	template <typename T, precision P, template <typename, precision> class vecType>
88 	GLM_FUNC_DECL vecType<T, P> sqrt(vecType<T, P> const & v);
89 
90 	/// Returns the reciprocal of the positive square root of v.
91 	///
92 	/// @param v inversesqrt function is defined for input values of v defined in the range [0, inf+) in the limit of the type precision.
93 	/// @tparam genType Floating-point scalar or vector types.
94 	///
95 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inversesqrt.xml">GLSL inversesqrt man page</a>
96 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
97 	template <typename T, precision P, template <typename, precision> class vecType>
98 	GLM_FUNC_DECL vecType<T, P> inversesqrt(vecType<T, P> const & v);
99 
100 	/// @}
101 }//namespace glm
102 
103 #include "func_exponential.inl"
104