Go to the documentation of this file.00001
00007 #ifndef P_MATH_HH
00008 #define P_MATH_HH
00009
00010 #include <limits.h>
00011 #include <time.h>
00012 #include <stdio.h>
00013 #include <stdlib.h>
00014 #include <blort/Recognizer3D/PNamespace.hh>
00015 #include <blort/Recognizer3D/Except.hh>
00016
00017 #ifdef WIN32
00018 #include <winsock.h>
00019 #else
00020 #include <sys/time.h>
00021 #endif
00022
00023 namespace P
00024 {
00025
00026 const unsigned UNDEF_ID = UINT_MAX;
00027
00028 const unsigned START = 0;
00029 const unsigned END = 1;
00030 const unsigned MID = 2;
00031 const unsigned ONE_THIRD = 3;
00032 const unsigned TWO_THIRD = 4;
00033 const unsigned STOP = 15;
00034
00035 inline unsigned OtherEnd(unsigned end)
00036 {
00037 return end ^ 0x1;
00038 }
00039
00040
00041 const unsigned SAME = START;
00042 const unsigned OPP = END;
00043
00044 const unsigned LEFT = 0;
00045 const unsigned RIGHT = 1;
00046 const unsigned CAM3D = 2;
00047
00048
00049 const unsigned INNER = 0;
00050 const unsigned OUTER = 1;
00051
00052 inline unsigned OtherSide(unsigned side)
00053 {
00054 return side ^ 0x1;
00055 }
00056
00057 inline unsigned Other(unsigned i)
00058 {
00059 return i ^ 0x1;
00060 }
00061
00063 extern bool IsZero(double d);
00064
00066 extern bool IsEqual(double a, double b);
00067
00069 template <class Num>
00070 extern Num Sqr(Num x);
00071
00072 template <class Num>
00073 extern Num Max(Num a, Num b);
00074 template <class Num>
00075 extern Num Min(Num a, Num b);
00076
00077 template <class Num>
00078 extern int Sign(Num x);
00079
00080 template <class T>
00081 inline void Swap(T &a, T &b);
00082
00083 template <class Num>
00084 inline bool Between(Num x, Num l, Num u);
00085 template <class Num>
00086 inline bool BetweenEq(Num x, Num l, Num u);
00087
00089 extern double ScaleAngle_0_2pi(double a);
00091 extern double ScaleAngle_mpi_pi(double a);
00093 extern double ScaleAngle_0_pi(double a);
00095 extern double DiffAngle_mpi_pi(double b, double a);
00097 extern double DiffAngle_0_2pi(double b, double a);
00099 extern int ScaleIntAngle_0_8(int a);
00100
00101 extern int timeval_subtract(struct timeval *result, struct timeval *x,
00102 struct timeval *y);
00103 extern double timespec_diff(struct timespec *x, struct timespec *y);
00104
00105 }
00106
00107 #include <blort/Recognizer3D/Math.ic>
00108
00109 #endif
00110
blort
Author(s): Michael Zillich,
Thomas Mörwald,
Johann Prankl,
Andreas Richtsfeld,
Bence Magyar (ROS version)
autogenerated on Thu Jan 2 2014 11:38:25