+ char buffer[12];
+ FGRunway * rwy = apt->getRunwayByIdent(activeRunway);
+ assert( rwy != NULL );
+ SGGeod threshold = rwy->threshold();
+ double currElev = threshold.getElevationFt();
+
+ double touchdownDistance = runwayGlideslopeTouchdownDistance(rwy);
+ if (touchdownDistance < 0.0) {
+ double landingLength = rwy->lengthM() - (rwy->displacedThresholdM());
+ // touchdown 25% of the way along the landing area
+ touchdownDistance = rwy->displacedThresholdM() + (landingLength * 0.25);
+ }
+
+ SGGeod coord;
+ // find glideslope entry point, 2000' above touchdown elevation
+ double glideslopeEntry = -((2000 * SG_FEET_TO_METER) / tan(3.0)) + touchdownDistance;
+ FGAIWaypoint *wpt = createInAir(ac, "Glideslope begin", rwy->pointOnCenterline(glideslopeEntry),
+ currElev + 2000, vApproach);
+ pushBackWaypoint(wpt);
+
+ // deceleration point, 500' above touchdown elevation - slow from approach speed
+ // to touchdown speed
+ double decelPoint = -((500 * SG_FEET_TO_METER) / tan(3.0)) + touchdownDistance;
+ wpt = createInAir(ac, "500' decel", rwy->pointOnCenterline(decelPoint),
+ currElev + 2000, vTouchdown);
+ pushBackWaypoint(wpt);
+
+ // compute elevation above the runway start, based on a 3-degree glideslope
+ double heightAboveRunwayStart = touchdownDistance *
+ tan(3.0 * SG_DEGREES_TO_RADIANS) * SG_METER_TO_FEET;
+ wpt = createInAir(ac, "CrossThreshold", rwy->begin(),
+ heightAboveRunwayStart + currElev, vTouchdown);
+ pushBackWaypoint(wpt);
+
+ double rolloutDistance = accelDistance(vTouchdownMetric, vTaxiMetric, decelMetric);
+
+ int nPoints = 50;
+ for (int i = 1; i < nPoints; i++) {
+ snprintf(buffer, 12, "landing03%d", i);
+ double t = ((double) i) / nPoints;
+ coord = rwy->pointOnCenterline(touchdownDistance + (rolloutDistance * t));
+ double vel = (vTouchdownMetric * (1.0 - t)) + (vTaxiMetric * t);
+ wpt = createOnGround(ac, buffer, coord, currElev, vel);
+ wpt->setCrossat(currElev);
+ pushBackWaypoint(wpt);
+ }
+
+ wpt->setSpeed(vTaxi);
+ double mindist = (1.1 * rolloutDistance) + touchdownDistance;