public void keplerian4constraintArgPfree(double sma, double ecc, double inc, double LAN, bool omitCoast, bool targetInc, bool targetLAN) { if (status == PVGStatus.ENABLED) { return; } bool doupdate = false; if (sma != old_sma || ecc != old_ecc) { doupdate = true; } // if we are tracking a target LAN, don't reset if (LAN != old_LAN && !targetLAN) { doupdate = true; } // if we are tracking a target inc, don't reset if (inc != old_inc && !targetInc) { doupdate = true; } if (p != null && p.bctype != BCType.KEPLER4) { doupdate = true; } if (p == null || doupdate) { if (p != null) { p.KillThread(); } Debug.Log("[MechJeb] MechJebModuleGuidanceController: setting up keplerian4constraintArgPfree"); PontryaginLaunch solver = NewPontryaginForLaunch(inc, sma); solver.omitCoast = omitCoast; solver.keplerian4constraintArgPfree(sma, ecc, inc * UtilMath.Deg2Rad, LAN * UtilMath.Deg2Rad); p = solver; } old_sma = sma; old_ecc = ecc; old_inc = inc; old_LAN = LAN; }
public void keplerian4constraintArgPfree(double sma, double ecc, double inc, double LAN, bool omitCoast, bool currentInc) { if (status == PVGStatus.ENABLED) { return; } bool doupdate = false; if (sma != old_sma || ecc != old_ecc || LAN != old_LAN) { doupdate = true; } // avoid slight drift in the current inclination from resetting guidance constantly if (inc != old_inc && !currentInc) { doupdate = true; } if (p == null || doupdate) { if (p != null) { p.KillThread(); } Debug.Log("[MechJeb] MechJebModuleGuidanceController: setting up keplerian4constraintArgPfree"); PontryaginLaunch solver = NewPontryaginForLaunch(inc, sma); solver.omitCoast = omitCoast; solver.keplerian4constraintArgPfree(sma, ecc, inc * UtilMath.Deg2Rad, LAN * UtilMath.Deg2Rad); p = solver; } old_sma = sma; old_ecc = ecc; old_inc = inc; old_LAN = LAN; }