Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
define_math.h
00001 /* 
00002    Declarations utilisateur 
00003 */
00004 
00005 #ifndef _DEFINELOCAL_H
00006 #define _DEFINELOCAL_H
00007 
00008 extern const double pi,pi2,pisur2,pisur128;
00009 
00010 #ifndef MAX
00011 #define MAX(a,b) ((a) > (b) ? (a) : (b))
00012 #endif
00013 
00014 #ifndef MIN
00015 #define MIN(a,b) ((a) < (b) ? (a) : (b))
00016 #endif
00017 
00018 #ifndef ABS
00019 #define ABS(a) ((a) < 0 ? -(a) : (a))
00020 #endif
00021 
00022 #ifndef FABS_MAX
00023 #define FABS_MAX(a,b) ((fabs(a)>fabs(b)) ? fabs(a) : fabs(b))
00024 #endif
00025 
00026 #ifndef MIN3
00027 #define MIN3(a,b,c) \
00028    ((a) < (b) ? (((a) < (c) ) ? (a) : (c) ) : (((b) < (c) ) ? (b) : (c) ) )
00029 #endif
00030 
00031 #ifndef MAX3
00032 #define MAX3(a,b,c) \
00033    ((a) > (b) ? (((a) > (c) ) ? (a) : (c) ) : (((b) > (c) ) ? (b) : (c) ) )
00034 #endif
00035 
00036 #ifndef IMAX
00037 #define IMAX(a,b) ( (a) > (b) ? 0 : 1 )
00038 #endif
00039 
00040 #ifndef IMIN
00041 #define IMIN(a,b) ( (a) < (b) ? 0 : 1 )
00042 #endif
00043 
00044 #ifndef IMAX3
00045 #define IMAX3(a,b,c) \
00046    ((a) > (b) ? (((a) > (c) ) ? 0 : 2 ) : (((b) > (c) ) ? 1 : 2 ) )
00047 #endif
00048 
00049 #ifndef IMIN3
00050 #define IMIN3(a,b,c) \
00051    ((a) < (b) ? (((a) < (c) ) ? 0 : 2 ) : (((b) < (c) ) ? 1 : 2 ) )
00052 #endif
00053 
00054 #ifndef MAX4
00055 #define MAX4(a,b,c,d) \
00056   ( ((a) > (b)) ? ( ((a) > (c)) ? ( ((a) > (d)) ? (a) : (d) ) : \
00057                                   ( ((c) > (d)) ? (c) : (d) ) )  : \
00058                   ( ((b) > (c)) ? ( ((b) > (d)) ? (b) : (d) ) : \
00059                                   ( ((c) > (d)) ? (c) : (d) ) ) )
00060 #endif
00061  
00062 #ifndef MIN4
00063 #define MIN4(a,b,c,d) \
00064   ( ((a) < (b)) ? ( ((a) < (c)) ? ( ((a) < (d)) ? (a) : (d) ) : \
00065                                   ( ((c) < (d)) ? (c) : (d) ) )  : \
00066                   ( ((b) < (c)) ? ( ((b) < (d)) ? (b) : (d) ) : \
00067                                   ( ((c) < (d)) ? (c) : (d) ) ) )
00068 #endif
00069 
00070 #ifndef SQR
00071 #define SQR(x) ((x)*(x))
00072 #endif
00073 
00074 #ifndef SIGN
00075 #define SIGN(x) ((x) > 0 ? 1 : ((x) == 0) ? 0 : -1)
00076 #endif
00077 
00078 #ifndef PAIRE
00079 #define PAIRE(a) ( ((a) % 2) ? (0) : (1) )
00080 #endif
00081 
00082 #ifndef TRESPETIT
00083 #define TRESPETIT(x) ( (x) > -1e-35 && (x) < 1e-35 )
00084 #endif
00085 
00086 #ifndef EPSILON
00087 #define EPSILON 1e-6
00088 #endif
00089 
00090 /* These don't exist in VxWorks's math.h */
00091 
00092 #ifndef M_PI
00093 #define M_PI 3.14159265358979323846
00094 #endif
00095 
00096 #ifndef M_PI_2
00097 #define M_PI_2 1.57079632679489661923
00098 #endif
00099 
00100 #ifndef M_PI_4
00101 #define M_PI_4 0.78539816339744830962
00102 #endif
00103 
00104 #ifndef HUGE 
00105 #define HUGE HUGE_VAL
00106 #endif
00107 
00108 /*------------------------------------------------------------------------------*
00109  * Macros-Fonctions pour les transformations angulaires  (Degres <--> Radians)  *
00110  *------------------------------------------------------------------------------*/
00111 
00112 #ifndef CONVRDG
00113 #define CONVRDG 180./M_PI
00114 #endif
00115 
00116 #ifndef CONVDGR
00117 #define CONVDGR M_PI/180.
00118 #endif
00119 
00120 #ifndef DEG_TO_RAD
00121 #define DEG_TO_RAD(x) ((x)*CONVDGR)
00122 #endif
00123 
00124 #ifndef RAD_TO_DEG
00125 #define RAD_TO_DEG(x) ((x)*CONVRDG)
00126 #endif
00127 
00128 /*------------------------------------------------------------------------------*
00129  * Macros-Fonctions pour les transformations metriques (Metres <-> Centimetres) *
00130  *------------------------------------------------------------------------------*/
00131 
00132 #ifndef M_TO_CM
00133 #define M_TO_CM(a) ((a)*100.)
00134 #endif
00135 
00136 #ifndef CM_TO_M
00137 #define CM_TO_M(a) ((a)/100.)
00138 #endif
00139 
00140 #ifndef M_TO_MM
00141 #define M_TO_MM(a) ((a) * 1000.0)
00142 #endif
00143  
00144 #ifndef MM_TO_M
00145 #define MM_TO_M(a) ((a) * 0.001)
00146 #endif
00147 #endif /* _DEFINELOCAL_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:25 for Jafar by doxygen 1.7.6.1
LAAS-CNRS