KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces | Macros | Functions
utils.h File Reference
#include <math.h>

Go to the source code of this file.

Namespaces

 DTLib
 

Macros

#define CONST_MAX_FLOAT   (float)1.0e38
 
#define CONST_MIN_FLOAT   (float)-1.0e38
 
#define CONST_EPSILON   (float)0.00000000001
 
#define CONST_E   (float)2.7182818284590452354
 
#define CONST_LOG2E   (float)1.4426950408889634074
 
#define CONST_LOG10E   (float)0.43429448190325182765
 
#define CONST_LN2   (float)0.69314718055994530942
 
#define CONST_LN10   (float)2.30258509299404568402
 
#define CONST_PI   (float)3.14159265358979323846
 
#define CONST_2PI   (float)6.28318530717958647692
 
#define CONST_PI_2   (float)1.57079632679489661923
 
#define CONST_PI_4   (float)0.78539816339744830962
 
#define CONST_3PI_4   (float)2.35619449019234492885
 
#define CONST_ONE_PI   (float)0.31830988618379067154
 
#define CONST_TWO_PI   (float)0.63661977236758134308
 
#define CONST_TWO_SQRTPI   (float)1.12837916709551257390
 
#define CONST_180_PI   (float)57.2957795130823208768
 
#define CONST_SQRT2   (float)1.41421356237309504880
 
#define CONST_SQRT1_2   (float)0.70710678118654752440
 
#define CONST_SQRT3OVER2   (float)0.86602540378443864676
 
#define CONST_3PI_2   (float)4.71238898038468985769
 
#define CONST_PI_8   (float)0.39269908169872415480
 
#define CONST_3PI_8   (float)1.17809724509617246442
 
#define CONST_5PI_8   (float)1.96349540849362077403
 
#define CONST_7PI_8   (float)2.74889357189106908365
 
#define BYTE   unsigned char
 
#define SQR(x)   ((x)*(x))
 
#define IS_ODD(x)   ((x) % 2) /* only use these on ints */
 
#define IS_EVEN(x)   (!IS_ODD(x))
 
#define ODDIFY(x)   if (IS_EVEN(x)) x++
 
#define F2I(x)   ((x > 0.0f) ? (int)(x+0.5f) : (int)(x-0.5f))
 
#define APPXEQL(x, y, e)   (fabs((x)-(y)) <= e)
 
#define SGN(x)   (((x) > 0) ? 1 : (((x) == 0) ? 0 : -1))
 
#define SAME_SGN(x, y)   (((x) > 0) ? ((y) > 0) : (y <= 0))
 
#define MAX(a, b)   ((a) > (b) ? (a) : (b))
 
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
 
#define ABS(x)   ((x) < 0 ? -(x) : (x))
 
#define zap(x)   do { if (x) { delete(x); x = 0; } } while (0)
 
#define IS_A_FLOAT(x)   ((x >= CONST_MIN_FLOAT) && (x <= CONST_MAX_FLOAT))
 

Functions

double DTLib::AngleDiff (double a1, double a2)
 
float DTLib::AngleDiff (float a1, float a2)
 
double DTLib::AngleSum (double a1, double a2)
 
float DTLib::AngleSum (float a1, float a2)
 
float DTLib::BiGauss (float mu1, float mu2, float mu12, float sigma1, float sigma2, float sigma12, float x1, float x2)
 
float DTLib::FuzzySigmoid (float g, float a, float b, float c)
 
float DTLib::Max (float *pBuf, int Size)
 
int DTLib::Max (int *pBuf, int Size)
 
float DTLib::Min (float *pBuf, int Size)
 
int DTLib::iMin (float *pBuf, int Size)
 
double DTLib::logbase (const double base, const double argument)
 
int DTLib::NextPowerOfTwo (const int x)
 
void DTLib::FloatToInt (const float &Xfloat, int &Xint, const float &MinRange, const float &MaxRange, const int &Resolution)
 
void DTLib::IntToFloat (const int &Xint, float &Xfloat, const float &MinRange, const float &MaxRange, const int &Resolution)
 
bool DTLib::IsAccute (const float &Theta)
 
float DTLib::ParabolicInverseInterpolation (const float &x0, const float &y0, const float &x1, const float &y1, const float &x2, const float &y2)
 
void DTLib::ParabolicOrientationInterpolation (const float &Theta1, const float &Rho1, const float &Theta2, const float &Rho2, const float &Theta3, const float &Rho3, float &InterpolatedThetaResult)
 
void DTLib::ParabolicInterpolation (const float &x0, const float &y0, const float &x1, const float &y1, const float &x2, const float &y2, float &a, float &b, float &c)
 
void DTLib::FixThetaRange (float &Theta, const bool &bHalfPhase=true)
 
template<class T >
void DTLib::Swap (T &p1, T &p2)
 
template<class T >
DTLib::SSD (const T &x1, const T &y1, const T &x2, const T &y2)
 

Macro Definition Documentation

#define ABS (   x)    ((x) < 0 ? -(x) : (x))
#define APPXEQL (   x,
  y,
 
)    (fabs((x)-(y)) <= e)
#define BYTE   unsigned char
#define CONST_180_PI   (float)57.2957795130823208768
#define CONST_2PI   (float)6.28318530717958647692
#define CONST_3PI_2   (float)4.71238898038468985769
#define CONST_3PI_4   (float)2.35619449019234492885
#define CONST_3PI_8   (float)1.17809724509617246442
#define CONST_5PI_8   (float)1.96349540849362077403
#define CONST_7PI_8   (float)2.74889357189106908365
#define CONST_E   (float)2.7182818284590452354
#define CONST_EPSILON   (float)0.00000000001
#define CONST_LN10   (float)2.30258509299404568402
#define CONST_LN2   (float)0.69314718055994530942
#define CONST_LOG10E   (float)0.43429448190325182765
#define CONST_LOG2E   (float)1.4426950408889634074
#define CONST_MAX_FLOAT   (float)1.0e38
#define CONST_MIN_FLOAT   (float)-1.0e38
#define CONST_ONE_PI   (float)0.31830988618379067154
#define CONST_PI   (float)3.14159265358979323846
#define CONST_PI_2   (float)1.57079632679489661923
#define CONST_PI_4   (float)0.78539816339744830962
#define CONST_PI_8   (float)0.39269908169872415480
#define CONST_SQRT1_2   (float)0.70710678118654752440
#define CONST_SQRT2   (float)1.41421356237309504880
#define CONST_SQRT3OVER2   (float)0.86602540378443864676
#define CONST_TWO_PI   (float)0.63661977236758134308
#define CONST_TWO_SQRTPI   (float)1.12837916709551257390
#define F2I (   x)    ((x > 0.0f) ? (int)(x+0.5f) : (int)(x-0.5f))
#define IS_A_FLOAT (   x)    ((x >= CONST_MIN_FLOAT) && (x <= CONST_MAX_FLOAT))
#define IS_EVEN (   x)    (!IS_ODD(x))
#define IS_ODD (   x)    ((x) % 2) /* only use these on ints */
#define MAX (   a,
 
)    ((a) > (b) ? (a) : (b))
#define MIN (   a,
 
)    ((a) < (b) ? (a) : (b))
#define ODDIFY (   x)    if (IS_EVEN(x)) x++
#define SAME_SGN (   x,
 
)    (((x) > 0) ? ((y) > 0) : (y <= 0))
#define SGN (   x)    (((x) > 0) ? 1 : (((x) == 0) ? 0 : -1))
#define SQR (   x)    ((x)*(x))
#define zap (   x)    do { if (x) { delete(x); x = 0; } } while (0)