SIBCMath.h

Go to the documentation of this file.
00001 //***************************************************************************************
00002 // File supervisor: Crosswalk team
00012 //***************************************************************************************
00013 
00014 //***************************************************************************************
00015 // Defines
00016 //***************************************************************************************
00017 #ifndef __CSIBC_MATH_H__
00018 #define __CSIBC_MATH_H__
00019 
00020 
00021 #ifndef XSICOREEXPORT
00022 # if ((defined _WIN32) || (defined WIN32)) && !(defined _WIN32_WCE) && !(defined _XBOX)
00023 #  ifdef XSICORE_IMPL
00024 #   define XSICOREEXPORT __declspec(dllexport)
00025 #  elif defined(XSICORE_STATIC)
00026 #   define XSICOREEXPORT
00027 #  else
00028 #   define XSICOREEXPORT __declspec(dllimport)
00029 #  endif
00030 # else
00031 #  define XSICOREEXPORT
00032 # endif
00033 #endif
00034 
00035 //***************************************************************************************
00036 // Includes
00037 //***************************************************************************************
00038 #include <math.h>
00039 #include <float.h>
00040 
00041 /****************************************/
00042 /*         GLOBAL CONSTANTS             */
00043 /****************************************/
00044 
00049 #define SI_DODECA_EPS   1.0e-12         
00050 #define SI_FLOAT_MIN    FLT_MIN         
00051 #define SI_FLOAT_MAX    FLT_MAX         
00052 #define SI_TWO_PI       ( 2 * M_PI )    
00053 #define SI_QUADRA_EPS   0.0001          
00054 #define SI_PROJ_EPS1    0.0002          
00055 #define SI_PROJ_EPS2    0.001           
00056 #define SI_EPSILON      0.0001          
00057 #define SI_PENTA_EPS    1.0e-05         
00058 #define SI_HEXA_EPS     1.0e-6          
00060 // The follow are not used, and should be removed in future versions.
00061 #define SI_LENGTH_EPS   0.01
00062 #define SI_VOLUME_EPS   5.0e-3
00063 #define SI_PREC         1e-6
00064 #define SI_IK_EPS2      0.0008
00065 #define SI_IK_EPS1      0.00001
00066 #define SI_PROT_EPS     0.05
00067 
00068 /****************************************/
00069 /*         GLOBAL CONSTANTS             */
00070 /****************************************/
00071 /* Some useful constants - These Match SGI's constants*/
00072 /*  As defined in <math.h>  - these aren't defined in */
00073 /*  NT's <math.h>                                     */
00074 /******************************************************/
00075 
00076 #ifndef M_E
00077 
00078 #define M_E         2.7182818284590452354   
00079 #define M_LOG2E     1.4426950408889634074   
00080 #define M_LOG10E    0.43429448190325182765  
00081 #define M_LN2       0.69314718055994530942  
00082 #define M_PI_4      0.78539816339744830962  
00083 #define M_1_PI      0.31830988618379067154  
00084 #define M_2_PI      0.63661977236758134308  
00085 #define M_SQRT1_2   0.70710678118654752440  
00087 #endif
00088 
00089 #define M_LN10      2.30258509299404568402  
00091 #ifndef M_PI
00092 #define M_PI        3.14159265358979323846  
00093 #endif
00094 
00095 #define M_PI_2      1.57079632679489661923  
00096 #define M_2_SQRTPI  1.12837916709551257390  
00097 #define M_SQRT2     1.41421356237309504880  
00098 #define MAXINT      INT_MAX                 
00100 /****************************************/
00101 /*          LOCAL CONSTANTS             */
00102 /****************************************/
00103 
00104 // These are used internally by InvertParamCubic, and thus do not need documentation.
00105 #define _2PI    (2.0 * M_PI)
00106 #define _1_2PI  (0.5 * M_1_PI)
00107 #define INVERTPARAMCUBIC_TOL        1.0e-09
00108 #define INVERTPARAMCUBIC_SMALLERTOL 1.0e-20
00109 #define INVERTPARAMCUBIC_MAXIT      100
00110 
00111 
00112 /****************************************/
00113 /*      LOCAL FUNCTION PROTOTYPES       */
00114 /****************************************/
00115 
00121 XSICOREEXPORT float angleDistance ( double angle1, double angle2 ); //
00122 
00128 XSICOREEXPORT float arcSinCos ( double sinus, double cosinus );
00129 
00138 XSICOREEXPORT float InvertParamCubic ( float Param, float x0, float x1, float x2, float x3 );
00139 
00145 #define _SI_LIMIT( x, a, b ) if (x < a) x = a; if (x > b) x = b;
00146 
00149 #endif //