Home | History | Annotate | Download | only in detail
      1 ///////////////////////////////////////////////////////////////////////////////////
      2 /// OpenGL Mathematics (glm.g-truc.net)
      3 ///
      4 /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
      5 /// Permission is hereby granted, free of charge, to any person obtaining a copy
      6 /// of this software and associated documentation files (the "Software"), to deal
      7 /// in the Software without restriction, including without limitation the rights
      8 /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
      9 /// copies of the Software, and to permit persons to whom the Software is
     10 /// furnished to do so, subject to the following conditions:
     11 ///
     12 /// The above copyright notice and this permission notice shall be included in
     13 /// all copies or substantial portions of the Software.
     14 ///
     15 /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     16 /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     17 /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     18 /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     19 /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     20 /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     21 /// THE SOFTWARE.
     22 ///
     23 /// @ref core
     24 /// @file glm/core/func_exponential.hpp
     25 /// @date 2008-08-08 / 2011-06-14
     26 /// @author Christophe Riccio
     27 ///
     28 /// @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>
     29 ///
     30 /// @defgroup core_func_exponential Exponential functions
     31 /// @ingroup core
     32 ///
     33 /// These all operate component-wise. The description is per component.
     34 ///////////////////////////////////////////////////////////////////////////////////
     35 
     36 #ifndef glm_core_func_exponential
     37 #define glm_core_func_exponential
     38 
     39 #include "type_vec1.hpp"
     40 #include "type_vec2.hpp"
     41 #include "type_vec3.hpp"
     42 #include "type_vec4.hpp"
     43 #include <cmath>
     44 
     45 namespace glm
     46 {
     47 	/// @addtogroup core_func_exponential
     48 	/// @{
     49 
     50 	/// Returns 'base' raised to the power 'exponent'.
     51 	///
     52 	/// @param base Floating point value. pow function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision.
     53 	/// @param exponent Floating point value representing the 'exponent'.
     54 	/// @tparam genType Floating-point scalar or vector types.
     55 	///
     56 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/pow.xml">GLSL pow man page</a>
     57 	/// @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>
     58 	template <typename genType>
     59 	GLM_FUNC_DECL genType pow(genType const & base, genType const & exponent);
     60 
     61 	/// Returns the natural exponentiation of x, i.e., e^x.
     62 	///
     63 	/// @param x exp function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision.
     64 	/// @tparam genType Floating-point scalar or vector types.
     65 	///
     66 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp.xml">GLSL exp man page</a>
     67 	/// @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>
     68 	template <typename genType>
     69 	GLM_FUNC_DECL genType exp(genType const & x);
     70 
     71 	/// Returns the natural logarithm of x, i.e.,
     72 	/// returns the value y which satisfies the equation x = e^y.
     73 	/// Results are undefined if x <= 0.
     74 	///
     75 	/// @param x log function is defined for input values of x defined in the range (0, inf+) in the limit of the type precision.
     76 	/// @tparam genType Floating-point scalar or vector types.
     77 	///
     78 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log.xml">GLSL log man page</a>
     79 	/// @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>
     80 	template <typename genType>
     81 	GLM_FUNC_DECL genType log(genType const & x);
     82 
     83 	/// Returns 2 raised to the x power.
     84 	///
     85 	/// @param x exp2 function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision.
     86 	/// @tparam genType Floating-point scalar or vector types.
     87 	///
     88 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp2.xml">GLSL exp2 man page</a>
     89 	/// @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>
     90 	template <typename genType>
     91 	GLM_FUNC_DECL genType exp2(genType const & x);
     92 
     93 	/// Returns the base 2 log of x, i.e., returns the value y,
     94 	/// which satisfies the equation x = 2 ^ y.
     95 	///
     96 	/// @param x log2 function is defined for input values of x defined in the range (0, inf+) in the limit of the type precision.
     97 	/// @tparam genType Floating-point scalar or vector types.
     98 	///
     99 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log2.xml">GLSL log2 man page</a>
    100 	/// @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>
    101 	template <typename genType>
    102 	GLM_FUNC_DECL genType log2(genType x);
    103 
    104 	/// Returns the positive square root of x.
    105 	///
    106 	/// @param x sqrt function is defined for input values of x defined in the range [0, inf+) in the limit of the type precision.
    107 	/// @tparam genType Floating-point scalar or vector types.
    108 	///
    109 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sqrt.xml">GLSL sqrt man page</a>
    110 	/// @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>
    111 	//template <typename genType>
    112 	//GLM_FUNC_DECL genType sqrt(genType const & x);
    113 
    114 	template <typename T, precision P, template <typename, precision> class vecType>
    115 	GLM_FUNC_DECL vecType<T, P> sqrt(vecType<T, P> const & x);
    116 
    117 	/// Returns the reciprocal of the positive square root of x.
    118 	///
    119 	/// @param x inversesqrt function is defined for input values of x defined in the range [0, inf+) in the limit of the type precision.
    120 	/// @tparam genType Floating-point scalar or vector types.
    121 	///
    122 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inversesqrt.xml">GLSL inversesqrt man page</a>
    123 	/// @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>
    124 	template <typename genType>
    125 	GLM_FUNC_DECL genType inversesqrt(genType const & x);
    126 
    127 	/// @}
    128 }//namespace glm
    129 
    130 #include "func_exponential.inl"
    131 
    132 #endif//glm_core_func_exponential
    133