Berserk
Static Public Member Functions | Static Public Attributes | List of all members
MathUtils Class Reference

Math basic functions and constants. More...

#include <MathUtils.hpp>

Static Public Member Functions

static void Split (float v, float &integer, float &fractional)
 
static void Split (double v, double &integer, double &fractional)
 
static float Min (float a, float b)
 
static double Min (double a, double b)
 
static float Max (float a, float b)
 
static double Max (double a, double b)
 
static float Sin (float a)
 
static double Sin (double a)
 
static float Cos (float a)
 
static double Cos (double a)
 
static float Tan (float a)
 
static double Tan (double a)
 
static float Asin (float a)
 
static double Asin (double a)
 
static float Acos (float a)
 
static double Acos (double a)
 
static float Atan (float a)
 
static double Atan (double a)
 
static float Sqrt (float a)
 
static double Sqrt (double a)
 
static float Exp (float a)
 
static double Exp (double a)
 
static float Pow (float a, float p)
 
static double Pow (double a, double p)
 
static float Log (float a)
 
static double Log (double a)
 
static float Log2 (float a)
 
static double Log2 (double a)
 
static float Log10 (float a)
 
static double Log10 (double a)
 
static float Abs (float a)
 
static double Abs (double a)
 
static float DegToRad (float a)
 
static double DegToRad (double a)
 
static float RadToDeg (float a)
 
static double RadToDeg (double a)
 
static float Round (float a)
 
static double Round (double a)
 
static float Ceil (float a)
 
static double Ceil (double a)
 
static float Floor (float a)
 
static double Floor (double a)
 
static bool Same (float a, float b)
 
static bool Same (double a, double b)
 
static float Lerp (float t, float left, float right)
 
static double Lerp (double t, double left, double right)
 
static float SmoothStep (float t, float left, float right)
 
static double SmoothStep (double t, double left, double right)
 
static float SmootherStep (float t, float left, float right)
 
static double SmootherStep (double t, double left, double right)
 
template<typename T >
static bool Between (T t, T left, T right)
 
template<typename T >
static T Clamp (T t, T left, T right)
 
template<typename T >
static T Min (T a, T b)
 
template<typename T >
static T Max (T a, T b)
 
template<typename T >
static T Abs (T a)
 
template<typename T , T a>
static constexpr T ConstMax () noexcept
 
template<typename T , T a, T b, T... args>
static constexpr T ConstMax () noexcept
 
template<typename T , T a>
static constexpr T ConstMin () noexcept
 
template<typename T , T a, T b, T... args>
static constexpr T ConstMin () noexcept
 

Static Public Attributes

static BRK_API const float BIG_NUMBER_FLOAT32 = 3.4e+38f
 
static BRK_API const float SMALL_NUMBER_FLOAT32 = 1.e-8f
 
static BRK_API const float THRESH_FLOAT32 = 0.0001f
 
static BRK_API const float THRESH_POINT_ON_PLANE = 0.10f
 
static BRK_API const float THRESH_POINTS_ARE_SAME = 0.00002f
 
static BRK_API const float THRESH_ZERO_NORM_SQUARED = 0.0001f
 
static BRK_API const float THRESH_COMPARE_FLOAT32 = 0.0001f
 
static BRK_API const float THRESH_COMPARE_FLOAT64 = 0.000001f
 
static BRK_API const double PI = BERSERK_MATH_PI
 
static BRK_API const double HALF_PI = BERSERK_MATH_PI_2
 
static BRK_API const double QUARTER_PI = BERSERK_MATH_PI_4
 
static BRK_API const double SQRT2 = BERSERK_MATH_SQRT2
 
static BRK_API const double E = BERSERK_MATH_E
 
static BRK_API const float PIf = static_cast<float>(BERSERK_MATH_PI)
 
static BRK_API const float HALF_PIf = static_cast<float>(BERSERK_MATH_PI_2)
 
static BRK_API const float QUARTER_PIf = static_cast<float>(BERSERK_MATH_PI_4)
 
static BRK_API const float SQRT2f = static_cast<float>(BERSERK_MATH_SQRT2)
 
static BRK_API const float Ef = static_cast<float>(BERSERK_MATH_E)
 

Detailed Description

Math basic functions and constants.

Member Function Documentation

◆ Abs() [1/3]

static double MathUtils::Abs ( double  a)
inlinestatic

◆ Abs() [2/3]

static float MathUtils::Abs ( float  a)
inlinestatic

