1/// @ref gtc_constants 2/// @file glm/gtc/constants.inl 3 4#include <limits> 5 6namespace glm 7{ 8 template <typename genType> 9 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType epsilon() 10 { 11 return std::numeric_limits<genType>::epsilon(); 12 } 13 14 template <typename genType> 15 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType zero() 16 { 17 return genType(0); 18 } 19 20 template <typename genType> 21 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType one() 22 { 23 return genType(1); 24 } 25 26 template <typename genType> 27 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType pi() 28 { 29 return genType(3.14159265358979323846264338327950288); 30 } 31 32 template <typename genType> 33 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType two_pi() 34 { 35 return genType(6.28318530717958647692528676655900576); 36 } 37 38 template <typename genType> 39 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_pi() 40 { 41 return genType(1.772453850905516027); 42 } 43 44 template <typename genType> 45 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType half_pi() 46 { 47 return genType(1.57079632679489661923132169163975144); 48 } 49 50 template <typename genType> 51 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType three_over_two_pi() 52 { 53 return genType(4.71238898038468985769396507491925432); 54 } 55 56 template <typename genType> 57 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType quarter_pi() 58 { 59 return genType(0.785398163397448309615660845819875721); 60 } 61 62 template <typename genType> 63 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType one_over_pi() 64 { 65 return genType(0.318309886183790671537767526745028724); 66 } 67 68 template <typename genType> 69 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType one_over_two_pi() 70 { 71 return genType(0.159154943091895335768883763372514362); 72 } 73 74 template <typename genType> 75 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType two_over_pi() 76 { 77 return genType(0.636619772367581343075535053490057448); 78 } 79 80 template <typename genType> 81 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType four_over_pi() 82 { 83 return genType(1.273239544735162686151070106980114898); 84 } 85 86 template <typename genType> 87 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType two_over_root_pi() 88 { 89 return genType(1.12837916709551257389615890312154517); 90 } 91 92 template <typename genType> 93 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType one_over_root_two() 94 { 95 return genType(0.707106781186547524400844362104849039); 96 } 97 98 template <typename genType> 99 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_half_pi() 100 { 101 return genType(1.253314137315500251); 102 } 103 104 template <typename genType> 105 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_two_pi() 106 { 107 return genType(2.506628274631000502); 108 } 109 110 template <typename genType> 111 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_ln_four() 112 { 113 return genType(1.17741002251547469); 114 } 115 116 template <typename genType> 117 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType e() 118 { 119 return genType(2.71828182845904523536); 120 } 121 122 template <typename genType> 123 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType euler() 124 { 125 return genType(0.577215664901532860606); 126 } 127 128 template <typename genType> 129 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_two() 130 { 131 return genType(1.41421356237309504880168872420969808); 132 } 133 134 template <typename genType> 135 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_three() 136 { 137 return genType(1.73205080756887729352744634150587236); 138 } 139 140 template <typename genType> 141 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_five() 142 { 143 return genType(2.23606797749978969640917366873127623); 144 } 145 146 template <typename genType> 147 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType ln_two() 148 { 149 return genType(0.693147180559945309417232121458176568); 150 } 151 152 template <typename genType> 153 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType ln_ten() 154 { 155 return genType(2.30258509299404568401799145468436421); 156 } 157 158 template <typename genType> 159 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType ln_ln_two() 160 { 161 return genType(-0.3665129205816643); 162 } 163 164 template <typename genType> 165 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType third() 166 { 167 return genType(0.3333333333333333333333333333333333333333); 168 } 169 170 template <typename genType> 171 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType two_thirds() 172 { 173 return genType(0.666666666666666666666666666666666666667); 174 } 175 176 template <typename genType> 177 GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType golden_ratio() 178 { 179 return genType(1.61803398874989484820458683436563811); 180 } 181} //namespace glm 182