MathUtils.hpp File Reference
#include <Core/Utils/Macros.hpp>
#include <cstddef>
#include <limits>
#include <type_traits>
#include <Core/Math/MathUtils-Impl.hpp>

Go to the source code of this file.

Namespaces

 CubbyFlow
 

Functions

template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, bool > CubbyFlow::Similar (T x, T y, T eps=std::numeric_limits< T >::epsilon())
 Returns true if x and y are similar. More...
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, T > CubbyFlow::Sign (T x)
 Returns the sign of the value. More...
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, T > CubbyFlow::Min3 (T x, T y, T z)
 Returns the minimum value among three inputs. More...
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, T > CubbyFlow::Max3 (T x, T y, T z)
 Returns the maximum value among three inputs. More...
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, T > CubbyFlow::MinN (const T *x, size_t n)
 Returns minimum among n-elements. More...
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, T > CubbyFlow::MaxN (const T *x, size_t n)
 Returns maximum among n-elements. More...
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, T > CubbyFlow::AbsMin (T x, T y)
 Returns the absolute minimum value among the two inputs. More...
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, T > CubbyFlow::AbsMax (T x, T y)
 Returns the absolute maximum value among the two inputs. More...
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, T > CubbyFlow::AbsMinN (const T *x, size_t n)
 Returns absolute minimum among n-elements. More...
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, T > CubbyFlow::AbsMaxN (const T *x, size_t n)
 Returns absolute maximum among n-elements. More...
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, size_t > CubbyFlow::ArgMin2 (T x, T y)
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, size_t > CubbyFlow::ArgMax2 (T x, T y)
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, size_t > CubbyFlow::ArgMin3 (T x, T y, T z)
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, size_t > CubbyFlow::ArgMax3 (T x, T y, T z)
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, T > CubbyFlow::Square (T x)
 Returns the square of x. More...
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, T > CubbyFlow::Cubic (T x)
 Returns the cubic of x. More...
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, T > CubbyFlow::Clamp (T val, T low, T high)
 Returns the clamped value. More...
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, T > CubbyFlow::DegreesToRadians (T angleInDegrees)
 Converts degrees to radians. More...
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, T > CubbyFlow::RadiansToDegrees (T angleInRadians)
 Converts radians to degrees. More...
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value > CubbyFlow::GetBarycentric (T x, size_t begin, size_t end, size_t &i, T &t)
 Computes the barycentric coordinate. More...
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value > CubbyFlow::GetBarycentric (T x, ssize_t begin, ssize_t end, ssize_t &i, T &t)
 Computes the barycentric coordinate. More...
 
template<typename S , typename T >
std::enable_if_t< std::is_arithmetic< T >::value, S > CubbyFlow::Lerp (const S &f0, const S &f1, T t)
 Computes linear interpolation. More...
 
template<typename S , typename T >
std::enable_if_t< std::is_arithmetic< T >::value, S > CubbyFlow::BiLerp (const S &f00, const S &f10, const S &f01, const S &f11, T tx, T ty)
 Computes bilinear interpolation. More...
 
template<typename S , typename T >
std::enable_if_t< std::is_arithmetic< T >::value, S > CubbyFlow::TriLerp (const S &f000, const S &f100, const S &f010, const S &f110, const S &f001, const S &f101, const S &f011, const S &f111, T tx, T ty, T tz)
 Computes trilinear interpolation. More...
 
template<typename S , typename T >
std::enable_if_t< std::is_arithmetic< T >::value, S > CubbyFlow::CatmullRom (const S &f0, const S &f1, const S &f2, const S &f3, T t)
 Computes Catmull-Rom interpolation. More...
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, T > CubbyFlow::MonotonicCatmullRom (const T &f0, const T &f1, const T &f2, const T &f3, T t)
 Computes monotonic Catmull-Rom interpolation. More...