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.

114 lines
3.7 KiB

5 years ago
  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_random
  24. /// @file glm/gtc/random.hpp
  25. /// @date 2011-09-18 / 2011-09-18
  26. /// @author Christophe Riccio
  27. ///
  28. /// @see core (dependence)
  29. /// @see gtc_half_float (dependence)
  30. /// @see gtx_random (extended)
  31. ///
  32. /// @defgroup gtc_random GLM_GTC_random
  33. /// @ingroup gtc
  34. ///
  35. /// @brief Generate random number from various distribution methods.
  36. ///
  37. /// <glm/gtc/random.hpp> need to be included to use these functionalities.
  38. ///////////////////////////////////////////////////////////////////////////////////
  39. #ifndef GLM_GTC_random
  40. #define GLM_GTC_random GLM_VERSION
  41. // Dependency:
  42. #include "../glm.hpp"
  43. #include "../gtc/half_float.hpp"
  44. #if(defined(GLM_MESSAGES) && !defined(glm_ext))
  45. # pragma message("GLM: GLM_GTC_random extension included")
  46. #endif
  47. namespace glm
  48. {
  49. /// @addtogroup gtc_random
  50. /// @{
  51. /// Generate random numbers in the interval [Min, Max], according a linear distribution
  52. ///
  53. /// @param Min
  54. /// @param Max
  55. /// @tparam genType Value type. Currently supported: half (not recommanded), float or double scalars and vectors.
  56. /// @see gtc_random
  57. template <typename genType>
  58. genType linearRand(
  59. genType const & Min,
  60. genType const & Max);
  61. /// Generate random numbers in the interval [Min, Max], according a gaussian distribution
  62. ///
  63. /// @param Mean
  64. /// @param Deviation
  65. /// @see gtc_random
  66. template <typename genType>
  67. genType gaussRand(
  68. genType const & Mean,
  69. genType const & Deviation);
  70. /// Generate a random 2D vector which coordinates are regulary distributed on a circle of a given radius
  71. ///
  72. /// @param Radius
  73. /// @see gtc_random
  74. template <typename T>
  75. detail::tvec2<T> circularRand(
  76. T const & Radius);
  77. /// Generate a random 3D vector which coordinates are regulary distributed on a sphere of a given radius
  78. ///
  79. /// @param Radius
  80. /// @see gtc_random
  81. template <typename T>
  82. detail::tvec3<T> sphericalRand(
  83. T const & Radius);
  84. /// Generate a random 2D vector which coordinates are regulary distributed within the area of a disk of a given radius
  85. ///
  86. /// @param Radius
  87. /// @see gtc_random
  88. template <typename T>
  89. detail::tvec2<T> diskRand(
  90. T const & Radius);
  91. /// Generate a random 3D vector which coordinates are regulary distributed within the volume of a ball of a given radius
  92. ///
  93. /// @param Radius
  94. /// @see gtc_random
  95. template <typename T>
  96. GLM_FUNC_QUALIFIER detail::tvec3<T> ballRand(
  97. T const & Radius);
  98. /// @}
  99. }//namespace glm
  100. #include "random.inl"
  101. #endif//GLM_GTC_random