7 Vector(float nx, float ny)
10 Vector(const Vector& other)
11 : x(other.x), y(other.y)
17 bool operator ==(const Vector& other) const
19 return x == other.x && y == other.y;
22 const Vector& operator=(const Vector& other)
29 Vector operator+(const Vector& other) const
31 return Vector(x + other.x, y + other.y);
34 Vector operator-(const Vector& other) const
36 return Vector(x - other.x, y - other.y);
39 Vector operator*(float s) const
41 return Vector(x * s, y * s);
44 Vector operator/(float s) const
46 return Vector(x / s, y / s);
49 Vector operator-() const
51 return Vector(-x, -y);
54 const Vector& operator +=(const Vector& other)
61 // scalar product of 2 vectors
62 float operator*(const Vector& other) const
64 return x*other.x + y*other.y;
70 // ... add the other operators as needed, I'm too lazy now ...
72 float x, y; // leave this public, get/set methods just give me headaches
73 // for such simple stuff :)