Program Listing for File constants.hpp
↰ Return to documentation for file (/tmp/ws/src/ecl_core/ecl_math/include/ecl/math/constants.hpp
)
/*****************************************************************************
** Ifdefs
*****************************************************************************/
#ifndef ECL_MATH_CONSTANTS_HPP_
#define ECL_MATH_CONSTANTS_HPP_
/*****************************************************************************
** Includes
*****************************************************************************/
#include <cmath>
/*****************************************************************************
** Namespaces
*****************************************************************************/
namespace ecl {
#ifdef M_PI // defined by all POSIX systems and some non-POSIX ones
double const pi = M_PI;
const double two_pi = 2.0*pi;
const double pi_2 = pi/2.0;
const double pi_4 = pi/4.0;
const float two_pi_f= two_pi;
const float pi_f = pi;
const float pi_2_f = pi_2;
const float pi_4_f = pi_4;
#else
double const pi = 4.0*std::atan(1.0);
const double two_pi = 2.0*pi;
const double pi_2 = pi/2.0;
const double pi_4 = pi/4.0;
const float two_pi_f= two_pi;
const float pi_f = pi;
const float pi_2_f = pi_2;
const float pi_4_f = pi_4;
#endif
// Above method of setting is more intelligent.
//const double two_pi = 6.283185307179586476925286766559005768394338798750211641949888; /**< @brief Mathematical constant for 2*pi. */
//const double pi = 3.141592653589793238462643383279502884197169399375105820974944; /**< @brief Mathematical constant for pi. */
//const double pi_2 = 1.57079632679489661923; /**< @brief Mathematical constant for pi/2. */
//const double pi_4 = 0.78539816339744830962; /**< @brief Mathematical constant for pi/4. */
//const float two_pi_f= 6.283185307179586476925286766559005768394338798750211641949888; /**< @brief Mathematical constant (float format) for 2*pi. */
//const float pi_f = 3.141592653589793238462643383279502884197169399375105820974944; /**< @brief Mathematical constant (float format) for pi. */
//const float pi_2_f = 1.57079632679489661923; /**< @brief Mathematical constant (float format) for pi/2. */
//const float pi_4_f = 0.78539816339744830962; /**< @brief Mathematical constant (float format) for pi/4. */
} // namespace ecl
#endif /*ECL_MATH_CONSTANTS_HPP_*/