GPR5100 - Rollback
Loading...
Searching...
No Matches
Functions
basic.h File Reference
#include <random>
Include dependency graph for basic.h:

Go to the source code of this file.

Functions

constexpr float core::Abs (float v)
 Abs is a constexpr function that returns the absolute value. More...
 
constexpr bool core::Equal (float a, float b, float epsilon=0.0000001f)
 
constexpr float core::Lerp (float start, float end, float t)
 Lerp is a function calculating the linear interpolation between two points. More...
 
template<typename T >
constexpr float core::Clamp (T value, T lower, T upper)
 Clamp is a math function that clamps the input value between an upper and lower value. More...
 
template<typename T >
std::enable_if< std::is_integral< T >::value, T >::type core::RandomRange (T start, T end)
 
template<typename T >
std::enable_if< std::is_floating_point< T >::value, T >::type core::RandomRange (T start, T end)
 
template<typename T >
T constexpr core::SqrtNewtonRaphson (T x, T curr, T prev)
 
template<typename T >
T constexpr core::Sqrt (T x)
 Sqrt is a constexpr version of the square root. More...
 

Function Documentation

◆ Abs()

constexpr float core::Abs ( float  v)
constexpr

Abs is a constexpr function that returns the absolute value.

Parameters
vis the value that will be transform to absolute value
Returns
the absolute value of v
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Clamp()

template<typename T >
constexpr float core::Clamp ( value,
lower,
upper 
)
constexpr

Clamp is a math function that clamps the input value between an upper and lower value.

Template Parameters
Tis the inputs and outputs type
Parameters
valueis the input value that will be clamped
loweris the lower bound of the clamp
upperis the upper bound of the clamp
Returns
the clamped value between lower and upper
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lerp()

constexpr float core::Lerp ( float  start,
float  end,
float  t 
)
constexpr

Lerp is a function calculating the linear interpolation between two points.

Parameters
startis the lower value of the interpolation.
endis the upper value of the interpolation.
tis the ratio of the interpolation. t = 0, return start t = 1, return end t > 1 or t < 0, return an extrapolation of the linear function
Returns
the linear interpolation result
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sqrt()

template<typename T >
T constexpr core::Sqrt ( x)
constexpr

Sqrt is a constexpr version of the square root.

Template Parameters
Tis the input and output value type
Parameters
xis the input value
Returns
  • For a finite and non-negative value of "x", returns an approximation for the square root of "x"
  • Otherwise, returns NaN
Here is the call graph for this function:
Here is the caller graph for this function: