You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

186 lines
5.1 KiB

  1. ///////////////////////////////////////////////////////////////////////////////////
  2. /// OpenGL Mathematics (glm.g-truc.net)
  3. ///
  4. /// Copyright (c) 2005 - 2013 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 Allow to perform bit operations on integer values
  35. ///
  36. /// <glm/gtc/constants.hpp> need to be included to use these features.
  37. ///////////////////////////////////////////////////////////////////////////////////
  38. #ifndef GLM_GTC_constants
  39. #define GLM_GTC_constants GLM_VERSION
  40. // Dependency:
  41. #include "../glm.hpp"
  42. #include "../gtc/half_float.hpp"
  43. #if(defined(GLM_MESSAGES) && !defined(glm_ext))
  44. # pragma message("GLM: GLM_GTC_constants extension included")
  45. #endif
  46. namespace glm
  47. {
  48. /// @addtogroup gtc_constants
  49. /// @{
  50. /// Return the epsilon constant for floating point types.
  51. /// @todo Implement epsilon for half-precision floating point type.
  52. /// @see gtc_constants
  53. template <typename genType>
  54. GLM_FUNC_DECL genType epsilon();
  55. /// Return 0.
  56. /// @see gtc_constants
  57. template <typename genType>
  58. GLM_FUNC_DECL genType zero();
  59. /// Return 1.
  60. /// @see gtc_constants
  61. template <typename genType>
  62. GLM_FUNC_DECL genType one();
  63. /// Return the pi constant.
  64. /// @see gtc_constants
  65. template <typename genType>
  66. GLM_FUNC_DECL genType pi();
  67. /// Return square root of pi.
  68. /// @see gtc_constants
  69. template <typename genType>
  70. GLM_FUNC_DECL genType root_pi();
  71. /// Return pi / 2.
  72. /// @see gtc_constants
  73. template <typename genType>
  74. GLM_FUNC_DECL genType half_pi();
  75. /// Return pi / 4.
  76. /// @see gtc_constants
  77. template <typename genType>
  78. GLM_FUNC_DECL genType quarter_pi();
  79. /// Return 1 / pi.
  80. /// @see gtc_constants
  81. template <typename genType>
  82. GLM_FUNC_DECL genType one_over_pi();
  83. /// Return 2 / pi.
  84. /// @see gtc_constants
  85. template <typename genType>
  86. GLM_FUNC_DECL genType two_over_pi();
  87. /// Return 2 / sqrt(pi).
  88. /// @see gtc_constants
  89. template <typename genType>
  90. GLM_FUNC_DECL genType two_over_root_pi();
  91. /// Return 1 / sqrt(2).
  92. /// @see gtc_constants
  93. template <typename genType>
  94. GLM_FUNC_DECL genType one_over_root_two();
  95. /// Return sqrt(pi / 2).
  96. /// @see gtc_constants
  97. template <typename genType>
  98. GLM_FUNC_DECL genType root_half_pi();
  99. /// Return sqrt(2 * pi).
  100. /// @see gtc_constants
  101. template <typename genType>
  102. GLM_FUNC_DECL genType root_two_pi();
  103. /// Return sqrt(ln(4)).
  104. /// @see gtc_constants
  105. template <typename genType>
  106. GLM_FUNC_DECL genType root_ln_four();
  107. /// Return e constant.
  108. /// @see gtc_constants
  109. template <typename genType>
  110. GLM_FUNC_DECL genType e();
  111. /// Return Euler's constant.
  112. /// @see gtc_constants
  113. template <typename genType>
  114. GLM_FUNC_DECL genType euler();
  115. /// Return sqrt(2).
  116. /// @see gtc_constants
  117. template <typename genType>
  118. GLM_FUNC_DECL genType root_two();
  119. /// Return sqrt(3).
  120. /// @see gtc_constants
  121. template <typename genType>
  122. GLM_FUNC_DECL genType root_three();
  123. /// Return sqrt(5).
  124. /// @see gtc_constants
  125. template <typename genType>
  126. GLM_FUNC_DECL genType root_five();
  127. /// Return ln(2).
  128. /// @see gtc_constants
  129. template <typename genType>
  130. GLM_FUNC_DECL genType ln_two();
  131. /// Return ln(10).
  132. /// @see gtc_constants
  133. template <typename genType>
  134. GLM_FUNC_DECL genType ln_ten();
  135. /// Return ln(ln(2)).
  136. /// @see gtc_constants
  137. template <typename genType>
  138. GLM_FUNC_DECL genType ln_ln_two();
  139. /// Return 1 / 3.
  140. /// @see gtc_constants
  141. template <typename genType>
  142. GLM_FUNC_DECL genType third();
  143. /// Return 2 / 3.
  144. /// @see gtc_constants
  145. template <typename genType>
  146. GLM_FUNC_DECL genType two_thirds();
  147. /// Return the golden ratio constant.
  148. /// @see gtc_constants
  149. template <typename genType>
  150. GLM_FUNC_DECL genType golden_ratio();
  151. /// @}
  152. } //namespace glm
  153. #include "constants.inl"
  154. #endif//GLM_GTC_constants