]> git.mxchange.org Git - flightgear.git/commitdiff
Use wgs_84 time and distance calc routines instead of pure spherical geometry.
authorcurt <curt>
Thu, 14 Oct 1999 19:32:15 +0000 (19:32 +0000)
committercurt <curt>
Thu, 14 Oct 1999 19:32:15 +0000 (19:32 +0000)
src/FDM/MagicCarpet.cxx

index 995486fd1051a352b85cbe430623497fed93841b..a26a4614159dfc6b8a2891364695adabe5bc3f85 100644 (file)
@@ -61,11 +61,18 @@ int FGMagicCarpet::update( int multiloop ) {
     set_Euler_Angles( get_Phi(), get_Theta(), fmod(get_Psi() + turn, FG_2PI) );
 
     // update (lon/lat) position
-    Point3D start( get_Longitude(), get_Latitude(), 0.0 );
-    Point3D end = calc_lon_lat( start, -get_Psi(), dist );
-
-    set_Longitude( end.x() );
-    set_Latitude( end.y() );
+    double lat2, lon2, az2;
+    geo_direct_wgs_84 ( get_Altitude(),
+                       get_Latitude() * RAD_TO_DEG,
+                       get_Longitude() * RAD_TO_DEG,
+                       get_Psi() * RAD_TO_DEG,
+                       dist, &lat2, &lon2, &az2 );
+    set_Longitude( lon2 * DEG_TO_RAD );
+    set_Latitude( lat2 * DEG_TO_RAD );
+
+    // cout << "lon error = " << fabs(end.x()*RAD_TO_DEG - lon2)
+    //      << "  lat error = " << fabs(end.y()*RAD_TO_DEG - lat2)
+    //      << endl;
 
     double sl_radius, lat_geoc;
     fgGeodToGeoc( get_Latitude(), get_Altitude(), &sl_radius, &lat_geoc );
@@ -77,8 +84,7 @@ int FGMagicCarpet::update( int multiloop ) {
 
     set_Geocentric_Position( lat_geoc, get_Longitude(), 
                             sl_radius + get_Altitude() + climb );
-    set_Geodetic_Position( end.y(), end.x(), 
-                          get_Altitude() + climb );
+    set_Altitude( get_Altitude() + climb );
 
     return 1;
 }