// 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;
        }

        /// <summary>
        /// Determines the distance between the two vectors.
        /// </summary>
        /// <param name="target">The target vector.</param>
        /// <returns>The distance between the vectors.</returns>
        public float DistanceTo(Vector2 target)
        {
            return DistanceTo(target.X, target.Y);
        }

        /// <summary>
        /// Determines the distance between the vector and the coordinates.
        /// </summary>
        /// <param name="x">The x-coordinate.</param>
        /// <param name="y">The y-coordinate.</param>
        /// <returns>The distance between the vectors.</returns>
        public float DistanceTo(int x, int y)
        {
            return (float) Math.Sqrt(Math.Pow(x - X, 2) + Math.Pow(y - Y, 2));
        }
    }
}
