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