00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00027 #ifndef _TTYPES_H_
00028 #define _TTYPES_H_
00029
00030 #include <tgf.h>
00031
00032 const tdble PI = 3.14159265358979323846;
00033 const tdble G = 9.80665;
00035
00036 #define RADS2RPM(x) ((x)*9.549296585)
00037 #define RPM2RADS(x) ((x)*.104719755)
00038 #define RAD2DEG(x) ((x)*(180.0/PI))
00039 #define DEG2RAD(x) ((x)*(PI/180.0))
00040 #define FEET2M(x) ((x)*0.304801)
00041 #define SIGN(x) ((x) < 0 ? -1.0 : 1.0)
00044 #define NORM0_2PI(x) \
00045 do { \
00046 while ((x) > 2*PI) { (x) -= 2*PI; } \
00047 while ((x) < 0) { (x) += 2*PI; } \
00048 } while (0)
00049
00051 #define NORM_PI_PI(x) \
00052 do { \
00053 while ((x) > PI) { (x) -= 2*PI; } \
00054 while ((x) < -PI) { (x) += 2*PI; } \
00055 } while (0)
00056
00057
00058 #ifndef DIST
00059
00060 #define DIST(x1, y1, x2, y2) sqrt(((x1) - (x2)) * ((x1) - (x2)) + ((y1) - (y2)) * ((y1) - (y2)))
00061 #endif
00062
00063 #ifndef MIN
00064
00065 #define MIN(x,y) ((x) < (y) ? (x) : (y))
00066 #endif
00067
00068
00069 typedef struct {
00070 float x;
00071 float y;
00072 float z;
00073 } t3Df;
00074
00078 typedef struct {
00079 tdble x;
00080 tdble y;
00081 tdble z;
00082 } t3Dd;
00083
00084 typedef struct {
00085 int x;
00086 int y;
00087 int z;
00088 } t3Di;
00089
00093 typedef struct {
00094 tdble x;
00095 tdble y;
00096 tdble z;
00097 tdble ax;
00098 tdble ay;
00099 tdble az;
00100 } tPosd;
00101
00105 typedef struct
00106 {
00107 tPosd pos;
00108 tPosd vel;
00109 tPosd acc;
00110 } tDynPt;
00111
00113 typedef struct
00114 {
00115 t3Dd F;
00116 t3Dd M;
00117 } tForces;
00118
00119
00120
00121 #define CAR_IDENT_SHIFT 0
00122 #define TRK_IDENT_SHIFT 8
00123 #define RCM_IDENT_SHIFT 16
00124 #define RPL_IDENT_SHIFT 24
00125
00126
00127 #define CAR_RACING 1
00128 #define CAR_PITTING 2
00129 #define CAR_WRECKED 3
00130
00131
00132 #define FRNT_RGT 0
00133 #define FRNT_LFT 1
00134 #define REAR_RGT 2
00135 #define REAR_LFT 3
00136 #define FRNT 0
00137 #define REAR 1
00138 #define RIGHT 0
00139 #define LEFT 1
00141 #endif
00142
00143
00144