Animation orbit trajectory overwride from http://cplussplussatplay.blogspot.cz/2011/09/simple-2d-orbit.html
/**
* Created by cf232110 on 26.2.14.
*/
package model {
import flash.geom.Point;
public class OrbitModel {
public var position:Point = new Point();
private const GRAV_CONST:Number = 6.6742e-11; // The "G" in the formula
private const EARTH_MASS:Number = 5.975e24; // The "m" in the formula
private var r:Number = 6.37814e6; // The "r" in the formula
private var angle:Number = 0;
private var grav_accel:Number = 0;
private var body_pos_x:Number = 1.6e6; // An X axis position of the body to be attracted
private var body_pos_y:Number = 0; // A Y axis position of the body to be attracted
private var body_vel_x:Number = 0; // Body velocity split into two components, X and Y
private var body_vel_y:Number = 15.5e3;
private var scale:Number = 10000;
public function progress():Point {
r = Math.sqrt(Math.pow(body_pos_x, 2) + Math.pow(body_pos_y, 2));
grav_accel = GRAV_CONST * (EARTH_MASS / Math.pow(r, 2));
angle = Math.atan2(body_pos_y, body_pos_x);
body_vel_x += Math.cos(angle) * grav_accel;
body_vel_y += Math.sin(angle) * grav_accel;
body_pos_x -= body_vel_x;
body_pos_y -= body_vel_y;
position.x = body_pos_x / scale;
position.y = body_pos_y / scale;
return position;
}
}
}