• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 ///////////////////////////////////////////////////////////////////////////////////
2 /// OpenGL Mathematics (glm.g-truc.net)
3 ///
4 /// Copyright (c) 2005 - 2014 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 
40 #ifndef GLM_GTC_random
41 #define GLM_GTC_random
42 
43 // Dependency:
44 #include "../vec2.hpp"
45 #include "../vec3.hpp"
46 
47 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
48 #	pragma message("GLM: GLM_GTC_random extension included")
49 #endif
50 
51 namespace glm
52 {
53 	/// @addtogroup gtc_random
54 	/// @{
55 
56 	/// Generate random numbers in the interval [Min, Max], according a linear distribution
57 	///
58 	/// @param Min
59 	/// @param Max
60 	/// @tparam genType Value type. Currently supported: half (not recommanded), float or double scalars and vectors.
61 	/// @see gtc_random
62 	template <typename genType>
63 	GLM_FUNC_DECL genType linearRand(
64 		genType const & Min,
65 		genType const & Max);
66 
67 	/// Generate random numbers in the interval [Min, Max], according a gaussian distribution
68 	///
69 	/// @param Mean
70 	/// @param Deviation
71 	/// @see gtc_random
72 	template <typename genType>
73 	GLM_FUNC_DECL genType gaussRand(
74 		genType const & Mean,
75 		genType const & Deviation);
76 
77 	/// Generate a random 2D vector which coordinates are regulary distributed on a circle of a given radius
78 	///
79 	/// @param Radius
80 	/// @see gtc_random
81 	template <typename T>
82 	GLM_FUNC_DECL detail::tvec2<T, defaultp> circularRand(
83 		T const & Radius);
84 
85 	/// Generate a random 3D vector which coordinates are regulary distributed on a sphere of a given radius
86 	///
87 	/// @param Radius
88 	/// @see gtc_random
89 	template <typename T>
90 	GLM_FUNC_DECL detail::tvec3<T, defaultp> sphericalRand(
91 		T const & Radius);
92 
93 	/// Generate a random 2D vector which coordinates are regulary distributed within the area of a disk of a given radius
94 	///
95 	/// @param Radius
96 	/// @see gtc_random
97 	template <typename T>
98 	GLM_FUNC_DECL detail::tvec2<T, defaultp> diskRand(
99 		T const & Radius);
100 
101 	/// Generate a random 3D vector which coordinates are regulary distributed within the volume of a ball of a given radius
102 	///
103 	/// @param Radius
104 	/// @see gtc_random
105 	template <typename T>
106 	GLM_FUNC_DECL detail::tvec3<T, defaultp> ballRand(
107 		T const & Radius);
108 
109 	/// @}
110 }//namespace glm
111 
112 #include "random.inl"
113 
114 #endif//GLM_GTC_random
115