SG_LOG(SG_FLIGHT,SG_INFO,"FGJSBsim::set_Latitude: " << lat );
SG_LOG(SG_FLIGHT,SG_INFO," cur alt (ft) = " << alt );
- sgGeodToGeoc( lat, alt * SG_FEET_TO_METER,
- &sea_level_radius_meters, &lat_geoc );
+ if (needTrim)
+ fgic->SetGeodLatitudeRadIC( lat );
+ else {
+ sgGeodToGeoc( lat, alt * SG_FEET_TO_METER,
+ &sea_level_radius_meters, &lat_geoc );
- double sea_level_radius_ft = sea_level_radius_meters * SG_METER_TO_FEET;
- _set_Sea_level_radius( sea_level_radius_ft );
+ double sea_level_radius_ft = sea_level_radius_meters * SG_METER_TO_FEET;
+ _set_Sea_level_radius( sea_level_radius_ft );
- if (needTrim)
- fgic->SetLatitudeRadIC( lat_geoc );
- else
Propagate->SetLatitude(lat_geoc);
+ }
FGInterface::set_Latitude(lat);
}
{
SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Altitude: " << alt );
- if (needTrim) {
- FGLocation position = fgic->GetPosition();
-
- position.SetPositionGeodetic(0.0, position.GetGeodLatitudeRad(), alt);
- fgic->SetAltitudeASLFtIC(position.GetAltitudeASL());
-// fgic->SetLatitudeRadIC(position.GetLatitude());
- }
+ if (needTrim)
+ fgic->SetAltitudeASLFtIC(alt);
else
Propagate->SetAltitudeASL(alt);
//******************************************************************************
+void FGInitialCondition::SetGeodLatitudeRadIC(double geodLatitude)
+{
+ double h = ComputeGeodAltitude(geodLatitude);
+ double lon = position.GetLongitude();
+
+ position.SetPositionGeodetic(lon, geodLatitude, h);
+ lastLatitudeSet = setgeod;
+}
+
+//******************************************************************************
+
void FGInitialCondition::SetLatitudeRadIC(double lat)
{
double altitude;
@param lat Initial latitude in radians */
void SetLatitudeRadIC(double lat);
+ /** Sets the initial geodetic latitude.
+ This method modifies the geodetic altitude in order to keep the altitude
+ above sea level unchanged.
+ @param glat Initial geodetic latitude in radians */
+ void SetGeodLatitudeRadIC(double glat);
+
/** Sets the initial longitude.
@param lon Initial longitude in radians */
void SetLongitudeRadIC(double lon);