using System;
using System.Collections.Generic;
using DxLibDLL;
using System.Collections;


namespace HH
{
    class Vector
    {
        public double x;
        public double y;

        public Vector(double x, double y)
        {
            this.x = x;
            this.y = y;
        
        }

        public static Vector operator+ (Vector p, Vector q)
        {
            return new Vector(p.x + q.x, p.y + q.y);
        }

        public static Vector operator- (Vector p, Vector q)
        {
            return new Vector(p.x - q.x, p.y - q.y);
        }

        public static Vector operator *(double l, Vector q)
        {
            return new Vector(l* q.x, l* q.y);
        }

        public static Vector operator /(Vector p, double l)
        {
            return new Vector(p.x/l, p.y/l);
        }

        public double length()
        {
            return Math.Sqrt(this.x * this.x + this.y * this.y); 
        }

        public static Vector unitvector(Vector p, Vector q)
        {
            return (q - p) / ((q - p).length());
        }

        public Vector unitvector()
        {
            return this / this.length();
        }

        public Vector rot(double angle)
        {
            return new Vector(    this.x * Math.Cos(angle * (Math.PI / 180) )
                                - this.y * Math.Sin(angle * (Math.PI / 180) ),
                                  this.x * Math.Sin(angle * (Math.PI / 180) )
                                + this.y * Math.Cos(angle * (Math.PI / 180) ) );
        }


    }
}
