KrisLibrary  1.0.0
Namespaces | Macros | Typedefs | Functions
math.h File Reference

Common math typedefs, constants, functions. More...

#include <math.h>
#include <float.h>
#include <limits>
#include <KrisLibrary/utils.h>
#include "infnan.h"

Go to the source code of this file.

Namespaces

 Math
 Contains all definitions in the Math package.
 

Macros

#define MATH_DOUBLE   1
 

Typedefs

typedef double Math::Real
 

Functions

double Math::Abs (double x)
 
double Math::Sqr (double x)
 
double Math::Sqrt (double x)
 
double Math::Exp (double x)
 
double Math::Log (double x)
 
double Math::Pow (double x, double y)
 
double Math::Sin (double x)
 
double Math::Cos (double x)
 
double Math::Tan (double x)
 
double Math::Sinh (double x)
 
double Math::Cosh (double x)
 
double Math::Tanh (double x)
 
double Math::Asin (double x)
 
double Math::Acos (double x)
 
double Math::Atan (double x)
 
double Math::Atan2 (double y, double x)
 
double Math::Floor (double x)
 
double Math::Ceil (double x)
 
double Math::Mod (double x, double y)
 
float Math::Abs (float x)
 
float Math::Sqr (float x)
 
float Math::Sqrt (float x)
 
float Math::Exp (float x)
 
float Math::Log (float x)
 
float Math::Pow (float x, float y)
 
float Math::Sin (float x)
 
float Math::Cos (float x)
 
float Math::Tan (float x)
 
float Math::Sinh (float x)
 
float Math::Cosh (float x)
 
float Math::Tanh (float x)
 
float Math::Asin (float x)
 
float Math::Acos (float x)
 
float Math::Atan (float x)
 
float Math::Atan2 (float y, float x)
 
float Math::Floor (float x)
 
float Math::Ceil (float x)
 
float Math::Mod (float x, float y)
 
double Math::Inv (double x)
 1/x
 
double Math::Sign (double x)
 Returns {-1,0,1} if x is {<0,0,>0}.
 
double Math::Clamp (double x, double a, double b)
 Returns a if x < a, b if x > b, otherwise x.
 
double Math::Trunc (double x)
 
double Math::Frac (double x)
 
float Math::Inv (float x)
 
float Math::Sign (float x)
 
float Math::Clamp (float x, float a, float b)
 
float Math::Trunc (float x)
 
float Math::Frac (float x)
 
double Math::dot (double a, double b)
 Dot product of a scalar as a 1-d vector.
 
bool Math::FuzzyEquals (double a, double b, double eps=dEpsilon)
 Returns true if a and b are within +/- eps.
 
bool Math::FuzzyZero (double a, double eps=dEpsilon)
 Returns true if a is zero within +/- eps.
 
double Math::PseudoInv (double x, double eps=dZero)
 Returns 1/x if x is nonzero, otherwise 0.
 
float Math::dot (float a, float b)
 
bool Math::FuzzyEquals (float a, float b, float eps=fEpsilon)
 
bool Math::FuzzyZero (float a, float eps=fEpsilon)
 
float Math::PseudoInv (float x, float eps=fZero)
 
template<class T >
Real Math::Delta (T i, T j)
 Kronecker delta.
 
template<class T >
Real Math::Delta (T x)
 
double Math::DtoR (double f)
 Degree to radian conversion.
 
double Math::RtoD (double f)
 Radian to degree conversion.
 
float Math::DtoR (float f)
 
float Math::RtoD (float f)
 

Detailed Description

Common math typedefs, constants, functions.

Defines the typedef Real, and the capitalized std math functions overloaded to handle both floats and doubles.

Real is defined to be a double if MATH_DOUBLE is defined, otherwise a float.