Math.hh
Go to the documentation of this file.
00001 
00006 #ifndef P_MATH_HH
00007 #define P_MATH_HH
00008 
00009 #include <limits.h>
00010 #include <time.h>
00011 #include <stdio.h>
00012 #include <stdlib.h>
00013 #include <blort/Recognizer3D/PNamespace.hh>
00014 #include <blort/Recognizer3D/Except.hh>
00015 
00016 #ifdef WIN32
00017 #include <winsock.h>
00018 #else
00019 #include <sys/time.h>
00020 #endif
00021 
00022 namespace P
00023 {
00024 
00025 const unsigned UNDEF_ID = UINT_MAX;
00026 
00027 const unsigned START     = 0;
00028 const unsigned END       = 1;
00029 const unsigned MID       = 2;
00030 const unsigned ONE_THIRD = 3;
00031 const unsigned TWO_THIRD = 4;
00032 const unsigned STOP      = 15;
00033 
00034 inline unsigned OtherEnd(unsigned end)
00035 {
00036   return end ^ 0x1;
00037 }
00038 
00039 // same and opposite sense
00040 const unsigned SAME = START;
00041 const unsigned OPP  = END;
00042 
00043 const unsigned LEFT  = 0;
00044 const unsigned RIGHT = 1;
00045 const unsigned CAM3D = 2;
00046 
00047 // inner and outer ends of junctions
00048 const unsigned INNER = 0;
00049 const unsigned OUTER = 1;
00050 
00051 inline unsigned OtherSide(unsigned side)
00052 {
00053   return side ^ 0x1;
00054 }
00055 
00056 inline unsigned Other(unsigned i)
00057 {
00058   return i ^ 0x1;
00059 }
00060 
00062 extern bool IsZero(double d);
00063 
00065 extern bool IsEqual(double a, double b);
00066 
00068 template <class Num>
00069 extern Num Sqr(Num x);
00070 
00071 template <class Num>
00072 extern Num Max(Num a, Num b);
00073 template <class Num>
00074 extern Num Min(Num a, Num b);
00075 
00076 template <class Num>
00077 extern int Sign(Num x);
00078 
00079 template <class T>
00080 inline void Swap(T &a, T &b);
00081 
00082 template <class Num>
00083 inline bool Between(Num x, Num l, Num u);
00084 template <class Num>
00085 inline bool BetweenEq(Num x, Num l, Num u);
00086 
00088 extern double ScaleAngle_0_2pi(double a);
00090 extern double ScaleAngle_mpi_pi(double a);
00092 extern double ScaleAngle_0_pi(double a);
00094 extern double DiffAngle_mpi_pi(double b, double a);
00096 extern double DiffAngle_0_2pi(double b, double a);
00098 extern int ScaleIntAngle_0_8(int a);
00099 
00100 extern int timeval_subtract(struct timeval *result, struct timeval *x,
00101   struct timeval *y);
00102 extern double timespec_diff(struct timespec *x, struct timespec *y);
00103 
00104 }
00105 
00106 #include <blort/Recognizer3D/Math.ic>
00107 
00108 #endif
00109 


blort
Author(s): Thomas Mörwald , Michael Zillich , Andreas Richtsfeld , Johann Prankl , Markus Vincze , Bence Magyar
autogenerated on Wed Aug 26 2015 15:24:12