40 return deg / 180.0f *
PI;
49 return rad /
PI * 180.0f;
58 template <
typename T>
bool isFloating0(
T num,
T epsilon = std::numeric_limits<T>::epsilon()) {
59 return num <= epsilon && num >= -epsilon;
69 template <
typename T>
bool isFloatingEqual(
T num1,
T num2,
T epsilon = std::numeric_limits<T>::epsilon()) {
71 return tmp <= epsilon && tmp >= -epsilon;
79 template <
typename T>
int sign(
T val) {
80 return (
T(0) < val) - (val <
T(0));
83 template <
typename T>
typename std::enable_if<std::is_floating_point<T>::value,
T>::type
randomRange(
T min,
T max) {
84 static thread_local std::random_device randomDevice;
85 static thread_local std::mt19937 generator(randomDevice());
86 std::uniform_real_distribution<T> distribution(min,max);
87 return distribution(generator);
90 template <
typename T>
typename std::enable_if<std::is_integral<T>::value,
T>::type
randomRange(
T min,
T max) {
91 static thread_local std::random_device randomDevice;
92 static thread_local std::mt19937 generator(randomDevice());
93 std::uniform_int_distribution<T> distribution(min,max);
94 return distribution(generator);
std::enable_if< std::is_floating_point< T >::value, T >::type randomRange(T min, T max)
bool isFloatingEqual(T num1, T num2, T epsilon=std::numeric_limits< T >::epsilon())
constexpr float radToDeg(float rad)
bool isFloating0(T num, T epsilon=std::numeric_limits< T >::epsilon())
constexpr float degToRad(float deg)