diff --git a/src/game.cpp b/src/game.cpp index fed9c46..534e9c8 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -211,23 +211,33 @@ testManeuverStep(const ManeuverNode& maneuver, } void -applyManeuver(GameOrbit* orbit) +applyManeuver(GameOrbit* orbit, double previous_true_anomaly) { - LOGF(Debug, "applying maneuver\n"); + const ManeuverNode& node = orbit->maneuver; + TwoBodySystem& sys = orbit->system; + + LOGF(Debug, "applying maneuver,\n" + "theta: %f\n," + "dv: %f,\n" + "sat.theta: %f,\n" + "previous theta: %f\n", + node.true_anomaly, + node.impulse_delta_v, + sys.sat.theta, + previous_true_anomaly); // FIXME: assuming prograde impulse vector - assert(orbit->maneuver.impulse_type == ImpulseType::PROGRADE); + assert(node.impulse_type == ImpulseType::PROGRADE); // re-calculate state vectors at the maneuver node - TwoBodySystem& sys = orbit->system; - double theta = orbit->maneuver.true_anomaly; + double theta = node.true_anomaly; double mu = sys.body.mu; double r = orbitGetRadialDistance(sys.ep.e, sys.ep.p, theta); double v = orbitGetVelocity(sys.epsilon, mu, r); double gamma = orbitGetFlightPathAngle(sys.ep.e, theta); // calculate new satellite state vectors - v += orbit->maneuver.impulse_delta_v; // prograde only + v += node.impulse_delta_v; // prograde only // get new angular momentum and specific orbital energy double h = orbitGetAngularMomentumFromStateVectors(r, v, gamma); diff --git a/src/game.h b/src/game.h index b69a390..1a3f3e2 100644 --- a/src/game.h +++ b/src/game.h @@ -98,4 +98,4 @@ bool testManeuverStep(const ManeuverNode& maneuver, double previous_theta, double next_theta); -void applyManeuver(GameOrbit* orbit); +void applyManeuver(GameOrbit* orbit, double previous_true_anomaly);