PICCANTE  0.4
The hottest HDR imaging library!
Namespaces | Macros | Functions | Variables
math.hpp File Reference
#include <math.h>
#include <cmath>
#include <random>
#include <stdlib.h>
#include <set>
#include <limits>
#include "../base.hpp"

Go to the source code of this file.

Namespaces

 pic
 

Macros

#define PIC_UTIL_MATH_HPP
 
#define MIN(a, b)   (a < b ? a : b)
 
#define MAX(a, b)   (a > b ? a : b)
 
#define CLAMP(x, a)   (x >= a ? (a - 1) : (x < 0 ? 0 : x))
 
#define CLAMPi(x, a, b)   (x < a ? a : (x > b ? b : x))
 

Functions

template<typename T >
PIC_INLINE bool pic::isnan (T value)
 isnan is it a NaN? More...
 
template<typename T >
PIC_INLINE bool pic::isinf (T value)
 isinf is it a Inf value? More...
 
PIC_INLINE bool pic::equalf (float a, float b)
 equalf checks if two float values are the same or not. More...
 
PIC_INLINE float pic::getRandombase ()
 Randombase returns a number in [0, 1] based on rand(). More...
 
PIC_INLINE float pic::getRandom (unsigned int n)
 Random returns a number in [0, 2^32 - 1] to a float in [0, 1]. More...
 
PIC_INLINE int pic::getRandomInt (int n, int a, int b)
 getRandomInt More...
 
PIC_INLINE float pic::sFunction (float x)
 sFunction evaluates a cubic s-function. More...
 
PIC_INLINE float pic::sCurve5 (float x)
 sCurve5 evaluates a quintic S-Shape: 6x^5-15x^4+10x^3 More...
 
PIC_INLINE float pic::square (float x)
 Square applies square function to a value. More...
 
PIC_INLINE float pic::sqrtf_s (float x)
 sqrtf_s More...
 
template<class T >
PIC_INLINEpic::Clamp (T x, T a, T b)
 Clamp clamps a value, x, in the bound [a,b]. More...
 
PIC_INLINE long pic::lround (double x)
 lround rounds double numbers properly. More...
 
PIC_INLINE float pic::lround (float x)
 lround rounds float numbers properly. More...
 
PIC_INLINE float pic::lerp (float t, float x0, float x1)
 lerp evaluates linear interpolation More...
 
PIC_INLINE float pic::SmoothStep (float a, float b, float value)
 SmoothStep smoothes a value from a to b using a cube S-Shape. More...
 
float pic::Deg2Rad (float deg)
 Deg2Rad converts angles expressed in degrees into angles expressed in radians. More...
 
PIC_INLINE float pic::Rad2Deg (float rad)
 Rad2Deg converts angles expressed in radians into angles expressed in degrees. More...
 
PIC_INLINE int pic::log2 (int n)
 log2 computes logarithm in base 2 for integers. More...
 
PIC_INLINE int pic::pow2 (int n)
 pow2 computes 2^n. More...
 
PIC_INLINE float pic::log10PlusOne (float x)
 logf10PlusOne computes log10 of a value plus 1. More...
 
PIC_INLINE float pic::expfMinusOne (float x)
 expMinusOne More...
 
PIC_INLINE float pic::log10fPlusEpsilon (float x)
 log10fPlusEpsilon More...
 
PIC_INLINE float pic::powf10fMinusEpsilon (float x)
 powf10fMinusEpsilon More...
 
PIC_INLINE float pic::log2f (float x)
 log2f logarithm in base 2 for floating point More...
 
PIC_INLINE double pic::log2 (double x)
 log2 More...
 
PIC_INLINE float pic::log2fPlusEpsilon (float x)
 log2fPlusEpsilon More...
 
PIC_INLINE float pic::pow2f (float x)
 pow2f More...
 
PIC_INLINE int pic::powint (int x, int b)
 powint computes power function for integer values. More...
 
PIC_INLINE void pic::getRandomPermutation (std::mt19937 &m, unsigned int *perm, unsigned int nPerm, unsigned int n)
 getRandomPermutation computes a random permutation. More...
 
PIC_INLINE float pic::normalDistribution (float x, float mu=0.0f, float sigma=1.0f)
 normalDistribution More...
 
float pic::normalCDF (float x, float mu, float sigma)
 normalCDF More...
 
PIC_INLINE float pic::betaFunction (float A, float B, float step=1e-4)
 betaFunction More...
 
PIC_INLINE float pic::betaPDFwithBeta (float x, float A, float B, float betaAB)
 betaPDFwithBeta More...
 
PIC_INLINE float pic::betaPDF (float x, float A, float B)
 betaPDF More...
 
PIC_INLINE float pic::sigmoid (float x)
 sigmoid More...
 
PIC_INLINE float pic::sigmoidInv (float x)
 sigmoidInv More...
 
PIC_INLINE float pic::simple8bitWithGamma (float x)
 simple8bitWithGamma More...
 

Variables

const float pic::C_LOG_NAT_2 = 0.69314718055994530941723212145818f
 
const float pic::C_INV_LOG_NAT_2 = 1.4426950408889634073599246810019f
 
const double pic::C_INV_LOG_NAT_2_D = 1.4426950408889634073599246810019
 
const float pic::C_EPSILON = 1e-6f
 
const float pic::C_SQRT_2 = 1.4142135623730950488016887242097f
 
const float pic::C_PI_025 = 0.78539816339744830961566084581988f
 
const float pic::C_PI_05 = 1.5707963267948966192313216916398f
 
const float pic::C_PI = 3.1415926535897932384626433832795f
 
const float pic::C_PI_2 = 6.283185307179586476925286766559f
 
const float pic::C_INV_PI_2 = 0.159154943091895335768883763f
 
const float pic::C_PI_4 = 12.566370614359172953850573533118f
 
const float pic::C_INV_PI_4 = 0.07957747154594766788444188168626f
 
const float pic::C_PI_2_2 = 19.739208802178717237668981999752f
 
const float pic::C_INV_PI = 0.31830988618379067153776526745f
 
const float pic::C_ONE_80_OVER_PI = 57.295779513082320876798154814105f
 
const float pic::C_PI_OVER_ONE_80 = 0.017453292519943295769236907685f
 

Macro Definition Documentation

◆ CLAMP

#define CLAMP (   x,
 
)    (x >= a ? (a - 1) : (x < 0 ? 0 : x))

◆ CLAMPi

#define CLAMPi (   x,
  a,
 
)    (x < a ? a : (x > b ? b : x))

◆ MAX

#define MAX (   a,
 
)    (a > b ? a : b)

◆ MIN

#define MIN (   a,
 
)    (a < b ? a : b)

◆ PIC_UTIL_MATH_HPP

#define PIC_UTIL_MATH_HPP