public Form1() { planet = new Planet(0, 9.81, 67000, new VRageMath.Vector3D(0, 0, 0)); orbit2 = new Orbit(new VRageMath.Vector3D(100000, 0, 0), new VRageMath.Vector3D(0, planet.GetOrbitalVelocity(100000, (100000 + 100000) / 2), 0), planet); orbit = new Orbit(new VRageMath.Vector3D(0, 140000, 0), new VRageMath.Vector3D(-planet.GetOrbitalVelocity(140000, (100000 + 140000) / 2), 0, 0), planet); //Console.WriteLine(planet.GetOrbitalVelocity(2000000,1035000)); epoc = orbit.epoch; Console.WriteLine(planet.GetOrbitalVelocity(100000, (100000 + 100000) / 2)); man = (Maneuver.GetHohmannTransfer (orbit, orbit2, orbit.TrueAnomaly2(0))); InitializeComponent(); }
public static void KepToCart(out Vector3D pos, out Vector3D vel, double a, double I, double w, double q, double e, double M, double E, double V, Planet planet) {//This doesn't work, feel free to try and fix it. double r = a*(1 - e * Math.Cos(E)); Vector3D Op = new Vector3D(r*Math.Cos(V),r*Math.Sin(V),0); Vector3D Ov = new Vector3D(Math.Sqrt(planet.u * a) / r * -Math.Sin(E), Math.Sqrt(planet.u * a) / r*Math.Sqrt(1-Math.Pow(e,2))*Math.Cos(E),0); double Px = Op.GetDim(0) * (Math.Cos(w) * Math.Cos(q) - Math.Sin(w) * Math.Cos(I) * Math.Cos(q)) - Op.GetDim(1) * (Math.Sin(w) * Math.Cos(q) + Math.Cos(w) * Math.Cos(I) * Math.Sin(q)); double Py = Op.GetDim(0) * (Math.Cos(w) * Math.Sin(q) + Math.Sin(w) * Math.Cos(I) * Math.Cos(q)) + Op.GetDim(1) * (Math.Cos(w) * Math.Cos(q) * Math.Cos(I) - Math.Sin(w) * Math.Sin(q)); double Pz = Op.GetDim(0) * (Math.Sin(w) * Math.Sin(I)) + Op.GetDim(1) * (Math.Cos(w) * Math.Sin(I)); double Vx = Ov.GetDim(0) * (Math.Cos(w) * Math.Cos(q) - Math.Sin(w) * Math.Cos(I) * Math.Cos(q)) - Ov.GetDim(1) * (Math.Sin(w) * Math.Cos(q) + Math.Cos(w) * Math.Cos(I) * Math.Sin(q)); double Vy = Ov.GetDim(0) * (Math.Cos(w) * Math.Sin(q) + Math.Sin(w) * Math.Cos(I) * Math.Cos(q)) + Ov.GetDim(1) * (Math.Cos(w) * Math.Cos(q) * Math.Cos(I) - Math.Sin(w) * Math.Sin(q)); double Vz = Ov.GetDim(0) * (Math.Sin(w) * Math.Sin(I)) + Ov.GetDim(1) * (Math.Cos(w) * Math.Sin(I)); pos = new Vector3D(Px,Py,Pz); vel = new Vector3D(Vx,Vy,Vz); }
public Orbit(Vector3D pos, Vector3D vel, Planet planet,DateTime t) { this.planet = planet; CartToKep(pos, vel,t); }
public Trajectory(Planet planet, Vector3D pos, Vector3D vel) { this.planet = planet; this.pos = pos; this.vel = vel; }