diff options
Diffstat (limited to 'Vertex.cpp')
-rw-r--r-- | Vertex.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -18,6 +18,14 @@ Vertex Vertex::operator-(const Vertex &v) const { return Vertex(x - v.x, y - v.y); } +Vertex Vertex::operator*(float f) const { + return Vertex(x*f, y*f); +} + +Vertex Vertex::operator/(float f) const { + return Vertex(x/f, y/f); +} + Vertex& Vertex::operator+=(const Vertex &v) { x += v.x; y += v.y; @@ -31,3 +39,17 @@ Vertex& Vertex::operator-=(const Vertex &v) { return *this; } + +Vertex& Vertex::operator*=(float f) { + x *= f; + y *= f; + + return *this; +} + +Vertex& Vertex::operator/=(float f) { + x /= f; + y /= f; + + return *this; +} |