Implementation of Math's API's function.
More...
#include <cmath>
#include <type_traits>
Go to the source code of this file.
|
| NRE |
| The NearlyRealEngine's global namespace.
|
|
| Math |
| Math's API.
|
|
|
template<class T , class K , typename std::enable_if_t< std::is_floating_point< std::common_type_t< T, K >>::value, int > = 0> |
constexpr bool | NRE::Math::equal (T a, K b) |
|
template<class T , class K > |
constexpr bool | NRE::Math::almostEqual (T a, K b) |
|
template<class T , typename = UseIfArithmetic<T>> |
constexpr T | NRE::Math::lerp (T const &a, T const &b, float const &f) |
|
Implementation of Math's API's function.
- Author
- Louis ABEL
- Date
- 03/04/2019
- Copyright
- CC-BY-NC-SA
Enable a function if all given template parameters are arithmetics types
template<class T , class K >
constexpr bool NRE::Math::almostEqual |
( |
T |
a, |
|
|
K |
b |
|
) |
| |
Test if 2 objects are almost equals (usefull for floating point objects)
- Parameters
-
a | the first object |
b | the second object |
- Returns
- if both objets are almost equals
template<class T , class K , typename std::enable_if_t< std::is_floating_point< std::common_type_t< T, K >>::value, int > = 0>
constexpr bool NRE::Math::equal |
( |
T |
a, |
|
|
K |
b |
|
) |
| |
Test the equality of 2 objects
- Parameters
-
a | the first object |
b | the second object |
- Returns
- if both objets are equals
template<class T , typename = UseIfArithmetic<T>>
constexpr T NRE::Math::lerp |
( |
T const & |
a, |
|
|
T const & |
b, |
|
|
float const & |
f |
|
) |
| |
Perform a linear interpolation
- Parameters
-
a | the first value to interpolate |
b | the second value to interpolate |
f | the scale factor |
- Returns
- the interpolated value
template<class... Tn>
constexpr bool NRE::Math::ArithmeticCheckerV = ArithmeticChecker<Tn...>::value |