- // calculate runway threshold point
- double thresh_lat, thresh_lon, return_az;
- geo_direct_wgs_84 ( 0.0, rwy->lat, rwy->lon, hdg,
- rwy->length/2.0 * SG_FEET_TO_METER,
- &thresh_lat, &thresh_lon, &return_az );
- // cout << "Threshold = " << thresh_lat << "," << thresh_lon << endl;
-
- // calculate distance from threshold to localizer
- double az1, az2, dist_m;
- geo_inverse_wgs_84( 0.0, loc->get_lat(), loc->get_lon(),
- thresh_lat, thresh_lon,
- &az1, &az2, &dist_m );
- // cout << "Distance = " << dist_m << endl;
-
- // back project that distance along the runway center line
- double nloc_lat, nloc_lon;
- geo_direct_wgs_84 ( 0.0, thresh_lat, thresh_lon, hdg + 180.0,
- dist_m, &nloc_lat, &nloc_lon, &return_az );
- // printf("New localizer = %.6f %.6f\n", nloc_lat, nloc_lon );
-
- // sanity check, how far have we moved the localizer?
- geo_inverse_wgs_84( 0.0, loc->get_lat(), loc->get_lon(),
- nloc_lat, nloc_lon,
- &az1, &az2, &dist_m );
- // cout << "Distance moved = " << dist_m << endl;
-
- loc->set_lat( nloc_lat );
- loc->set_lon( nloc_lon );
- loc->set_multiuse( rwy->heading );
-
- // cout << "orig heading = " << loc->get_multiuse() << endl;
- // cout << "new heading = " << rwy->heading << endl;