// Copyright © 2017-2018 Atomic Software, LLC. All Rights Reserved. // See LICENSE.md for full license information. using System; namespace Atom.Core.Mathematics { public class Vector2 { public int X { get; set; } public int Y { get; set; } public Vector2(int x, int y) { X = x; Y = y; } public Vector2(Vector2 vector) { X = vector.X; Y = vector.Y; } /// /// Determines the distance between the two vectors. /// /// The target vector. /// The distance between the vectors. public float DistanceTo(Vector2 target) { return DistanceTo(target.X, target.Y); } /// /// Determines the distance between the vector and the coordinates. /// /// The x-coordinate. /// The y-coordinate. /// The distance between the vectors. public float DistanceTo(int x, int y) { return (float) Math.Sqrt(Math.Pow(x - X, 2) + Math.Pow(y - Y, 2)); } } }