Пример #1
0
    private List <Orbit.Pass> SortPasses(List <Orbit.Pass> passes)
    {
        List <Orbit.Pass> list = new List <Orbit.Pass>();
        double            num  = 0.0;

        for (int i = 0; i < passes.Count; i++)
        {
            Orbit.Pass pass = null;
            foreach (Orbit.Pass current in passes)
            {
                if (current.startTime > num)
                {
                    if (pass != null)
                    {
                        if (current.startTime < pass.startTime)
                        {
                            pass = current;
                        }
                    }
                    else
                    {
                        pass = current;
                    }
                }
            }
            num = pass.startTime;
            list.Add(pass);
        }
        return(list);
    }
Пример #2
0
    private double ProcessPasss(Orbit.Pass pass)
    {
        double num  = pass.passPlanet.orbitData.orbitHeightM - pass.passPlanet.orbitData.SOI;
        double num2 = this.planet.mass / (num * num) * 2.0;
        int    num3 = 0;
        double num4 = pass.startTime;

        while (num4 < pass.endTime)
        {
            Double3 @double = pass.passPlanet.GetPosOut(num4) - this.GetPosOut(num4);
            double  num5    = @double.magnitude2d - pass.passPlanet.orbitData.SOI;
            Debug.DrawLine((this.GetPosOut(num4) / 10000.0).toVector3, (pass.passPlanet.GetPosOut(num4) / 10000.0).toVector3, (num5 >= 5.0) ? Color.green : Color.red);
            if (num5 < 5.0)
            {
                return(num4);
            }
            Double3 double2 = pass.passPlanet.GetVelOut(num4) - this.GetVelOut(num4);
            double  num6    = Math.Atan2(@double.x, @double.y) + 1.5707963267948966;
            double  num7    = double2.x * Math.Cos(num6) - double2.y * Math.Sin(num6);
            double  num8    = num7 * num7 / (num2 * 2.0);
            double  num9    = Math.Sqrt(2.0 * (num5 + num8) / num2);
            double  num10   = num7 / num2;
            num4 += num9 - num10;
            num3++;
            if (num3 > 50)
            {
                Debug.Log("Could not calculate till the end");
                return(-num4);
            }
        }
        return(0.0);
    }