public void Add(Speed other) { this.dx += other.dx; this.dy += other.dy; this.direction = (int) MathUtils.ToDegrees(MathUtils.Atan2(this.dy, this.dx)); this.length = MathUtils.Sqrt(this.dx * this.dx + this.dy * this.dy); }
public Speed Copy() { Speed copy = new Speed(); copy.dx = this.dx; copy.dy = this.dy; copy.direction = this.direction; copy.length = this.length; return copy; }