00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef WORLDSIMCONFIG_H
00021 #define WORLDSIMCONFIG_H
00022
00023
00024 #ifdef WIN32
00025 #ifndef NOMINMAX
00026
00027 #define NOMINMAX
00028 #endif
00029 #ifdef FARSA_WSIM_BUILDING_DLL
00030 #define FARSA_WSIM_API __declspec(dllexport)
00031 #define FARSA_WSIM_TEMPLATE __declspec(dllexport)
00032 #else
00033 #define FARSA_WSIM_API __declspec(dllimport)
00034 #define FARSA_WSIM_TEMPLATE
00035 #endif
00036 #define FARSA_WSIM_INTERNAL
00037 #else
00038 #define FARSA_WSIM_API
00039 #define FARSA_WSIM_TEMPLATE
00040 #define FARSA_WSIM_INTERNAL __attribute__ ((visibility ("hidden")))
00041 #endif
00042
00043 extern bool FARSA_WSIM_API initWorldSimLib();
00044 static const bool worldSimInitializer = initWorldSimLib();
00045
00046
00047
00048
00049
00050
00051 #define FARSA_WSIM_VERSION 00600
00052
00053 #include <QDebug>
00054 #include <QtGlobal>
00055 #include <QMetaType>
00056
00058 #define UNUSED_PARAM( a ) ( (void) a );
00059
00060 namespace farsa {
00061
00065 typedef float real;
00066
00067 #define PI_GRECO 3.14159265358979323846f
00068
00077 inline real toRad( real x ) {
00078 return (x)*PI_GRECO/180.0f;
00079 };
00080
00084 inline real toDegree( real x ) {
00085 return (x)*180.0f/PI_GRECO;
00086 };
00087
00091 template<class T, class U>
00092 const T min( const T& t1, const U& t2 ) {
00093 if ( t1 < t2 ) {
00094 return t1;
00095 } else {
00096 return (T)t2;
00097 }
00098 }
00099
00103 template<class T, class U>
00104 const T max( const T& t1, const U& t2 ) {
00105 if ( t1 > t2 ) {
00106 return t1;
00107 } else {
00108 return (T)t2;
00109 }
00110 }
00111
00115 inline real ramp( real minv, real maxv, real value ) {
00116 if ( value > maxv ) return maxv;
00117 if ( value < minv ) return minv;
00118 return value;
00119 }
00120
00130 inline float linearMap( float x, float min = -10, float max = 10,
00131 float outMin = -1, float outMax = 1 ) {
00132 float m = ( outMax-outMin )/( max-min );
00133 float q = outMin - m*min;
00134 float ret = m*x+q;
00135 if (ret < outMin) return outMin;
00136 if (ret > outMax) return outMax;
00137 return ret;
00138 }
00139
00149 inline float invLinearMap( float x, float min = -10, float max = 10,
00150 float outMin = -1, float outMax = 1 ) {
00151 double m = - ( outMax-outMin )/( max-min );
00152 double q = outMax - m*min;
00153 double ret = m*x+q;
00154 if (ret < outMin) return outMin;
00155 if (ret > outMax) return outMax;
00156 return ret;
00157 }
00158
00159 }
00160
00161 #include "simpletimer.h"
00162
00163 #endif