All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
math.h File Reference

Assorted mathematical utility functions. More...

+ Include dependency graph for math.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool GfIsClose (double a, double b, double epsilon)
 Returns true if a and b are with epsilon of each other.
 
double GfRadiansToDegrees (double radians)
 Converts an angle in radians to degrees.
 
double GfDegreesToRadians (double degrees)
 Converts an angle in degrees to radians.
 
GF_API double GfSmoothStep (double min, double max, double val, double slope0=0.0, double slope1=0.0)
 Smooth step function using a cubic hermite blend.
 
GF_API double GfSmoothRamp (double tmin, double tmax, double t, double w0, double w1)
 Smooth Step with independently controllable shoulders.
 
template<class T >
double GfSqr (const T &x)
 Returns the inner product of x with itself: specifically, x*x.
 
template<typename T >
GfSgn (T v)
 Return the signum of v (i.e.
 
double GfSqrt (double f)
 Return sqrt(f).
 
float GfSqrt (float f)
 Return sqrt(f).
 
double GfExp (double f)
 Return exp(f).
 
float GfExp (float f)
 Return exp(f).
 
double GfLog (double f)
 Return log(f).
 
float GfLog (float f)
 Return log(f).
 
double GfFloor (double f)
 Return floor(f).
 
float GfFloor (float f)
 Return floor(f).
 
double GfCeil (double f)
 Return ceil(f).
 
float GfCeil (float f)
 Return ceil(f).
 
double GfAbs (double f)
 Return abs(f).
 
float GfAbs (float f)
 Return abs(f).
 
double GfRound (double f)
 Return round(f).
 
float GfRound (float f)
 Return round(f).
 
double GfPow (double f, double p)
 Return pow(f, p).
 
float GfPow (float f, float p)
 Return pow(f, p).
 
double GfSin (double v)
 Return sin(v).
 
float GfSin (float v)
 Return sin(v).
 
double GfCos (double v)
 Return cos(v).
 
float GfCos (float v)
 Return cos(v).
 
void GfSinCos (double v, double *s, double *c)
 Return sin(v) in s and cos(v) in c.
 
void GfSinCos (float v, float *s, float *c)
 Return sin(v) in s and cos(v) in c.
 
double GfClamp (double value, double min, double max)
 Return the resulting of clamping value to lie between min and max.
 
float GfClamp (float value, float min, float max)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
GF_API double GfMod (double a, double b)
 The mod function with "correct" behaviour for negative numbers.
 
GF_API float GfMod (float a, float b)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<class T >
GfLerp (double alpha, const T &a, const T &b)
 Linear interpolation function.
 
template<class T >
GfMin (T a1, T a2)
 Returns the smallest of the given values.
 
template<class T >
GfMin (T a1, T a2, T a3)
 
template<class T >
GfMin (T a1, T a2, T a3, T a4)
 
template<class T >
GfMin (T a1, T a2, T a3, T a4, T a5)
 
template<class T >
GfMax (T a1, T a2)
 Returns the largest of the given values.
 
template<class T >
GfMax (T a1, T a2, T a3)
 
template<class T >
GfMax (T a1, T a2, T a3, T a4)
 
template<class T >
GfMax (T a1, T a2, T a3, T a4, T a5)
 
template<typename Left , typename Right , std::enable_if_t< GfIsArithmetic< Left >::value &&GfIsArithmetic< Right >::value, int > = 0>
decltype(std::declval< Left >() *std::declval< Right >()) GfDot (Left left, Right right)
 Returns the dot (inner) product of two vectors.
 
template<typename Left , typename Right , std::enable_if_t< GfIsArithmetic< Left >::value &&GfIsArithmetic< Right >::value, int > = 0>
decltype(std::declval< Left >() *std::declval< Right >()) GfCompMult (Left left, Right right)
 Returns component-wise multiplication of vectors.
 
template<typename Left , typename Right , std::enable_if_t< GfIsArithmetic< Left >::value &&GfIsArithmetic< Right >::value, int > = 0>
decltype(std::declval< Left >()/std::declval< Right >()) GfCompDiv (Left left, Right right)
 Returns component-wise quotient of vectors.
 

Detailed Description

Assorted mathematical utility functions.

Definition in file math.h.

Function Documentation

◆ GfMax() [1/3]

T GfMax ( a1,
a2,
a3 
)
inline

Definition at line 330 of file math.h.

◆ GfMax() [2/3]

T GfMax ( a1,
a2,
a3,
a4 
)
inline

Definition at line 334 of file math.h.

◆ GfMax() [3/3]

T GfMax ( a1,
a2,
a3,
a4,
a5 
)
inline

Definition at line 338 of file math.h.

◆ GfMin() [1/3]

T GfMin ( a1,
a2,
a3 
)
inline

Definition at line 311 of file math.h.

◆ GfMin() [2/3]

T GfMin ( a1,
a2,
a3,
a4 
)
inline

Definition at line 315 of file math.h.

◆ GfMin() [3/3]

T GfMin ( a1,
a2,
a3,
a4,
a5 
)
inline

Definition at line 319 of file math.h.

◆ GfMod()

GF_API float GfMod ( float  a,
float  b 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.