Esempio n. 1
0
        public static Vector CalculateHohmannJump(Vector pos, Vector v, double targetR)
        {
            var r          = pos.Len();
            var desirableV = Math.Sqrt(2 * mu * targetR / (r * (r + targetR)));

            return(v - GetTangentVector(pos, desirableV));
        }
Esempio n. 2
0
		public static Orbit CalculateOrbit(Vector pos, Vector v)
		{
			double alpha = pos.PolarAngle;
			double beta = v.PolarAngle;
			double vAngle = Math.PI/2 - (alpha - beta);
			double vr = v.Len()*Math.Sin(vAngle);
			double vt = v.Len()*Math.Cos(vAngle);
			double H = vt*pos.Len();
			double theta = Math.Atan2(vr, vt - mu/H);
			double orbitAngle = -(theta + alpha - Math.PI);

			double a = (mu*pos.Len())/(2*mu - v.Len2()*pos.Len());
			double e = vr/(mu*Math.Sin(theta)/H);
			double b = a*Math.Sqrt(1 - e*e);
			//SolverLogger.Log("H = " + H);
			return new Orbit {SemiMajorAxis = a, SemiMinorAxis = b, TransformAngle = orbitAngle};
		}
Esempio n. 3
0
        public static Orbit CalculateOrbit(Vector pos, Vector v)
        {
            double alpha      = pos.PolarAngle;
            double beta       = v.PolarAngle;
            double vAngle     = Math.PI / 2 - (alpha - beta);
            double vr         = v.Len() * Math.Sin(vAngle);
            double vt         = v.Len() * Math.Cos(vAngle);
            double H          = vt * pos.Len();
            double theta      = Math.Atan2(vr, vt - mu / H);
            double orbitAngle = -(theta + alpha - Math.PI);

            double a = (mu * pos.Len()) / (2 * mu - v.Len2() * pos.Len());
            double e = vr / (mu * Math.Sin(theta) / H);
            double b = a * Math.Sqrt(1 - e * e);

            //SolverLogger.Log("H = " + H);
            return(new Orbit {
                SemiMajorAxis = a, SemiMinorAxis = b, TransformAngle = orbitAngle
            });
        }
Esempio n. 4
0
		public static Vector CalculateHohmannJump(Vector pos, Vector v, double targetR)
		{
			var r = pos.Len();
			var desirableV = Math.Sqrt(2 * mu * targetR / (r * (r + targetR)));
			return v - GetTangentVector(pos, desirableV);
		}
Esempio n. 5
0
		public static Vector GetTangentVector(Vector pos, double v)
		{
			return new Vector(v * pos.y / pos.Len(), -v * pos.x / pos.Len());
		}
Esempio n. 6
0
 public static Vector GetTangentVector(Vector pos, double v)
 {
     return(new Vector(v * pos.y / pos.Len(), -v * pos.x / pos.Len()));
 }