public static SFVec2F xy(float x, float y) { var v = new SFVec2F { X=x, Y=y }; return v; }
public void ApplyChargeForce(double repulsion, SFVec2F distance) { double d; SFVec2F direction; SFVec2F force; d = distance.magnitude() + 0.1; // avoid massive forces at small distances (and divide by zero) direction = distance.normalise(); force = direction * repulsion / (d * d * 0.5); ApplyForce(force); // using coulombs law: // k*QA*QB // F = ________ // r^2 }
public void ApplyForce(SFVec2F force) { this.Acceleration += (force / this.Mass); }
public TNode() { Children = new List<TNode>(); Acceleration = SFVec2F.Zero; Point = SFVec2F.Zero; }