sandbox
Loading...
Searching...
No Matches
algorithm.hpp
1#ifndef LIBSBX_MATH_ALGORITHM_HPP_
2#define LIBSBX_MATH_ALGORITHM_HPP_
3
4#include <cmath>
5
6#include <libsbx/math/concepts.hpp>
7
8namespace sbx::math {
9
10template<floating_point Type>
11inline constexpr auto mix(const Type x, const Type y, const Type a) -> Type {
12 return x * (static_cast<Type>(1) - a) + y * a;
13}
14
15template<floating_point Type>
16inline constexpr auto abs(const Type value) -> Type {
17 return std::abs(value);
18}
19
20} // namespace sbx::math
21
22#endif // LIBSBX_MATH_ALGORITHM_HPP_