constants.hpp 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /// @ref gtc_constants
  2. /// @file glm/gtc/constants.hpp
  3. ///
  4. /// @see core (dependence)
  5. ///
  6. /// @defgroup gtc_constants GLM_GTC_constants
  7. /// @ingroup gtc
  8. ///
  9. /// Include <glm/gtc/constants.hpp> to use the features of this extension.
  10. ///
  11. /// Provide a list of constants and precomputed useful values.
  12. #pragma once
  13. // Dependencies
  14. #include "../ext/scalar_constants.hpp"
  15. #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  16. # pragma message("GLM: GLM_GTC_constants extension included")
  17. #endif
  18. namespace glm
  19. {
  20. /// @addtogroup gtc_constants
  21. /// @{
  22. /// Return 0.
  23. /// @see gtc_constants
  24. template<typename genType>
  25. GLM_FUNC_DECL GLM_CONSTEXPR genType zero();
  26. /// Return 1.
  27. /// @see gtc_constants
  28. template<typename genType>
  29. GLM_FUNC_DECL GLM_CONSTEXPR genType one();
  30. /// Return pi * 2.
  31. /// @see gtc_constants
  32. template<typename genType>
  33. GLM_FUNC_DECL GLM_CONSTEXPR genType two_pi();
  34. /// Return square root of pi.
  35. /// @see gtc_constants
  36. template<typename genType>
  37. GLM_FUNC_DECL GLM_CONSTEXPR genType root_pi();
  38. /// Return pi / 2.
  39. /// @see gtc_constants
  40. template<typename genType>
  41. GLM_FUNC_DECL GLM_CONSTEXPR genType half_pi();
  42. /// Return pi / 2 * 3.
  43. /// @see gtc_constants
  44. template<typename genType>
  45. GLM_FUNC_DECL GLM_CONSTEXPR genType three_over_two_pi();
  46. /// Return pi / 4.
  47. /// @see gtc_constants
  48. template<typename genType>
  49. GLM_FUNC_DECL GLM_CONSTEXPR genType quarter_pi();
  50. /// Return 1 / pi.
  51. /// @see gtc_constants
  52. template<typename genType>
  53. GLM_FUNC_DECL GLM_CONSTEXPR genType one_over_pi();
  54. /// Return 1 / (pi * 2).
  55. /// @see gtc_constants
  56. template<typename genType>
  57. GLM_FUNC_DECL GLM_CONSTEXPR genType one_over_two_pi();
  58. /// Return 2 / pi.
  59. /// @see gtc_constants
  60. template<typename genType>
  61. GLM_FUNC_DECL GLM_CONSTEXPR genType two_over_pi();
  62. /// Return 4 / pi.
  63. /// @see gtc_constants
  64. template<typename genType>
  65. GLM_FUNC_DECL GLM_CONSTEXPR genType four_over_pi();
  66. /// Return 2 / sqrt(pi).
  67. /// @see gtc_constants
  68. template<typename genType>
  69. GLM_FUNC_DECL GLM_CONSTEXPR genType two_over_root_pi();
  70. /// Return 1 / sqrt(2).
  71. /// @see gtc_constants
  72. template<typename genType>
  73. GLM_FUNC_DECL GLM_CONSTEXPR genType one_over_root_two();
  74. /// Return sqrt(pi / 2).
  75. /// @see gtc_constants
  76. template<typename genType>
  77. GLM_FUNC_DECL GLM_CONSTEXPR genType root_half_pi();
  78. /// Return sqrt(2 * pi).
  79. /// @see gtc_constants
  80. template<typename genType>
  81. GLM_FUNC_DECL GLM_CONSTEXPR genType root_two_pi();
  82. /// Return sqrt(ln(4)).
  83. /// @see gtc_constants
  84. template<typename genType>
  85. GLM_FUNC_DECL GLM_CONSTEXPR genType root_ln_four();
  86. /// Return e constant.
  87. /// @see gtc_constants
  88. template<typename genType>
  89. GLM_FUNC_DECL GLM_CONSTEXPR genType e();
  90. /// Return Euler's constant.
  91. /// @see gtc_constants
  92. template<typename genType>
  93. GLM_FUNC_DECL GLM_CONSTEXPR genType euler();
  94. /// Return sqrt(2).
  95. /// @see gtc_constants
  96. template<typename genType>
  97. GLM_FUNC_DECL GLM_CONSTEXPR genType root_two();
  98. /// Return sqrt(3).
  99. /// @see gtc_constants
  100. template<typename genType>
  101. GLM_FUNC_DECL GLM_CONSTEXPR genType root_three();
  102. /// Return sqrt(5).
  103. /// @see gtc_constants
  104. template<typename genType>
  105. GLM_FUNC_DECL GLM_CONSTEXPR genType root_five();
  106. /// Return ln(2).
  107. /// @see gtc_constants
  108. template<typename genType>
  109. GLM_FUNC_DECL GLM_CONSTEXPR genType ln_two();
  110. /// Return ln(10).
  111. /// @see gtc_constants
  112. template<typename genType>
  113. GLM_FUNC_DECL GLM_CONSTEXPR genType ln_ten();
  114. /// Return ln(ln(2)).
  115. /// @see gtc_constants
  116. template<typename genType>
  117. GLM_FUNC_DECL GLM_CONSTEXPR genType ln_ln_two();
  118. /// Return 1 / 3.
  119. /// @see gtc_constants
  120. template<typename genType>
  121. GLM_FUNC_DECL GLM_CONSTEXPR genType third();
  122. /// Return 2 / 3.
  123. /// @see gtc_constants
  124. template<typename genType>
  125. GLM_FUNC_DECL GLM_CONSTEXPR genType two_thirds();
  126. /// Return the golden ratio constant.
  127. /// @see gtc_constants
  128. template<typename genType>
  129. GLM_FUNC_DECL GLM_CONSTEXPR genType golden_ratio();
  130. /// @}
  131. } //namespace glm
  132. #include "constants.inl"