示例#1
0
        public void keplerian3constraint(double sma, double ecc, double inc, bool omitCoast, bool targetInc)
        {
            if (status == PVGStatus.ENABLED)
            {
                return;
            }

            bool doupdate = false;

            if (sma != old_sma || ecc != old_ecc)
            {
                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.KEPLER3)
            {
                doupdate = true;
            }

            if (p == null || doupdate)
            {
                if (p != null)
                {
                    p.KillThread();
                }

                Debug.Log("[MechJeb] MechJebModuleGuidanceController: setting up keplerian3constraint");
                PontryaginLaunch solver = NewPontryaginForLaunch(inc, sma);
                solver.omitCoast = omitCoast;
                solver.keplerian3constraint(sma, ecc, inc * UtilMath.Deg2Rad);
                p = solver;
            }

            old_sma = sma;
            old_ecc = ecc;
            old_inc = inc;
        }
        public void keplerian3constraint(double sma, double ecc, double inc, bool omitCoast, bool currentInc)
        {
            if (status == PVGStatus.ENABLED)
            {
                return;
            }

            bool doupdate = false;

            if (sma != old_sma || ecc != old_ecc)
            {
                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 keplerian3constraint");
                PontryaginLaunch solver = NewPontryaginForLaunch(inc, sma);
                solver.omitCoast = omitCoast;
                solver.keplerian3constraint(sma, ecc, inc * UtilMath.Deg2Rad);
                p = solver;
            }

            old_sma = sma;
            old_ecc = ecc;
            old_inc = inc;
        }