- Main Page
- Modules
- Classes
- Files
- Related Pages

- File List
- File Members

# src/vectorMath/mathex.h

Go to the documentation of this file.

    00001 #ifndef mathex_h
    00002 #define mathex_h
    00003
    00004 #include <math.h>
    00005 #ifndef M_PI //we need the definition of M_PI
    00006 #include <ode/common.h>
    00007 #endif
    00008 #ifndef EPSILON
    00009 #define EPSILON 1.0e-8
    00010 #endif
    00011 #ifndef ZERO
    00012 #define ZERO EPSILON
    00013 #endif
    00014
    00015 template <class T> inline T limit(const T &x, const T &lower, const T &upper)
    00016 {
    00017     if (x < lower) return lower;
    00018     if (x > upper) return upper;
    00019     return x;
    00020 }
    00021
    00022 template <class T> inline T sqr(const T &x) { return x*x; }
    00023
    00025 template <class T> inline T RadToDeg(const T &rad) { return (rad * 180.0) / M_PI; }
    00026
    00028 template <class T> inline T DegToRad(const T &deg) { return (deg * M_PI) / 180.0; }
    00029
    00030 #endif