Update of /cvsroot/gcblue/gcb_wx/src/database
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30041/src/database
Modified Files:
tcBallisticDBObject.cpp
Log Message:
Index: tcBallisticDBObject.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcBallisticDBObject.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** tcBallisticDBObject.cpp 8 Aug 2004 00:31:33 -0000 1.3
--- tcBallisticDBObject.cpp 12 Aug 2004 01:14:28 -0000 1.4
***************
*** 48,53 ****
{
float launchSpeed = launchSpeed_mps;
! float fac = range_m * range_m * C_G * C_G; // 4 * 0.25 = 1
float b = -launchSpeed * launchSpeed;
float b2 = b * b;
--- 48,56 ----
{
float launchSpeed = launchSpeed_mps;
!
! float fac = range_m * range_m * C_G2; // 4 * 0.25 = 1
float b = -launchSpeed * launchSpeed;
+ const float two_over_g = 2.0f / C_G;
+ float one_over_launchSpeed = 1.0f / launchSpeed_mps;
float b2 = b * b;
***************
*** 58,66 ****
}
! float vz = sqrtf( 0.5f * (-b - sqrt(b2 - fac)) ); // -b + for lofted trajectory
! tti_s = 2 * vz / C_G;
! float elevation_rad = asinf(vz / launchSpeed);
return elevation_rad;
--- 61,94 ----
}
! float vz = sqrtf( 0.5f * (-b - sqrtf(b2 - fac)) ); // -b + for lofted trajectory
! tti_s = two_over_g * vz;
! float elevation_rad = asinf(one_over_launchSpeed * vz);
!
! // if target altitude difference is negligible, return
! if (fabsf(dz_m) <= 1.0f) return elevation_rad;
!
!
! /* otherwise re-estimate with range adjusted for altitude difference.
! ** This is a coarse approximation and will still have error.
! ** A better approximation can be done using an enhanced quadratic (or
! ** an iterative solution of the exact equation).
! */
! wxASSERT(dz_m != 0);
! range_m += (dz_m / vz) * launchSpeed * cosf(elevation_rad);
!
! // update calculations with new range_m
! fac = range_m * range_m * C_G2;
!
! if (b2 < fac)
! {
! tti_s = 0;
! return 0.25f * C_PI;
! }
!
! vz = sqrtf( 0.5f * (-b - sqrtf(b2 - fac)) );
! tti_s = two_over_g * vz;
! elevation_rad = asinf(one_over_launchSpeed * vz);
return elevation_rad;
|