From 0b64bb1c0d3ebd1c9367f234df40e2f797309ccc Mon Sep 17 00:00:00 2001 From: Daniel Warner Date: Mon, 4 Apr 2011 00:16:50 +0100 Subject: [PATCH] Fixed lyddane modification --- SGDP4.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/SGDP4.cpp b/SGDP4.cpp index dc4ff32..8faef95 100644 --- a/SGDP4.cpp +++ b/SGDP4.cpp @@ -1010,6 +1010,10 @@ void SGDP4::DeepSpacePeriodics(const double& t, double& em, alfdp += dalf; betdp += dbet; + xnodes = fmod(xnodes, TWOPI); + if (xnodes < 0.0) + xnodes += TWOPI; + double xls = xll + omgasm + cosis * xnodes; double dls = pl + pgh - pinc * xnodes * sinis; xls += dls; @@ -1020,6 +1024,9 @@ void SGDP4::DeepSpacePeriodics(const double& t, double& em, const double oldxnodes = xnodes; xnodes = atan2(alfdp, betdp); + if (xnodes < 0.0) + xnodes += TWOPI; + /* * Get perturbed xnodes in to same quadrant as original. * RAAN is in the range of 0 to 360 degrees