private void CalFromOthers(BigObject me, double time) { foreach (var ellipse in Objects) { if (!Equals(ellipse, me)) { var f = Force(me.Mass, ellipse.Mass, Distance(me, ellipse)); var a = Acceleration(f, me.Mass, Angle(me, ellipse)); var v = Velocity(me.Vector, a, time); me.Vector = v; } } }
protected bool Equals(BigObject other) { return(Color.Equals(other.Color) && Mass.Equals(other.Mass) && Size.Equals(other.Size)); }
public Vector Angle(BigObject one, BigObject two) { var angle = two.Postion - one.Postion; return((angle) / angle.Length); }
public double Distance(BigObject one, BigObject two) { return(Math.Sqrt(Math.Pow(one.Postion.X + two.Postion.X, 2) + Math.Pow(one.Postion.Y + two.Postion.Y, 2))); }