Game Development Reference
In-Depth Information
else if (geoAltitude < 32000.0) {
slope = 0.001;
T0 = 216.65;
p0 = 5474.8;
h0 = 20000.0;
}
else if (geoAltitude < 47000.0) {
slope = 0.0028;
T0 = 228.65;
p0 = 868.0;
h0 = 32000.0;
}
else if (geoAltitude < 51000.0) {
slope = 0.0;
T0 = 270.65;
p0 = 110.9;
h0 = 47000.0;
}
else if (geoAltitude < 71000.0) {
slope = -0.0028;
T0 = 270.65;
p0 = 66.9;
h0 = 51000.0;
}
else if (geoAltitude < 84000.0) {
slope = -0.002;
T0 = 214.65;
p0 = 3.96;
h0 = 71000.0;
}
else {
slope = 0.0;
T0 = 186.9;
p0 = 0.373;
h0 = 84000.0;
}
// Compute temperature and pressure. The equations
// used depend on whether the temperature is constant
// in the current altitude range.
if ( slope == 0.0 ) {
temperature = T0;
grp = -G*(geoAltitude - h0)/(R*temperature);
pressure = p0*Math.exp(grp);
}
Search WWH ::




Custom Search