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