OGLplus  (0.59.0) a C++ wrapper for rendering APIs

functions.hpp File Reference
#include "../memory/span.hpp"
#include "../valid_if/decl.hpp"
#include "constants.hpp"
#include <cassert>
#include <cmath>
#include <type_traits>

Go to the source code of this file.

Classes

struct  eagine::math::bezier_t< Type, Parameter, N >
 Helper class for bezier curve segment calculations. More...
 

Namespaces

 eagine
 Common code is placed in this namespace.
 
 eagine::math
 Math-related code is placed in this namespace.
 

Functions

template<typename T >
static constexpr auto eagine::math::is_positive_power_of_2 (T value) noexcept -> std::enable_if_t< std::is_integral_v< T >, bool >
 Indicates if value is a positive integral power of two.
 
template<typename T >
static constexpr auto eagine::math::greatest_common_divisor (T l, T r) noexcept -> std::enable_if_t< std::is_integral_v< T >, T >
 Returns the greates common divisor of arguments l and r.
 
template<typename T >
static constexpr auto eagine::math::signum (T x) noexcept
 Returns 1 if x is non-negative, returns -1 otherwise.
 
template<typename T >
static constexpr auto eagine::math::minimum (T a, T b) noexcept
 Returns the minimum value of a and b.
 
template<typename T , typename... P>
static constexpr auto eagine::math::minimum (T a, T b, T c, P... d) noexcept
 Returns the minimum value from multiple arguments.
 
template<typename T >
static constexpr auto eagine::math::maximum (T a, T b) noexcept
 Returns the maximum value of a and b.
 
template<typename T , typename... P>
static constexpr auto eagine::math::maximum (T a, T b, T c, P... d) noexcept
 Returns the maximum value from multiple arguments.
 
template<typename T >
static constexpr auto eagine::math::ratio (T a, T b) noexcept -> optionally_valid< T >
 Returns a divided by b if b is not zero.
 
template<typename T >
static constexpr auto eagine::math::reciprocal (T x) noexcept -> optionally_valid< T >
 Returns the reciprocal of x if x is not zero.
 
template<typename T , typename Min , typename Max >
static constexpr auto eagine::math::clamp (T x, Min min, Max max) noexcept
 Clamps x to be between min and max.
 
template<typename T , typename S , typename E >
static constexpr auto eagine::math::ramp (T x, S start, E end) noexcept
 Normalizes x to (0, 1), where start = 0 and end = 1.
 
template<typename T , typename A >
static constexpr auto eagine::math::blend (T v1, T v2, A alpha) noexcept
 Blends v1 and v2, using alpha as the blending factor.
 
template<typename T >
static constexpr auto eagine::math::inverse_logistic (T x) noexcept
 Calculates the inverse logistic (log(x) - log(1 - x)) of x.
 
template<typename T >
static constexpr auto eagine::math::logistic (T x) noexcept
 Calculates the logistic (1 / (1 + exp(-x))) of x.
 
template<typename T , typename C >
static constexpr auto eagine::math::sigmoid01 (T x, C c) noexcept
 Calculates the sigmoid of x. The value c controls steepness. More...
 
template<typename T >
static constexpr auto eagine::math::sigmoid01 (T x) noexcept
 Calculates the default sigmoid of x. More...
 
template<typename T >
static auto eagine::math::sine_sigmoid01 (T x)
 Calculates goniometric sigmoid (cos in interval (0, 1)) of x. More...
 
template<typename T >
static constexpr auto eagine::math::sine_wave01 (T x) noexcept
 Calculates sine of x, mapped to interval (0, 1). More...
 
template<typename T >
static constexpr auto eagine::math::cosine_wave01 (T x) noexcept
 Calculates cosine of x, mapped to interval (0, 1). More...
 
template<typename T , typename U = T>
static constexpr auto eagine::math::saw (T x, U u=T(1)) noexcept
 Calculates floating-point modulo of x in intervals of u.
 
template<typename T >
static constexpr auto eagine::math::factorial (T n) noexcept -> std::enable_if_t< std::is_integral_v< T >, T >
 Calculates factorial of n.
 
template<typename T >
static constexpr auto eagine::math::binomial (T n, T k) noexcept -> std::enable_if_t< std::is_integral_v< T >, T >
 Calculates binomial coefficient of n over k.
 

Detailed Description

Copyright Matus Chochlik. Distributed under the Boost Software License, Version 1.0. See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt


Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).