00001 00008 /***************************************************************************** 00009 ** Ifdefs 00010 *****************************************************************************/ 00011 00012 #ifndef ECL_MATH_CONSTANTS_HPP_ 00013 #define ECL_MATH_CONSTANTS_HPP_ 00014 00015 /***************************************************************************** 00016 ** Includes 00017 *****************************************************************************/ 00018 00019 #include <cmath> 00020 00021 /***************************************************************************** 00022 ** Namespaces 00023 *****************************************************************************/ 00024 00025 namespace ecl { 00026 00027 #ifdef M_PI // defined by all POSIX systems and some non-POSIX ones 00028 double const pi = M_PI; 00029 const double two_pi = 2.0*pi; 00030 const double pi_2 = pi/2.0; 00031 const double pi_4 = pi/4.0; 00032 const float two_pi_f= two_pi; 00033 const float pi_f = pi; 00034 const float pi_2_f = pi_2; 00035 const float pi_4_f = pi_4; 00036 #else 00037 double const pi = 4*std::atan(1); 00038 const double two_pi = 2.0*pi; 00039 const double pi_2 = pi/2.0; 00040 const double pi_4 = pi/4.0; 00041 const float two_pi_f= two_pi; 00042 const float pi_f = pi; 00043 const float pi_2_f = pi_2; 00044 const float pi_4_f = pi_4; 00045 #endif 00046 00047 // Above method of setting is more intelligent. 00048 //const double two_pi = 6.283185307179586476925286766559005768394338798750211641949888; /**< @brief Mathematical constant for 2*pi. */ 00049 //const double pi = 3.141592653589793238462643383279502884197169399375105820974944; /**< @brief Mathematical constant for pi. */ 00050 //const double pi_2 = 1.57079632679489661923; /**< @brief Mathematical constant for pi/2. */ 00051 //const double pi_4 = 0.78539816339744830962; /**< @brief Mathematical constant for pi/4. */ 00052 //const float two_pi_f= 6.283185307179586476925286766559005768394338798750211641949888; /**< @brief Mathematical constant (float format) for 2*pi. */ 00053 //const float pi_f = 3.141592653589793238462643383279502884197169399375105820974944; /**< @brief Mathematical constant (float format) for pi. */ 00054 //const float pi_2_f = 1.57079632679489661923; /**< @brief Mathematical constant (float format) for pi/2. */ 00055 //const float pi_4_f = 0.78539816339744830962; /**< @brief Mathematical constant (float format) for pi/4. */ 00056 00057 00058 }; // namespace ecl 00059 00060 #endif /*ECL_MATH_CONSTANTS_HPP_*/