public double CalculateSpaceBetween(Thing t2) { double dist = Location2d.Distance(location, t2.location); dist -= size; dist -= t2.size; return(dist); }
public double CalculateSpaceBetween(Location2d location2, double size2) { double dist = Location2d.Distance(this.location, location2); dist -= size; dist -= size2; return(dist); }
public Vector2d CalculateForce(Thing2 t) { if (t != this.a && t != this.b) { return(new Vector2d(0.0, 0.0)); } double dist = Location2d.Distance(this.a.location, this.b.location); Thing2 ot = (t == this.a) ? this.b : this.a; Vector2d force = new Vector2d(t.location, ot.location); force.Normalize(); force *= dist * k; return(force); }