Game Development Reference
In-Depth Information
}
return cd;
}
Each of these functions takes the angle of attack as a parameter along with a flag used
to indicate the state of the flaps—that is, whether the flaps are in neutral position, de‐
flected downward, or deflected upward. Notice that the lift and drag coefficient data is
given for a set of discrete attack angles, thus we use linear interpolation to determine
the coefficients for attack angles that fall between the discrete angles.
The functions for determining the tail rudder lift and drag coefficients are similar to
those shown here for the wings, with the only differences being the coefficients them‐
selves and the fact that the tail rudder does not include flaps. Here are the functions:
//------------------------------------------------------------------------//
// Given the attack angle, this function returns the proper lift coefficient
// for a symmetric (no camber) airfoil without flaps.
//------------------------------------------------------------------------//
float RudderLiftCoefficient(float angle)
{
float clf0[7] = {0.16f, 0.456f, 0.736f, 0.968f, 1.144f, 1.12f, 0.8f};
float a[7] = {0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f};
float cl;
int i;
float aa = (float) fabs(angle);
cl = 0;
for (i=0; i<8; i++)
{
if( (a[i] <= aa) && (a[i+1] > aa) )
{
cl = clf0[i] - (a[i] - aa) * (clf0[i] - clf0[i+1]) /
(a[i] - a[i+1]);
if (angle < 0) cl = -cl;
break;
}
}
return cl;
}
//------------------------------------------------------------------------//
// Given the attack angle, this function returns the proper drag coefficient
// for a symmetric (no camber) airfoil without flaps.
//------------------------------------------------------------------------//
float RudderDragCoefficient(float angle)
{
float cdf0[7] = {0.0032f, 0.0072f, 0.0104f, 0.0184f, 0.04f, 0.096f, 0.168f};
float a[7] = {0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f};
float cd;
int i;