18 #ifndef OPEN_KARTO_MATH_H 19 #define OPEN_KARTO_MATH_H 79 return (value * value);
89 return value >= 0.0 ? floor(value + 0.5) : ceil(value - 0.5);
99 inline const T&
Minimum(
const T& value1,
const T& value2)
101 return value1 < value2 ? value1 : value2;
111 inline const T&
Maximum(
const T& value1,
const T& value2)
113 return value1 > value2 ? value1 : value2;
124 inline const T&
Clip(
const T& n,
const T& minValue,
const T& maxValue)
137 double delta = a - b;
138 return delta < 0.0 ? delta >= -KT_TOLERANCE : delta <=
KT_TOLERANCE;
149 return (value >= 0 && value < maximum);
161 return (value < maximum);
174 return (value >= a && value <= b);
184 while (angle < -KT_PI)
196 while (angle > KT_PI)
223 while (minuend - subtrahend < -KT_PI)
228 while (minuend - subtrahend > KT_PI)
246 return static_cast<T
> ((value + (alignValue - 1)) & ~(alignValue - 1));
252 #endif // OPEN_KARTO_MATH_H
const kt_int32s INVALID_SCAN
kt_double Round(kt_double value)
const T & Maximum(const T &value1, const T &value2)
const T & Minimum(const T &value1, const T &value2)
kt_double DegreesToRadians(kt_double degrees)
const kt_double KT_180_PI
kt_bool IsUpTo< kt_int32u >(const kt_int32u &value, const kt_int32u &maximum)
kt_double RadiansToDegrees(kt_double radians)
const T & Clip(const T &n, const T &minValue, const T &maxValue)
T AlignValue(size_t value, size_t alignValue=8)
kt_bool InRange(const T &value, const T &a, const T &b)
const kt_double KT_TOLERANCE
kt_double NormalizeAngle(kt_double angle)
kt_double NormalizeAngleDifference(kt_double minuend, kt_double subtrahend)
kt_bool DoubleEqual(kt_double a, kt_double b)
const kt_double KT_PI_180
kt_bool IsUpTo(const T &value, const T &maximum)