4 #include "blub/core/globals.hpp"
6 #include <boost/config/suffix.hpp>
20 #if defined(BOOST_NO_CXX11_CONSTEXPR)
21 static const real math::pi;
22 static const real math::piHalf;
23 static const real math::sqrtZeroPointFive;
24 static const real math::sqrtOneThird;
26 static constexpr real pi = 3.14159265358979323846;
27 static constexpr real piHalf = pi / 2.;
28 static constexpr real sqrtZeroPointFive = 0.707106781;
29 static constexpr real sqrtOneThird = 0.577350269;
34 static T min(
const T &val,
const T &minimum)
36 return std::min(val, minimum);
39 static T max(
const T &val,
const T &maximum)
41 return std::max(val, maximum);
43 static real abs(
const real& calc);
46 static T clamp(
const T& val,
const T& minval,
const T& maxval)
48 BASSERT(minval <= maxval);
49 return std::max(std::min(val, maxval), minval);
51 template <
typename T,
typename pairType>
52 static T clamp(
const T& val,
const pairType& minMaxVal)
54 BASSERT(minMaxVal.first <= minMaxVal.second);
55 return clamp(val, minMaxVal.first, minMaxVal.second);
58 static real
map(
const real &value,
const real &fromMin,
const real &fromMax,
const real &toMin,
const real &toMax);
61 static T floor(
const T& calc)
63 return std::floor(calc);
66 static T ceil(
const T& val)
68 return std::ceil(val);
72 static bool between(
const T& number,
const T& min,
const T& max)
74 return (number >= min) && (number <= max);
77 static real sin(
const real& calc);
78 static real asin(
const real& calc);
79 static real cos(
const real& calc);
80 static real acos(
const real& calc);
81 static real atan2(
const real& fst,
const real& snd);
83 static real sqrt(
const real& calc);
85 static int32 pow(
const int32& number,
const int32& expo);
86 static real pow(
const real& number,
const real& expo);
89 static real randReal();
99 #endif // BLUB_MATH_HPP
Definition: deadlineTimer.hpp:10