20 #ifndef __OpenKarto_Math_h__ 21 #define __OpenKarto_Math_h__ 106 return (value * value);
116 return value >= 0.0 ? floor(value + 0.5) : ceil(value - 0.5);
126 inline const T&
Minimum(
const T& value1,
const T& value2)
128 return value1 < value2 ? value1 : value2;
138 inline const T&
Maximum(
const T& value1,
const T& value2)
140 return value1 > value2 ? value1 : value2;
151 inline const T&
Clip(
const T& n,
const T& minValue,
const T& maxValue)
164 double delta = a - b;
165 return delta < 0.0 ? delta >= -KT_TOLERANCE : delta <=
KT_TOLERANCE;
177 return (value >= 0 && value < maximum);
191 return (value < maximum);
205 return (value >= a && value <= b);
215 while (angle < -KT_PI)
227 while (angle > KT_PI)
254 while (minuend - subtrahend < -KT_PI)
259 while (minuend - subtrahend > KT_PI)
277 return static_cast<T
> ((value + (alignValue - 1)) & ~(alignValue - 1));
299 #endif // __OpenKarto_Math_h__
const T & Maximum(const T &value1, const T &value2)
kt_bool IsUpTo(const T &value, const T &maximum)
kt_double Round(kt_double value)
const kt_double KT_PI_180
const kt_double KT_TOLERANCE
const T & Minimum(const T &value1, const T &value2)
T AlignValue(size_t value, size_t alignValue=8)
const T & Clip(const T &n, const T &minValue, const T &maxValue)
const kt_double KT_180_PI
kt_double NormalizeAngleDifference(kt_double minuend, kt_double subtrahend)
kt_double DegreesToRadians(kt_double degrees)
kt_double NormalizeAngle(kt_double angle)
kt_bool InRange(const T &value, const T &a, const T &b)
kt_bool DoubleEqual(kt_double a, kt_double b)
kt_double RadiansToDegrees(kt_double radians)