3 #ifndef UTILITY_H_INCLUDED
4 #define UTILITY_H_INCLUDED
17 const double infinity = std::numeric_limits<double>::max();
19 const double pi = 3.141592653589793;
60 inline int sign(
double val) {
61 if (std::abs(val) <
epsilon)
return 0;
62 if (val < 0)
return -1;
75 inline std::string
toUpper(
const std::string& str) {
76 std::string tmp = str;
77 std::transform(tmp.begin(), tmp.end(), tmp.begin(), toupper);
std::string toUpper(const std::string &str)
Convert a string to upper case.
Definition: utility.h:75
const double infinity
Very large number, bigger than any sensible distance.
Definition: utility.h:17
const double pi
, obviously. Note that M_PI is NOT part of standard C/C++, so is not portable
Definition: utility.h:19
double deg2rad(double deg)
Convert degrees to radians.
Definition: utility.h:31
int sign(double val)
Return the sign of a number.
Definition: utility.h:60
const double epsilon
Small number for checking when things are almost zero.
Definition: utility.h:15
double rad2deg(double rad)
Convert radians to degrees.
Definition: utility.h:45