OSSIA
Open Scenario System for Interactive Application
math.hpp File Reference

Detailed Description

This file contains various mathematical constants and utilities

Go to the source code of this file.

Namespaces

 ossia
 

Functions

template<typename T >
ossia::ipow (T x, int N) noexcept
 
template<typename T >
auto ossia::norm (T x, T y) noexcept
 
template<typename T >
auto ossia::norm (T x, T y, T z) noexcept
 
constexpr size_t ossia::constexpr_log2 (size_t n) noexcept
 
template<typename T >
constexpr size_t ossia::constexpr_abs (T n) noexcept
 
template<typename T >
constexpr int64_t ossia::constexpr_floor (T val) noexcept
 
template<typename T >
constexpr int64_t ossia::constexpr_ceil (T f)
 
template<class T , class U >
constexpr OSSIA_INLINE auto ossia::max (const T a, const U b) noexcept -> typename std::conditional<(sizeof(T) > sizeof(U)), T, U >::type
 max function tailored for values
 
template<class T , class U >
constexpr OSSIA_INLINE auto ossia::min (const T a, const U b) noexcept -> typename std::conditional<(sizeof(T) > sizeof(U)), T, U >::type
 min function tailored for values
 
template<class T >
constexpr OSSIA_INLINE T ossia::clamp (T d, const T min, const T max) noexcept
 clamp Returns the value bounded by a min and a max
 
template<class T >
constexpr OSSIA_INLINE T ossia::wrap (const T val, const T low, const T high) noexcept
 
template<class T >
constexpr OSSIA_INLINE T ossia::fold (const T val, const T low, const T high) noexcept
 
template<class T >
constexpr OSSIA_INLINE std::pair< T, T > ossia::div (T num, T denom) noexcept
 
OSSIA_INLINE float ossia::log_to_normalized (float min, float range, float val) noexcept
 
OSSIA_INLINE float ossia::normalized_to_log (float min, float range, float val) noexcept
 
template<typename T , typename R >
constexpr OSSIA_INLINE bool ossia::valid_index (T idx, const R &range) noexcept
 

Variables

constexpr const auto ossia::pi = 3.141592653589793238462643383279502884
 
constexpr const auto ossia::two_pi = 6.283185307179586476925286766559005768
 
constexpr const auto ossia::half_pi = 1.570796326794896619231321691639751442
 
constexpr const auto ossia::rad_to_deg = 5.729577951308232087679815481410517033e+01
 
constexpr const auto ossia::deg_to_rad = 1.745329251994329576923690768488612713e-02
 
constexpr const auto ossia::ln_2 = 6.931471805599453094172321214581765680e-01
 
constexpr const auto ossia::sqrt_2 = 1.414213562373095048801688724209698078e+00