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)); }
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}; }
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 }); }
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); }
public static Vector GetTangentVector(Vector pos, double v) { return new Vector(v * pos.y / pos.Len(), -v * pos.x / pos.Len()); }
public static Vector GetTangentVector(Vector pos, double v) { return(new Vector(v * pos.y / pos.Len(), -v * pos.x / pos.Len())); }