7 PL_ALWAYS_INLINE
bool IsFinite(
float value)
14 return ((i2f.i & 0x7f800000u) != 0x7f800000u);
17 PL_ALWAYS_INLINE
bool IsNaN(
float value)
24 return (((i2f.i & 0x7f800000u) == 0x7f800000u) && ((i2f.i & 0x7FFFFFu) != 0));
27 PL_ALWAYS_INLINE
float Floor(
float f)
32 PL_ALWAYS_INLINE
float Ceil(
float f)
37 PL_ALWAYS_INLINE
float Round(
float f)
39 return Floor(f + 0.5f);
44 return Round(f / fMultiple) * fMultiple;
50 float fDivides = f / fMultiple;
51 float fFactor = Floor(fDivides);
52 return fFactor * fMultiple;
55 inline float RoundUp(
float f,
float fMultiple)
57 float fDivides = f / fMultiple;
58 float fFactor = Ceil(fDivides);
59 return fFactor * fMultiple;
97 PL_ALWAYS_INLINE
float Exp(
float f)
102 PL_ALWAYS_INLINE
float Ln(
float f)
107 PL_ALWAYS_INLINE
float Log2(
float f)
112 PL_ALWAYS_INLINE
float Log10(
float f)
117 PL_ALWAYS_INLINE
float Log(
float fBase,
float f)
119 return log10f(f) / log10f(fBase);
122 PL_ALWAYS_INLINE
float Pow2(
float f)
127 PL_ALWAYS_INLINE
float Pow(
float fBase,
float fExp)
129 return powf(fBase, fExp);
132 PL_ALWAYS_INLINE
float Root(
float f,
float fNthRoot)
134 return powf(f, 1.0f / fNthRoot);
137 PL_ALWAYS_INLINE
float Sqrt(
float f)
142 PL_ALWAYS_INLINE
float Mod(
float f,
float fDiv)
144 return fmodf(f, fDiv);
Float wrapper struct for a safe usage and conversions of angles.
Definition Angle.h:10
static constexpr plAngle MakeFromRadian(float fRadian)
Creates an instance of plAngle that was initialized from radian. (No need for any conversion)
Definition Angle_inl.h:38
constexpr float GetRadian() const
Returns the radian value. (No need for any conversion)
Definition Angle_inl.h:48
This namespace provides common math-functionality as functions.
Definition Constants.h:6
double RoundDown(double f, double fMultiple)
Returns a multiple of fMultiple that is smaller than f.
Definition MathDouble_inl.h:40
PL_ALWAYS_INLINE plAngle ASin(float f)
Returns the arcus sinus of f.
Definition MathFloat_inl.h:77
PL_ALWAYS_INLINE plAngle ATan(float f)
Returns the arcus tangent of f.
Definition MathFloat_inl.h:87
PL_ALWAYS_INLINE plAngle ACos(float f)
Returns the arcus cosinus of f.
Definition MathFloat_inl.h:82
PL_ALWAYS_INLINE double RoundToMultiple(double f, double fMultiple)
Rounds f to the closest value of multiple.
Definition MathDouble_inl.h:54
PL_ALWAYS_INLINE double Round(double f)
Rounds f to the next integer.
Definition MathDouble_inl.h:35
PL_ALWAYS_INLINE float Sin(plAngle a)
***** Trigonometric Functions *****
Definition MathFloat_inl.h:62
PL_ALWAYS_INLINE plAngle ATan2(float y, float x)
Returns the atan2 of x and y.
Definition MathFloat_inl.h:92
double RoundUp(double f, double fMultiple)
Returns a multiple of fMultiple that is larger than f.
Definition MathDouble_inl.h:47
PL_ALWAYS_INLINE double Mod(double f, double fDiv)
Returns "value mod div" for doubles. This also works with negative numbers, both for value and for di...
Definition MathDouble_inl.h:104
PL_ALWAYS_INLINE float Tan(plAngle a)
Takes an angle, returns its tangent.
Definition MathFloat_inl.h:72
PL_ALWAYS_INLINE double Sqrt(double f)
Returns the square root of f.
Definition MathDouble_inl.h:99
PL_ALWAYS_INLINE float Cos(plAngle a)
Takes an angle, returns its cosine.
Definition MathFloat_inl.h:67
Simple helper union to store ints and floats to modify their bit patterns.
Definition Declarations.h:18