Commit 068d96eb authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[FIX] fixed unused variable piFloat warning by replacing these constants with...

[FIX] fixed unused variable piFloat warning by replacing these constants with a function. The original piDouble/piFloat names are aliased via #defines(, although a more elegant solution would be possible in c++11 and above). We keep these constant for compatibility, as we do not know which modules might use it.
parent 747fd5a8
......@@ -37,17 +37,34 @@
* Classes and functions of math module of OpenWalnut.
*/
// Pi constants - we don't use the macro M_PI, because it is not part of the C++-standard.
// ref.: http://stackoverflow.com/questions/1727881/how-to-use-the-pi-constant-in-c
/**
* The pi constant in float format
* Get a PI constant in an arbitrary type.
*
* \tparam T the desired type
* \param T the parameter is only needed for deducing T. This is needed since C++ < C++11 does not allow default template types in function templates.
* You need to set this parameter to an example value of the desired type T for pi. Usually, the default constructor will do well.
*
* \example pi( int() ) will return 3.
*
* \return pi in the desired type.
*/
template< typename T >
T pi( T = double() )
{
return boost::math::constants::pi< T >();
}
/**
* For the lazy programmer and backwards compatibility, define piDouble to be PI as double. Since defines are usually a bad idea (for aliasing), you
* should avoid using this. Use the \ref pi function directly.
*/
const float piFloat = boost::math::constants::pi<float>();
#define piDouble pi( double() )
/**
* The pi constant in double format
* For the lazy programmer and backwards compatibility, define piFloat to be PI as float. Since defines are usually a bad idea (for aliasing), you
* should avoid using this. Use the \ref pi function directly.
*/
const double piDouble = boost::math::constants::pi<double>();
#define piFloat pi( float() )
/**
* Checks if the triangle intersects with the given plane. If you are interested in the points of
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment