OGLplus (0.52.0) a C++ wrapper for OpenGL

constants.hpp
Go to the documentation of this file.
1 
12 #pragma once
13 #ifndef OGLPLUS_MATH_CONSTANTS_1107121519_HPP
14 #define OGLPLUS_MATH_CONSTANTS_1107121519_HPP
15 
16 #include <cmath>
17 
18 namespace oglplus {
19 namespace math {
20 
21 #ifdef M_PI
22 inline decltype(M_PI) Pi(void)
23 {
24  return M_PI;
25 }
26 
27 inline decltype(2*M_PI) TwoPi(void)
28 {
29  return 2*M_PI;
30 }
31 
32 inline decltype(0.5*M_PI) HalfPi(void)
33 {
34  return 0.5*M_PI;
35 }
36 #else
37 inline decltype(std::atan(1.0) * 4.0) Pi(void)
38 {
39  static auto _pi = std::atan(1.0) * 4.0;
40  return _pi;
41 }
42 
43 inline decltype(std::atan(1.0) * 8.0) TwoPi(void)
44 {
45  static auto _pi = std::atan(1.0) * 8.0;
46  return _pi;
47 }
48 
49 inline decltype(std::atan(1.0) * 2.0) HalfPi(void)
50 {
51  static auto _pi = std::atan(1.0) * 2.0;
52  return _pi;
53 }
54 #endif
55 
56 } // namespace math
57 } // namespace oglplus
58 
59 #endif // include guard

Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Mon Sep 22 2014 by Doxygen (version 1.8.6).