◆ Abs() [3/3]

template<typename T >
static T MathUtils::Abs ( T  a)
inlinestatic

◆ Acos() [1/2]

static double MathUtils::Acos ( double  a)
inlinestatic

◆ Acos() [2/2]

static float MathUtils::Acos ( float  a)
inlinestatic

◆ Asin() [1/2]

static double MathUtils::Asin ( double  a)
inlinestatic

◆ Asin() [2/2]

static float MathUtils::Asin ( float  a)
inlinestatic

◆ Atan() [1/2]

static double MathUtils::Atan ( double  a)
inlinestatic

◆ Atan() [2/2]

static float MathUtils::Atan ( float  a)
inlinestatic

◆ Between()

template<typename T >
static bool MathUtils::Between ( T  t,
T  left,
T  right 
)
inlinestatic

◆ Ceil() [1/2]

static double MathUtils::Ceil ( double  a)
inlinestatic
Returns
Math up round to int type

◆ Ceil() [2/2]

static float MathUtils::Ceil ( float  a)
inlinestatic
Returns
Math up round to int type

◆ Clamp()

template<typename T >
static T MathUtils::Clamp ( T  t,
T  left,
T  right 
)
inlinestatic

◆ ConstMax() [1/2]

template<typename T , T a>
static constexpr T MathUtils::ConstMax ( )
inlinestaticconstexprnoexcept

◆ ConstMax() [2/2]

template<typename T , T a, T b, T... args>
static constexpr T MathUtils::ConstMax ( )
inlinestaticconstexprnoexcept

◆ ConstMin() [1/2]

template<typename T , T a>
static constexpr T MathUtils::ConstMin ( )
inlinestaticconstexprnoexcept

◆ ConstMin() [2/2]

template<typename T , T a, T b, T... args>
static constexpr T MathUtils::ConstMin ( )
inlinestaticconstexprnoexcept

◆ Cos() [1/2]

static double MathUtils::Cos ( double  a)
inlinestatic

◆ Cos() [2/2]

static float MathUtils::Cos ( float  a)
inlinestatic

◆ DegToRad() [1/2]

static double MathUtils::DegToRad ( double  a)
inlinestatic

◆ DegToRad() [2/2]

static float MathUtils::DegToRad ( float  a)
inlinestatic

◆ Exp() [1/2]

static double MathUtils::Exp ( double  a)
inlinestatic

◆ Exp() [2/2]

static float MathUtils::Exp ( float  a)
inlinestatic

◆ Floor() [1/2]

static double MathUtils::Floor ( double  a)
inlinestatic
Returns
Math down round to int type

◆ Floor() [2/2]

static float MathUtils::Floor ( float  a)
inlinestatic
Returns
Math down round to int type

◆ Lerp() [1/2]

static double MathUtils::Lerp ( double  t,
double  left,
double  right 
)
inlinestatic

◆ Lerp() [2/2]

static float MathUtils::Lerp ( float  t,
float  left,
float  right 
)
inlinestatic

◆ Log() [1/2]

static double MathUtils::Log ( double  a)
inlinestatic

◆ Log() [2/2]

static float MathUtils::Log ( float  a)
inlinestatic

◆ Log10() [1/2]

static double MathUtils::Log10 ( double  a)
inlinestatic

◆ Log10() [2/2]

static float MathUtils::Log10 ( float  a)
inlinestatic

◆ Log2() [1/2]

static double MathUtils::Log2 ( double  a)
inlinestatic

◆ Log2() [2/2]

static float MathUtils::Log2 ( float  a)
inlinestatic

◆ Max() [1/3]

static double MathUtils::Max ( double  a,
double  b 
)
inlinestatic

◆ Max() [2/3]

static float MathUtils::Max ( float  a,
float  b 
)
inlinestatic

◆ Max() [3/3]

template<typename T >
static T MathUtils::Max ( T  a,
T  b 
)
inlinestatic

◆ Min() [1/3]

static double MathUtils::Min ( double  a,
double  b 
)
inlinestatic

◆ Min() [2/3]

static float MathUtils::Min ( float  a,
float  b 
)
inlinestatic

◆ Min() [3/3]

template<typename T >
static T MathUtils::Min ( T  a,
T  b 
)
inlinestatic

◆ Pow() [1/2]

static double MathUtils::Pow ( double  a,
double  p 
)
inlinestatic

◆ Pow() [2/2]

static float MathUtils::Pow ( float  a,
float  p 
)
inlinestatic

