Loading...
Searching...
No Matches
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.
 
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 223 of file math.h.

◆ GfMax() [2/3]

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

Definition at line 227 of file math.h.

◆ GfMax() [3/3]

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

Definition at line 231 of file math.h.

◆ GfMin() [1/3]

T GfMin ( a1,
a2,
a3 
)
inline

Definition at line 204 of file math.h.

◆ GfMin() [2/3]

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

Definition at line 208 of file math.h.

◆ GfMin() [3/3]

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

Definition at line 212 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.