#ifndef VECTOR_H
#define VECTOR_H
#include "Point.h"
#include <math.h>

class Vector{
 public:
  Vector(){}
  Vector(float myx, float myy, float myz){
    x=myx;
    y=myy;
    z=myz;
  }
  Vector(const Vector& v){
    x=v.x;
    y=v.y;
    z=v.z;
  }
  void operator-(){
    x*=-1;
    y*=-1;
    z*=-1;
  }
  float length() const{
    return sqrt(x*x+y*y+z*z);
  }
  float sqlength() const{
    return x*x+y*y+z*z;
  }
  float normalize(){
    float temp=sqrt(x*x+y*y+z*z);
    x/=temp;
    y/=temp;
    z/=temp;
  }
  //private:
  float x, y, z;
};

Vector operator -(const Point& one, const Point& two){
  return Vector(one.x-two.x, one.y-two.y, one.z-two.z);
}

Vector operator+(const Vector& one, const Vector& two){
  return Vector(one.x+two.x, one.y+two.y, one.z+two.z);
}

Vector operator-(const Vector& one, const Vector& two){
  return Vector(one.x-two.x, one.y-two.y, one.z-two.z);
}

Vector operator*(const float& scal, const Vector& v){
  return Vector(v.x*scal, v.y*scal, v.z*scal);
}

Vector operator*(const Vector& v, const float& scal){
  return Vector(v.x*scal, v.y*scal, v.z*scal);
}

float dot(const Vector& v1, const Vector& v2){
  return v1.x*v2.x+v1.y*v2.y+v1.z*v2.z;
}

Point operator+(const Point& p, const Vector& v){
  return Point(p.x+v.x, p.y+v.y, p.z+v.z);
}

Point operator+(const Vector& p, const Point& v){
  return Point(p.x+v.x, p.y+v.y, p.z+v.z);
}

Point operator-(const Point& p, const Vector& v){
  return Point(p.x-v.x, p.y-v.y, p.z-v.z);
}

//take this out maybe
Vector operator-(const Vector& v, const Point& p){
  return Vector(v.x-p.x, v.y-p.y, v.z-p.z);
}

#endif

