MathDefs.h File Reference
#include "../Math/Random.h"
#include <cstdlib>
#include <cmath>
#include <limits>
#include <type_traits>
Include dependency graph for MathDefs.h:
This graph shows which files directly or indirectly include this file:


enum  Urho3D::Intersection { OUTSIDE, INTERSECTS, INSIDE }
 Intersection test result.


template<class T >
bool Urho3D::Equals (T lhs, T rhs)
 Check whether two floating point values are equal within accuracy.
template<class T , class U >
Urho3D::Lerp (T lhs, T rhs, U t)
 Linear interpolation between two values.
template<class T >
Urho3D::InverseLerp (T lhs, T rhs, T x)
 Inverse linear interpolation between two values.
template<class T , class U >
Urho3D::Min (T lhs, U rhs)
 Return the smaller of two values.
template<class T , class U >
Urho3D::Max (T lhs, U rhs)
 Return the larger of two values.
template<class T >
Urho3D::Abs (T value)
 Return absolute value of a value.
template<class T >
Urho3D::Sign (T value)
 Return the sign of a float (-1, 0 or 1.)
template<class T >
Urho3D::ToRadians (const T degrees)
 Convert degrees to radians.
template<class T >
Urho3D::ToDegrees (const T radians)
 Convert radians to degrees.
unsigned Urho3D::FloatToRawIntBits (float value)
 Return a representation of the specified floating-point value as a single format bit layout.
template<class T >
bool Urho3D::IsNaN (T value)
 Check whether a floating point value is NaN.
template<class T >
Urho3D::Clamp (T value, T min, T max)
 Clamp a number to a range.
template<class T >
Urho3D::SmoothStep (T lhs, T rhs, T t)
 Smoothly damp between values.
template<class T >
Urho3D::Sin (T angle)
 Return sine of an angle in degrees.
template<class T >
Urho3D::Cos (T angle)
 Return cosine of an angle in degrees.
template<class T >
Urho3D::Tan (T angle)
 Return tangent of an angle in degrees.
template<class T >
Urho3D::Asin (T x)
 Return arc sine in degrees.
template<class T >
Urho3D::Acos (T x)
 Return arc cosine in degrees.
template<class T >
Urho3D::Atan (T x)
 Return arc tangent in degrees.
template<class T >
Urho3D::Atan2 (T y, T x)
 Return arc tangent of y/x in degrees.
template<class T >
Urho3D::Pow (T x, T y)
 Return X in power Y.
template<class T >
Urho3D::Ln (T x)
 Return natural logarithm of X.
template<class T >
Urho3D::Sqrt (T x)
 Return square root of X.
template<class T >
Urho3D::Mod (T x, T y)
 Return floating-point remainder of X/Y.
template<class T >
Urho3D::Fract (T value)
 Return fractional part of passed value in range [0, 1).
template<class T >
Urho3D::Floor (T x)
 Round value down.
template<class T >
int Urho3D::FloorToInt (T x)
 Round value down. Returns integer value.
template<class T >
Urho3D::Round (T x)
 Round value to nearest integer.
template<class Iterator >
auto Urho3D::Average (Iterator begin, Iterator end) -> typename std::decay< decltype(*begin)>::type
 Compute average value of the range.
template<class T >
int Urho3D::RoundToInt (T x)
 Round value to nearest integer.
template<class T >
Urho3D::RoundToNearestMultiple (T x, T multiple)
 Round value to nearest multiple.
template<class T >
Urho3D::Ceil (T x)
 Round value up.
template<class T >
int Urho3D::CeilToInt (T x)
 Round value up.
bool Urho3D::IsPowerOfTwo (unsigned value)
 Check whether an unsigned integer is a power of two.
unsigned Urho3D::NextPowerOfTwo (unsigned value)
 Round up to next power of two.
unsigned Urho3D::LogBaseTwo (unsigned value)
 Return log base two or the MSB position of the given value.
unsigned Urho3D::CountSetBits (unsigned value)
 Count the number of set bits in a mask.
unsigned Urho3D::SDBMHash (unsigned hash, unsigned char c)
 Update a hash with the given 8-bit value using the SDBM algorithm.
float Urho3D::Random ()
 Return a random float between 0.0 (inclusive) and 1.0 (exclusive.)
float Urho3D::Random (float range)
 Return a random float between 0.0 and range, inclusive from both ends.
float Urho3D::Random (float min, float max)
 Return a random float between min and max, inclusive from both ends.
int Urho3D::Random (int range)
 Return a random integer between 0 and range - 1.
int Urho3D::Random (int min, int max)
 Return a random integer between min and max - 1.
float Urho3D::RandomNormal (float meanValue, float variance)
 Return a random normal distributed number with the given mean value and variance.
unsigned short Urho3D::FloatToHalf (float value)
 Convert float to half float. From
float Urho3D::HalfToFloat (unsigned short value)
 Convert half float to float. From
void Urho3D::SinCos (float angle, float &sin, float &cos)
 Calculate both sine and cosine, with angle in degrees.


static const float Urho3D::M_PI = 3.14159265358979323846264338327950288f
static const float Urho3D::M_HALF_PI = M_PI * 0.5f
static const int Urho3D::M_MIN_INT = 0x80000000
static const int Urho3D::M_MAX_INT = 0x7fffffff
static const unsigned Urho3D::M_MIN_UNSIGNED = 0x00000000
static const unsigned Urho3D::M_MAX_UNSIGNED = 0xffffffff
static const float Urho3D::M_EPSILON = 0.000001f
static const float Urho3D::M_LARGE_EPSILON = 0.00005f
static const float Urho3D::M_MIN_NEARCLIP = 0.01f
static const float Urho3D::M_MAX_FOV = 160.0f
static const float Urho3D::M_LARGE_VALUE = 100000000.0f
static const float Urho3D::M_INFINITY = (float)HUGE_VAL
static const float Urho3D::M_DEGTORAD = M_PI / 180.0f
static const float Urho3D::M_DEGTORAD_2 = M_PI / 360.0f
static const float Urho3D::M_RADTODEG = 1.0f / M_DEGTORAD