public void Vector2DistanceWorks() { var v1 = new Vector2d(1, 1); var v2 = new Vector2d(13, 8); Assert.True(v1.Distance(v2).Equivalent(new Vector2d(12, 7))); }
public void MoveTo(Vector2d from, Vector2d to) { double distance = from.Distance(to).Length(); TimeSpan duration = new TimeSpan(0,0,(int)(distance / Speed)); this.From = from; this.To = to; this.Duration = duration; this.Elapsed = TimeSpan.Zero; if (!_isPlaying) { this.Play(); } else { this.Restart(); } }