constants.hpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** Ifdefs
10 *****************************************************************************/
11 
12 #ifndef ECL_MATH_CONSTANTS_HPP_
13 #define ECL_MATH_CONSTANTS_HPP_
14 
15 /*****************************************************************************
16 ** Includes
17 *****************************************************************************/
18 
19 #include <cmath>
20 
21 /*****************************************************************************
22 ** Namespaces
23 *****************************************************************************/
24 
25 namespace ecl {
26 
27 #ifdef M_PI // defined by all POSIX systems and some non-POSIX ones
28  double const pi = M_PI;
29  const double two_pi = 2.0*pi;
30  const double pi_2 = pi/2.0;
31  const double pi_4 = pi/4.0;
32  const float two_pi_f= two_pi;
33  const float pi_f = pi;
34  const float pi_2_f = pi_2;
35  const float pi_4_f = pi_4;
36 #else
37  double const pi = 4.0*std::atan(1.0);
38  const double two_pi = 2.0*pi;
39  const double pi_2 = pi/2.0;
40  const double pi_4 = pi/4.0;
41  const float two_pi_f= two_pi;
42  const float pi_f = pi;
43  const float pi_2_f = pi_2;
44  const float pi_4_f = pi_4;
45 #endif
46 
47 // Above method of setting is more intelligent.
48 //const double two_pi = 6.283185307179586476925286766559005768394338798750211641949888; /**< @brief Mathematical constant for 2*pi. */
49 //const double pi = 3.141592653589793238462643383279502884197169399375105820974944; /**< @brief Mathematical constant for pi. */
50 //const double pi_2 = 1.57079632679489661923; /**< @brief Mathematical constant for pi/2. */
51 //const double pi_4 = 0.78539816339744830962; /**< @brief Mathematical constant for pi/4. */
52 //const float two_pi_f= 6.283185307179586476925286766559005768394338798750211641949888; /**< @brief Mathematical constant (float format) for 2*pi. */
53 //const float pi_f = 3.141592653589793238462643383279502884197169399375105820974944; /**< @brief Mathematical constant (float format) for pi. */
54 //const float pi_2_f = 1.57079632679489661923; /**< @brief Mathematical constant (float format) for pi/2. */
55 //const float pi_4_f = 0.78539816339744830962; /**< @brief Mathematical constant (float format) for pi/4. */
56 
57 
58 }; // namespace ecl
59 
60 #endif /*ECL_MATH_CONSTANTS_HPP_*/
double const pi
const double two_pi
const float pi_2_f
const float pi_4_f
const float pi_f
const double pi_4
const float two_pi_f
const double pi_2


xbot_node
Author(s): Roc, wangpeng@droid.ac.cn
autogenerated on Sat Oct 10 2020 03:28:13