sgp4ext.cpp   sgp4ext.cpp
skipping to change at line 282 skipping to change at line 282
{ {
sine= ( sqrt( 1.0 -ecc*ecc ) * sin(nu) ) / ( 1.0 +ecc*cos(nu) ); sine= ( sqrt( 1.0 -ecc*ecc ) * sin(nu) ) / ( 1.0 +ecc*cos(nu) );
cose= ( ecc + cos(nu) ) / ( 1.0 + ecc*cos(nu) ); cose= ( ecc + cos(nu) ) / ( 1.0 + ecc*cos(nu) );
e0 = atan2( sine,cose ); e0 = atan2( sine,cose );
m = e0 - ecc*sin(e0); m = e0 - ecc*sin(e0);
} }
else else
// -------------------- hyperbolic -------------------- // -------------------- hyperbolic --------------------
if ( ecc > 1.0 + small ) if ( ecc > 1.0 + small )
{ {
if ((ecc > 1.0 ) && (fabs(nu)+0.00001 < ) if ((ecc > 1.0 ) && (fabs(nu)+0.00001 < M_PI-acos(1.0 /ecc )))
{ {
sine= ( sqrt( ecc*ecc-1.0 ) * sin(nu) ) / ( 1.0 + ec c*cos(nu) ); sine= ( sqrt( ecc*ecc-1.0 ) * sin(nu) ) / ( 1.0 + ec c*cos(nu) );
e0 = asinh( sine ); e0 = asinh( sine );
m = ecc*sinh(e0) - e0; m = ecc*sinh(e0) - e0;
} }
} }
else else
// ----------------- parabolic --------------------- // ----------------- parabolic ---------------------
if ( fabs(nu) < 168.0*/180.0 ) if ( fabs(nu) < 168.0*M_PI/180.0 )
{ {
e0= tan( nu*0.5 ); e0= tan( nu*0.5 );
m = e0 + (e0*e0*e0)/3.0; m = e0 + (e0*e0*e0)/3.0;
} }
if ( ecc < 1.0 ) if ( ecc < 1.0 )
{ {
m = fmod( m,2.0 * ); m = fmod( m,2.0 *M_PI );
if ( m < 0.0 ) if ( m < 0.0 )
m = m + 2.0 m = m + 2.0 *M_PI;
e0 = fmod( e0,2.0 ); e0 = fmod( e0,2.0 *M_PI );
} }
} // end newtonnu } // end newtonnu
/* ------------------------------------------------------------------------ ----- /* ------------------------------------------------------------------------ -----
* *
* function rv2coe * function rv2coe
* *
* this function finds the classical orbital elements given the geocentric * this function finds the classical orbital elements given the geocentric
* equatorial position and velocity vectors. * equatorial position and velocity vectors.
* *
skipping to change at line 376 skipping to change at line 376
double& p, double& a, double& ecc, double& incl, double& omega, doub le& argp, double& p, double& a, double& ecc, double& incl, double& omega, doub le& argp,
double& nu, double& m, double& arglat, double& truelon, double& lonp er double& nu, double& m, double& arglat, double& truelon, double& lonp er
) )
{ {
double undefined, small, hbar[3], nbar[3], magr, magv, magn, ebar[3] , sme, double undefined, small, hbar[3], nbar[3], magr, magv, magn, ebar[3] , sme,
rdotv, infinite, temp, c1, hk, twopi, magh, halfpi, e; rdotv, infinite, temp, c1, hk, twopi, magh, halfpi, e;
int i; int i;
char typeorbit[3]; char typeorbit[3];
twopi = 2.0 * twopi = 2.0 * M_PI;
halfpi = 0.5 * halfpi = 0.5 * M_PI;
small = 0.00000001; small = 0.00000001;
undefined = 999999.1; undefined = 999999.1;
infinite = 999999.9; infinite = 999999.9;
// ------------------------- implementation ----------------- // ------------------------- implementation -----------------
magr = mag( r ); magr = mag( r );
magv = mag( v ); magv = mag( v );
// ------------------ find h n and e vectors ---------------- // ------------------ find h n and e vectors ----------------
cross( r,v, hbar ); cross( r,v, hbar );
skipping to change at line 419 skipping to change at line 419
// ----------------- find inclination ------------------- // ----------------- find inclination -------------------
hk= hbar[2]/magh; hk= hbar[2]/magh;
incl= acos( hk ); incl= acos( hk );
// -------- determine type of orbit for later use -------- // -------- determine type of orbit for later use --------
// ------ elliptical, parabolic, hyperbolic inclined ------- // ------ elliptical, parabolic, hyperbolic inclined -------
strcpy(typeorbit,"ei"); strcpy(typeorbit,"ei");
if ( ecc < small ) if ( ecc < small )
{ {
// ---------------- circular equatorial --------------- // ---------------- circular equatorial ---------------
if ((incl<small) | (fabs(incl-)<small)) if ((incl<small) | (fabs(incl-M_PI)<small))
strcpy(typeorbit,"ce"); strcpy(typeorbit,"ce");
else else
// -------------- circular inclined --------------- // -------------- circular inclined ---------------
strcpy(typeorbit,"ci"); strcpy(typeorbit,"ci");
} }
else else
{ {
// - elliptical, parabolic, hyperbolic equatorial -- // - elliptical, parabolic, hyperbolic equatorial --
if ((incl<small) | (fabs(incl-)<small)) if ((incl<small) | (fabs(incl-M_PI)<small))
strcpy(typeorbit,"ee"); strcpy(typeorbit,"ee");
} }
// ---------- find longitude of ascending node ------------ // ---------- find longitude of ascending node ------------
if ( magn > small ) if ( magn > small )
{ {
temp= nbar[0] / magn; temp= nbar[0] / magn;
if ( fabs(temp) > 1.0 ) if ( fabs(temp) > 1.0 )
temp= sgn(temp); temp= sgn(temp);
omega= acos( temp ); omega= acos( temp );
End of changes. 7 change blocks.
9 lines changed or deleted 9 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/