Game Development Reference
In-Depth Information
case 1: // flaps up
cl = clfu[i] - (a[i] - angle) * (clfu[i] - clfu[i+1]) /
(a[i] - a[i+1]);
break;
}
break;
}
}
return cl;
}
//------------------------------------------------------------------------//
// Given the attack angle and the status of the flaps, this function
// returns the appropriate drag coefficient for a cambered airfoil with
// a plain trailing-edge flap (+/- 15 degree deflection).
//------------------------------------------------------------------------//
float DragCoefficient(float angle, int flaps)
{
float cdf0[9] = {0.01f, 0.0074f, 0.004f, 0.009f, 0.013f, 0.023f, 0.05f,
0.12f, 0.21f};
float cdfd[9] = {0.0065f, 0.0043f, 0.0055f, 0.0153f, 0.0221f, 0.0391f, 0.1f,
0.195f, 0.3f};
float cdfu[9] = {0.005f, 0.0043f, 0.0055f, 0.02601f, 0.03757f, 0.06647f,
0.13f, 0.18f, 0.25f};
float a[9] = {−8.0f, −4.0f, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f,
24.0f};
float cd;
int i;
cd = 0.5;
for (i=0; i<8; i++)
{
if( (a[i] <= angle) && (a[i+1] > angle) )
{
switch(flaps)
{
case 0:// flaps not deflected
cd = cdf0[i] - (a[i] - angle) * (cdf0[i] - cdf0[i+1]) /
(a[i] - a[i+1]);
break;
case −1: // flaps down
cd = cdfd[i] - (a[i] - angle) * (cdfd[i] - cdfd[i+1]) /
(a[i] - a[i+1]);
break;
case 1: // flaps up
cd = cdfu[i] - (a[i] - angle) * (cdfu[i] - cdfu[i+1]) /
(a[i] - a[i+1]);
break;
}
break;
}
Search Nedrilad ::




Custom Search