Home | History | Annotate | Download | only in gtc
      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 gtc_constants
     24 /// @file glm/gtc/constants.hpp
     25 /// @date 2011-09-30 / 2012-01-25
     26 /// @author Christophe Riccio
     27 ///
     28 /// @see core (dependence)
     29 /// @see gtc_half_float (dependence)
     30 ///
     31 /// @defgroup gtc_constants GLM_GTC_constants
     32 /// @ingroup gtc
     33 ///
     34 /// @brief Provide a list of constants and precomputed useful values.
     35 ///
     36 /// <glm/gtc/constants.hpp> need to be included to use these features.
     37 ///////////////////////////////////////////////////////////////////////////////////
     38 
     39 #ifndef GLM_GTC_constants
     40 #define GLM_GTC_constants
     41 
     42 // Dependencies
     43 #include "../detail/setup.hpp"
     44 
     45 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
     46 #	pragma message("GLM: GLM_GTC_constants extension included")
     47 #endif
     48 
     49 namespace glm
     50 {
     51 	/// @addtogroup gtc_constants
     52 	/// @{
     53 
     54 	/// Return the epsilon constant for floating point types.
     55 	/// @todo Implement epsilon for half-precision floating point type.
     56 	/// @see gtc_constants
     57 	template <typename genType>
     58 	GLM_FUNC_DECL genType epsilon();
     59 
     60 	/// Return 0.
     61 	/// @see gtc_constants
     62 	template <typename genType>
     63 	GLM_FUNC_DECL genType zero();
     64 
     65 	/// Return 1.
     66 	/// @see gtc_constants
     67 	template <typename genType>
     68 	GLM_FUNC_DECL genType one();
     69 
     70 	/// Return the pi constant.
     71 	/// @see gtc_constants
     72 	template <typename genType>
     73 	GLM_FUNC_DECL genType pi();
     74 
     75 	/// Return square root of pi.
     76 	/// @see gtc_constants
     77 	template <typename genType>
     78 	GLM_FUNC_DECL genType root_pi();
     79 
     80 	/// Return pi / 2.
     81 	/// @see gtc_constants
     82 	template <typename genType>
     83 	GLM_FUNC_DECL genType half_pi();
     84 
     85 	/// Return pi / 4.
     86 	/// @see gtc_constants
     87 	template <typename genType>
     88 	GLM_FUNC_DECL genType quarter_pi();
     89 
     90 	/// Return 1 / pi.
     91 	/// @see gtc_constants
     92 	template <typename genType>
     93 	GLM_FUNC_DECL genType one_over_pi();
     94 
     95 	/// Return 2 / pi.
     96 	/// @see gtc_constants
     97 	template <typename genType>
     98 	GLM_FUNC_DECL genType two_over_pi();
     99 
    100 	/// Return 2 / sqrt(pi).
    101 	/// @see gtc_constants
    102 	template <typename genType>
    103 	GLM_FUNC_DECL genType two_over_root_pi();
    104 
    105 	/// Return 1 / sqrt(2).
    106 	/// @see gtc_constants
    107 	template <typename genType>
    108 	GLM_FUNC_DECL genType one_over_root_two();
    109 
    110 	/// Return sqrt(pi / 2).
    111 	/// @see gtc_constants
    112 	template <typename genType>
    113 	GLM_FUNC_DECL genType root_half_pi();
    114 
    115 	/// Return sqrt(2 * pi).
    116 	/// @see gtc_constants
    117 	template <typename genType>
    118 	GLM_FUNC_DECL genType root_two_pi();
    119 
    120 	/// Return sqrt(ln(4)).
    121 	/// @see gtc_constants
    122 	template <typename genType>
    123 	GLM_FUNC_DECL genType root_ln_four();
    124 
    125 	/// Return e constant.
    126 	/// @see gtc_constants
    127 	template <typename genType>
    128 	GLM_FUNC_DECL genType e();
    129 
    130 	/// Return Euler's constant.
    131 	/// @see gtc_constants
    132 	template <typename genType>
    133 	GLM_FUNC_DECL genType euler();
    134 
    135 	/// Return sqrt(2).
    136 	/// @see gtc_constants
    137 	template <typename genType>
    138 	GLM_FUNC_DECL genType root_two();
    139 
    140 	/// Return sqrt(3).
    141 	/// @see gtc_constants
    142 	template <typename genType>
    143 	GLM_FUNC_DECL genType root_three();
    144 
    145 	/// Return sqrt(5).
    146 	/// @see gtc_constants
    147 	template <typename genType>
    148 	GLM_FUNC_DECL genType root_five();
    149 
    150 	/// Return ln(2).
    151 	/// @see gtc_constants
    152 	template <typename genType>
    153 	GLM_FUNC_DECL genType ln_two();
    154 
    155 	/// Return ln(10).
    156 	/// @see gtc_constants
    157 	template <typename genType>
    158 	GLM_FUNC_DECL genType ln_ten();
    159 
    160 	/// Return ln(ln(2)).
    161 	/// @see gtc_constants
    162 	template <typename genType>
    163 	GLM_FUNC_DECL genType ln_ln_two();
    164 
    165 	/// Return 1 / 3.
    166 	/// @see gtc_constants
    167 	template <typename genType>
    168 	GLM_FUNC_DECL genType third();
    169 
    170 	/// Return 2 / 3.
    171 	/// @see gtc_constants
    172 	template <typename genType>
    173 	GLM_FUNC_DECL genType two_thirds();
    174 
    175 	/// Return the golden ratio constant.
    176 	/// @see gtc_constants
    177 	template <typename genType>
    178 	GLM_FUNC_DECL genType golden_ratio();
    179 
    180 	/// @}
    181 } //namespace glm
    182 
    183 #include "constants.inl"
    184 
    185 #endif//GLM_GTC_constants
    186