◆ RadToDeg() [1/2]

static double MathUtils::RadToDeg ( double  a)
inlinestatic

◆ RadToDeg() [2/2]

static float MathUtils::RadToDeg ( float  a)
inlinestatic

◆ Round() [1/2]

static double MathUtils::Round ( double  a)
inlinestatic
Returns
Math round to nearest int type

◆ Round() [2/2]

static float MathUtils::Round ( float  a)
inlinestatic
Returns
Math round to nearest int type

◆ Same() [1/2]

static bool MathUtils::Same ( double  a,
double  b 
)
inlinestatic

◆ Same() [2/2]

static bool MathUtils::Same ( float  a,
float  b 
)
inlinestatic

◆ Sin() [1/2]

static double MathUtils::Sin ( double  a)
inlinestatic

◆ Sin() [2/2]

static float MathUtils::Sin ( float  a)
inlinestatic

◆ SmootherStep() [1/2]

static double MathUtils::SmootherStep ( double  t,
double  left,
double  right 
)
inlinestatic

◆ SmootherStep() [2/2]

static float MathUtils::SmootherStep ( float  t,
float  left,
float  right 
)
inlinestatic

◆ SmoothStep() [1/2]

static double MathUtils::SmoothStep ( double  t,
double  left,
double  right 
)
inlinestatic

◆ SmoothStep() [2/2]

static float MathUtils::SmoothStep ( float  t,
float  left,
float  right 
)
inlinestatic

◆ Split() [1/2]

static void MathUtils::Split ( double  v,
double &  integer,
double &  fractional 
)
inlinestatic

◆ Split() [2/2]

static void MathUtils::Split ( float  v,
float &  integer,
float &  fractional 
)
inlinestatic

◆ Sqrt() [1/2]

static double MathUtils::Sqrt ( double  a)
inlinestatic

◆ Sqrt() [2/2]

static float MathUtils::Sqrt ( float  a)
inlinestatic

◆ Tan() [1/2]

static double MathUtils::Tan ( double  a)
inlinestatic

◆ Tan() [2/2]

static float MathUtils::Tan ( float  a)
inlinestatic

Member Data Documentation

◆ BIG_NUMBER_FLOAT32

BRK_NS_BEGIN const float MathUtils::BIG_NUMBER_FLOAT32 = 3.4e+38f
static

◆ E

const double MathUtils::E = BERSERK_MATH_E
static

◆ Ef

const float MathUtils::Ef = static_cast<float>(BERSERK_MATH_E)
static

◆ HALF_PI

const double MathUtils::HALF_PI = BERSERK_MATH_PI_2
static

◆ HALF_PIf

const float MathUtils::HALF_PIf = static_cast<float>(BERSERK_MATH_PI_2)
static

◆ PI

const double MathUtils::PI = BERSERK_MATH_PI
static

◆ PIf

const float MathUtils::PIf = static_cast<float>(BERSERK_MATH_PI)
static

◆ QUARTER_PI

const double MathUtils::QUARTER_PI = BERSERK_MATH_PI_4
static

◆ QUARTER_PIf

const float MathUtils::QUARTER_PIf = static_cast<float>(BERSERK_MATH_PI_4)
static

◆ SMALL_NUMBER_FLOAT32

const float MathUtils::SMALL_NUMBER_FLOAT32 = 1.e-8f
static

◆ SQRT2

const double MathUtils::SQRT2 = BERSERK_MATH_SQRT2
static

◆ SQRT2f

const float MathUtils::SQRT2f = static_cast<float>(BERSERK_MATH_SQRT2)
static

◆ THRESH_COMPARE_FLOAT32

const float MathUtils::THRESH_COMPARE_FLOAT32 = 0.0001f
static

◆ THRESH_COMPARE_FLOAT64

const float MathUtils::THRESH_COMPARE_FLOAT64 = 0.000001f
static

◆ THRESH_FLOAT32

const float MathUtils::THRESH_FLOAT32 = 0.0001f
static

◆ THRESH_POINT_ON_PLANE

const float MathUtils::THRESH_POINT_ON_PLANE = 0.10f
static

◆ THRESH_POINTS_ARE_SAME

const float MathUtils::THRESH_POINTS_ARE_SAME = 0.00002f
static

◆ THRESH_ZERO_NORM_SQUARED

const float MathUtils::THRESH_ZERO_NORM_SQUARED = 0.0001f
static

The documentation for this class was generated from the following files: