- int i;
-
- // Compute the radius of the aircraft. That is the radius of a ball
- // where all gear units are in. At the moment it is at least 10ft ...
- double acrad = 10.0;
- int n_gears = GroundReactions->GetNumGearUnits();
- for (i=0; i<n_gears; ++i) {
- FGColumnVector3 bl = GroundReactions->GetGearUnit(i)->GetBodyLocation();
- double r = bl.Magnitude();
- if (acrad < r)
- acrad = r;
- }
-
- // Compute the potential movement of this aircraft and query for the
- // ground in this area.
- double groundCacheRadius = acrad + 2*dt*Propagate->GetUVW().Magnitude();
- double alt, slr, lat, lon;
- FGColumnVector3 cart = Auxiliary->GetLocationVRP();
- if ( needTrim && startup_trim->getBoolValue() ) {
- alt = fgic->GetAltitudeFtIC();
- slr = fgic->GetSeaLevelRadiusFtIC();
- lat = fgic->GetLatitudeDegIC() * SGD_DEGREES_TO_RADIANS;
- lon = fgic->GetLongitudeDegIC() * SGD_DEGREES_TO_RADIANS;
- cart = FGLocation(lon, lat, alt+slr);
- }
- double cart_pos[3] = { cart(1), cart(2), cart(3) };
- bool cache_ok = prepare_ground_cache_ft( State->Getsim_time(), cart_pos,
- groundCacheRadius );
- if (!cache_ok) {
- SG_LOG(SG_FLIGHT, SG_WARN,
- "FGInterface is being called without scenery below the aircraft!");
- SG_LOG(SG_FLIGHT, SG_WARN,
- "altitude = " << alt);
- SG_LOG(SG_FLIGHT, SG_WARN,
- "sea level radius = " << slr);
- SG_LOG(SG_FLIGHT, SG_WARN,
- "latitude = " << lat);
- SG_LOG(SG_FLIGHT, SG_WARN,
- "longitude = " << lon);
- //return;
- }