30 Airfoil::Airfoil(Ogre::String
const& fname)
32 for (
int i = 0; i < 3601; i++)
43 ResourceGroupManager& rgm = ResourceGroupManager::getSingleton();
48 group = rgm.findGroupContainingResource(fname);
55 LOG(String(
"Airfoil error: could not load airfoil ")+fname);
59 DataStreamPtr ds = rgm.openResource(fname, group);
62 size_t ll = ds->readLine(line, 1023);
66 if (!strncmp(
"alpha", line, 5))
75 sscanf(line,
"%i.%i %f %f %f", &a, &b, &l, &d, &m);
80 int ia = (a * 10 + b) + 1800;
81 if (ia == 3600) { process =
false; };
85 if (lastia != -1 && ia - lastia > 1)
89 for (i = 0; i < ia - lastia - 1; i++)
91 cl[lastia + 1 + i] = cl[lastia] + (float)(i + 1) * (cl[ia] - cl[lastia]) / (
float)(ia - lastia);
92 cd[lastia + 1 + i] = cd[lastia] + (float)(i + 1) * (cd[ia] - cd[lastia]) / (
float)(ia - lastia);
93 cm[lastia + 1 + i] = cm[lastia] + (float)(i + 1) * (cm[ia] - cm[lastia]) / (
float)(ia - lastia);
105 void Airfoil::getparams(
float a,
float cratio,
float cdef,
float* ocl,
float* ocd,
float* ocm)
107 int ta = (int)(a / 360.0);
109 float va = a - (float)(ta * 360);
114 int ia = (int)((va + 180.0f) * 10.0f);
116 float dva = va + 1.15 * (1.0 - cratio) * cdef;
121 int dia = (int)((dva + 180.0f) * 10.0f);
125 *ocl = cl[ia] - 0.66 *
sign * (1.0 - cratio) * sqrt(fabs(cdef));
126 *ocd = cd[dia] + 0.00015 * (1.0 - cratio) * cdef * cdef;
127 *ocm = cm[ia] + 0.20 *
sign * (1.0 - cratio) * sqrt(fabs(cdef));