#include <euler.h>
Definition at line 111 of file euler.h.
Public Member Functions | |
| double | dt () |
| EulerSpiralLookupTable () | |
| double | gamma (double start_angle, double end_angle) |
| double | k0 (double start_angle, double end_angle) |
| double | k1 (double start_angle, double end_angle) |
| double | L (double start_angle, double end_angle) |
| double | theta (int N) |
| ~EulerSpiralLookupTable () | |
Static Public Member Functions | |
| static EulerSpiralLookupTable * | get_globalEulerSpiralLookupTable () |
Private Attributes | |
| double | _dt |
| double * | _theta |
| double ** | ES_gamma |
| double ** | ES_k0 |
| double ** | ES_k1 |
| double ** | ES_L |
| int | NN |
| EulerSpiralLookupTable::EulerSpiralLookupTable | ( | ) |
Definition at line 29 of file euler.cpp.
Referenced by get_globalEulerSpiralLookupTable().
00030 { 00031 int i,j; 00032 00033 //read in the tables from data files if available 00034 /* 00035 vcl_ifstream fp_k0_in("ES_k0.dat", vcl_ios::in | vcl_ios::binary); 00036 vcl_ifstream fp_gamma_in("ES_gamma.dat", vcl_ios::in | vcl_ios::binary); 00037 vcl_ifstream fp_L_in("ES_L.dat", vcl_ios::in | vcl_ios::binary); 00038 00039 //This number is the first entry in the file 00040 fp_k0_in.read ((char*)&NN, sizeof (NN)); 00041 fp_gamma_in.read ((char*)&NN, sizeof (NN)); 00042 fp_L_in.read ((char*)&NN, sizeof (NN)); 00043 00044 //COUT << "Number of theta samples " << NN <<endl; 00045 00046 //initialize the tables to this size 00047 ES_k0 = new double*[NN]; 00048 for (i=0; i<NN; i++) 00049 ES_k0[i] = new double [NN]; 00050 00051 ES_k1 = new double*[NN]; 00052 for (i=0; i<NN; i++) 00053 ES_k1[i] = new double [NN]; 00054 00055 ES_gamma = new double*[NN]; 00056 for (i=0; i<NN; i++) 00057 ES_gamma[i] = new double [NN]; 00058 00059 ES_L = new double*[NN]; 00060 for (i=0; i<NN; i++) 00061 ES_L[i] = new double [NN]; 00062 00063 //compute the dtt 00064 _dt = 2*M_PI/NN; 00065 00066 //create and fill in the theta array 00067 _theta = new double [NN]; 00068 double t1 = -M_PI; 00069 for (i=0; i<NN; i++, t1+=_dt) 00070 _theta[i] = t1; 00071 00072 //now read the files to fill in the lookup tables 00073 for (i=0; i<NN; i++){ 00074 for (j=0; j<NN; j++){ 00075 00076 double k0, k1, gamma, L; 00077 00078 fp_k0_in.read ((char*)&k0, sizeof (k0)); 00079 fp_gamma_in.read ((char*)&gamma, sizeof (gamma)); 00080 fp_L_in.read ((char*)&L, sizeof (L)); 00081 k1 = k0 + gamma*L; 00082 00083 //store these in the array 00084 ES_k0[i][j] = k0; 00085 ES_k1[i][j] = k1; 00086 ES_gamma[i][j] = gamma; 00087 ES_L[i][j] = L; 00088 } 00089 } 00090 00091 fp_k0_in.close(); 00092 fp_gamma_in.close(); 00093 fp_L_in.close(); 00094 */ 00095 }
| EulerSpiralLookupTable::~EulerSpiralLookupTable | ( | ) |
Definition at line 97 of file euler.cpp.
00098 { 00099 int i; 00100 /* 00101 //delete the arrays 00102 if (ES_k0) { 00103 for (i=0; i<=NN; i++) 00104 delete []ES_k0[i]; 00105 delete []ES_k0; 00106 } 00107 ES_k0 = NULL; 00108 if (ES_k1) { 00109 for (i=0; i<=NN; i++) 00110 delete []ES_k1[i]; 00111 delete []ES_k1; 00112 } 00113 ES_k1 = NULL; 00114 if (ES_gamma) { 00115 for (i=0; i<=NN; i++) 00116 delete []ES_gamma[i]; 00117 delete []ES_gamma; 00118 } 00119 ES_gamma = NULL; 00120 if (ES_L) { 00121 for (i=0; i<=NN; i++) 00122 delete []ES_L[i]; 00123 delete []ES_L; 00124 } 00125 ES_L = NULL; 00126 00127 delete []_theta; 00128 */ 00129 }
| double EulerSpiralLookupTable::dt | ( | ) |
| double EulerSpiralLookupTable::gamma | ( | double | start_angle, | |
| double | end_angle | |||
| ) |
Definition at line 212 of file euler.cpp.
References _dt, _theta, ES_gamma, and M_PI.
00213 { 00214 //output bilinear interpolated data from the tables 00215 00216 //assume it is already 0-2Pi 00217 double sangle, eangle; 00218 00219 if (start_angle>M_PI) sangle = start_angle-2*M_PI; 00220 else sangle = start_angle; 00221 00222 if (end_angle>M_PI) eangle = end_angle-2*M_PI; 00223 else eangle = end_angle; 00224 00225 //output bilinear interpolated data from the tables 00226 int ilow, ihigh, jlow, jhigh; 00227 00228 ilow = (int)floor((sangle+M_PI)/_dt); 00229 ihigh = (int)ceil((sangle+M_PI)/_dt); 00230 00231 jlow = (int)floor((eangle+M_PI)/_dt); 00232 jhigh = (int)ceil((eangle+M_PI)/_dt); 00233 00234 double slow = _theta[ilow]; 00235 double shigh = _theta[ihigh]; 00236 double elow = _theta[jlow]; 00237 double ehigh = _theta[jhigh]; 00238 00239 double a = (sangle - slow)/_dt; 00240 double b = (eangle - elow)/_dt; 00241 00242 double gamma = (1-a)*(1-b)*ES_gamma[ilow][jlow] + a*(1-b)*ES_gamma[ihigh][jlow] + 00243 (1-a)*b*ES_gamma[ilow][jhigh] + a*b*ES_gamma[ihigh][jhigh]; 00244 00245 return gamma; 00246 }
| EulerSpiralLookupTable * EulerSpiralLookupTable::get_globalEulerSpiralLookupTable | ( | ) | [static] |
Definition at line 21 of file euler.cpp.
References EulerSpiralLookupTable().
00022 { 00023 if (! globalEulerSpiralLookupTable) 00024 globalEulerSpiralLookupTable = new EulerSpiralLookupTable(); 00025 00026 return globalEulerSpiralLookupTable; 00027 }
| double EulerSpiralLookupTable::k0 | ( | double | start_angle, | |
| double | end_angle | |||
| ) |
Definition at line 142 of file euler.cpp.
References _dt, _theta, ES_k0, and M_PI.
00143 { 00144 //assume it is already 0-2Pi 00145 double sangle, eangle; 00146 00147 if (start_angle>M_PI) sangle = start_angle-2*M_PI; 00148 else sangle = start_angle; 00149 00150 if (end_angle>M_PI) eangle = end_angle-2*M_PI; 00151 else eangle = end_angle; 00152 00153 //output bilinear interpolated data from the tables 00154 int ilow, ihigh, jlow, jhigh; 00155 00156 ilow = (int)floor((sangle+M_PI)/_dt); 00157 ihigh = (int)ceil((sangle+M_PI)/_dt); 00158 00159 jlow = (int)floor((eangle+M_PI)/_dt); 00160 jhigh = (int)ceil((eangle+M_PI)/_dt); 00161 00162 double slow = _theta[ilow]; 00163 double shigh = _theta[ihigh]; 00164 double elow = _theta[jlow]; 00165 double ehigh = _theta[jhigh]; 00166 00167 double a = (sangle - slow)/_dt; 00168 double b = (eangle - elow)/_dt; 00169 00170 double k0 = (1-a)*(1-b)*ES_k0[ilow][jlow] + a*(1-b)*ES_k0[ihigh][jlow] + 00171 (1-a)*b*ES_k0[ilow][jhigh] + a*b*ES_k0[ihigh][jhigh]; 00172 00173 return k0; 00174 }
| double EulerSpiralLookupTable::k1 | ( | double | start_angle, | |
| double | end_angle | |||
| ) |
Definition at line 176 of file euler.cpp.
References _dt, _theta, ES_k1, and M_PI.
00177 { 00178 //output bilinear interpolated data from the tables 00179 00180 //assume it is already 0-2Pi 00181 double sangle, eangle; 00182 00183 if (start_angle>M_PI) sangle = start_angle-2*M_PI; 00184 else sangle = start_angle; 00185 00186 if (end_angle>M_PI) eangle = end_angle-2*M_PI; 00187 else eangle = end_angle; 00188 00189 //output bilinear interpolated data from the tables 00190 int ilow, ihigh, jlow, jhigh; 00191 00192 ilow = (int)floor((sangle+M_PI)/_dt); 00193 ihigh = (int)ceil((sangle+M_PI)/_dt); 00194 00195 jlow = (int)floor((eangle+M_PI)/_dt); 00196 jhigh = (int)ceil((eangle+M_PI)/_dt); 00197 00198 double slow = _theta[ilow]; 00199 double shigh = _theta[ihigh]; 00200 double elow = _theta[jlow]; 00201 double ehigh = _theta[jhigh]; 00202 00203 double a = (sangle - slow)/_dt; 00204 double b = (eangle - elow)/_dt; 00205 00206 double k1 = (1-a)*(1-b)*ES_k1[ilow][jlow] + a*(1-b)*ES_k1[ihigh][jlow] + 00207 (1-a)*b*ES_k1[ilow][jhigh] + a*b*ES_k1[ihigh][jhigh]; 00208 00209 return k1; 00210 }
| double EulerSpiralLookupTable::L | ( | double | start_angle, | |
| double | end_angle | |||
| ) |
Definition at line 248 of file euler.cpp.
References _dt, _theta, ES_L, and M_PI.
00249 { 00250 //output bilinear interpolated data from the tables 00251 00252 //assume it is already 0-2Pi 00253 double sangle, eangle; 00254 00255 if (start_angle>M_PI) sangle = start_angle-2*M_PI; 00256 else sangle = start_angle; 00257 00258 if (end_angle>M_PI) eangle = end_angle-2*M_PI; 00259 else eangle = end_angle; 00260 00261 //output bilinear interpolated data from the tables 00262 int ilow, ihigh, jlow, jhigh; 00263 00264 ilow = (int)floor((sangle+M_PI)/_dt); 00265 ihigh = (int)ceil((sangle+M_PI)/_dt); 00266 00267 jlow = (int)floor((eangle+M_PI)/_dt); 00268 jhigh = (int)ceil((eangle+M_PI)/_dt); 00269 00270 double slow = _theta[ilow]; 00271 double shigh = _theta[ihigh]; 00272 double elow = _theta[jlow]; 00273 double ehigh = _theta[jhigh]; 00274 00275 double a = (sangle - slow)/_dt; 00276 double b = (eangle - elow)/_dt; 00277 00278 double L = (1-a)*(1-b)*ES_L[ilow][jlow] + a*(1-b)*ES_L[ihigh][jlow] + 00279 (1-a)*b*ES_L[ilow][jhigh] + a*b*ES_L[ihigh][jhigh]; 00280 00281 return L; 00282 }
| double EulerSpiralLookupTable::theta | ( | int | N | ) |
double EulerSpiralLookupTable::_dt [private] |
double* EulerSpiralLookupTable::_theta [private] |
double** EulerSpiralLookupTable::ES_gamma [private] |
double** EulerSpiralLookupTable::ES_k0 [private] |
double** EulerSpiralLookupTable::ES_k1 [private] |
double** EulerSpiralLookupTable::ES_L [private] |
int EulerSpiralLookupTable::NN [private] |
1.5.6