public static Vector CalculateA(Vector pos) { double alen = mu/pos.Len2(); return alen*pos.Norm(); //avk //var phi = Math.PI + pos.PolarAngle; //return new Vector(alen*Math.Cos(phi), alen*Math.Sin(phi)); }
public static Vector CalculateA(Vector pos) { double alen = mu / pos.Len2(); return(alen * pos.Norm()); //avk //var phi = Math.PI + pos.PolarAngle; //return new Vector(alen*Math.Cos(phi), alen*Math.Sin(phi)); }
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 }); }