[Gcblue-commits] gcb_wx/src/common simmath.cpp,1.34,1.35
Status: Alpha
Brought to you by:
ddcforge
From: Dewitt C. <ddc...@us...> - 2006-11-20 00:18:12
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv29807/src/common Modified Files: simmath.cpp Log Message: Index: simmath.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/simmath.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** simmath.cpp 24 Oct 2006 01:34:02 -0000 1.34 --- simmath.cpp 20 Nov 2006 00:17:39 -0000 1.35 *************** *** 622,635 **** } /** * Predicts position ahead by dt_s seconds */ void tcKinematics::PredictPosition(float dt_s, ! double& lon_rad, double& lat_rad, float& alt_m) { float v = C_KTSTOMPS*mfSpeed_kts; - float vz = v*sinf(mfPitch_rad); ! float cospitch = cosf(mfPitch_rad); float k = C_MTORAD * dt_s * v * cospitch; float dlon = k * sinf(mfHeading_rad) / cosf(mfLat_rad); --- 622,662 ---- } + + /** + * Extrapolates position ahead in time by dt_s (or behind if dt_s < 0) + */ + void tcKinematics::Extrapolate(float dt_s) + { + double lon_rad; + double lat_rad; + float alt_m; + + PredictPosition(dt_s, lon_rad, lat_rad, alt_m); + + mfLon_rad = lon_rad; + mfLat_rad = lat_rad; + mfAlt_m = alt_m; + } + /** * Predicts position ahead by dt_s seconds */ void tcKinematics::PredictPosition(float dt_s, ! double& lon_rad, double& lat_rad, float& alt_m) const { float v = C_KTSTOMPS*mfSpeed_kts; ! float vz, cospitch; ! if (mfPitch_rad == 0) ! { ! vz = 0; ! cospitch = 1.0f; ! } ! else ! { ! vz = v*sinf(mfPitch_rad); ! cospitch = cosf(mfPitch_rad); ! } ! float k = C_MTORAD * dt_s * v * cospitch; float dlon = k * sinf(mfHeading_rad) / cosf(mfLat_rad); |